#!/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