From 9aab1880edb3251fbbbf0046a1e55401d0d4fee8 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 8 Jan 2010 19:06:57 -0500 Subject: Split unmount_all into two separate functions, calling both for _all --- squashfu | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/squashfu b/squashfu index 7946ba2..6f29be0 100755 --- a/squashfu +++ b/squashfu @@ -153,13 +153,24 @@ run_rsync() { rsync ${RSYNC_OPTS[@]} ${INCLUDES[@]} ${EXCLUDES[@]} ${BKUP_ROOT}/rw || return 1 } -# Unmount union and squash unmount_all () { #Union must be unmounted first, or bad things happen - grep "${BKUP_ROOT}/rw" /proc/mounts && - { debug Unmounting union...; umount "$BKUP_ROOT/rw"; } - grep "${SEED}" /proc/mounts && - { debug Unmounting squash...; umount "${SEED}"; } + unmount_union + unmount_seed +} + +unmount_seed () { + # Account for possibility of multiple mounts + while [[ `grep "${SEED}" /proc/mounts` ]]; do + umount "${SEED}" + done +} + +unmount_union () { + # Account for possibility of multiple mounts + while [[ `grep "${BKUP_ROOT}" /proc/mounts` ]]; do + umount "${BKUP_ROOT}" + done } usage () { -- cgit v1.2.3