lackadaisical/umount-squash-image
2026-03-13 00:37:28 +01:00

16 lines
407 B
Bash
Executable file

#!/bin/bash
DIR="$@"
DIR=$(readlink -f "$DIR")
DIR_SHORT=$(basename "$DIR")
OVERLAY_ROOT=$(readlink -f "${DIR}/..")/.squashfs/${DIR_SHORT}
OVERLAY_UPPER=${OVERLAY_ROOT}/upper
OVERLAY_LOWER=${OVERLAY_ROOT}/lower
OVERLAY_WORK=${OVERLAY_ROOT}/work
OVERLAY_TARG=$DIR
sudo umount -R "$OVERLAY_TARG" 2>/dev/null
sudo umount -R "$OVERLAY_LOWER" 2>/dev/null
echo "SquashFS filesystem has been unmounted."
exit 0