aboutsummaryrefslogtreecommitdiffstats
path: root/squashfu
diff options
context:
space:
mode:
Diffstat (limited to 'squashfu')
-rwxr-xr-xsquashfu25
1 files changed, 14 insertions, 11 deletions
diff --git a/squashfu b/squashfu
index a233ea4..7ef964b 100755
--- a/squashfu
+++ b/squashfu
@@ -128,9 +128,10 @@ unmount_union () {
# Args: none
# Returns: return code from umount
info "Unmounting union"
-
- $(mountpoint -q "$UNION_MOUNT") && umount "$UNION_MOUNT" 2>/dev/null
-
+ while [[ $(mountpoint "$UNION_MOUNT" | grep "is a mount") ]]; do
+ umount "$UNION_MOUNT" 2>/dev/null
+ sleep 1
+ done
return $?
}
@@ -138,9 +139,10 @@ unmount_squash () {
# Args: none
# Returns: return code from umount
info "Unmounting squash"
-
- $(mountpoint -q "$SQUASH_MOUNT") && umount "$SQUASH_MOUNT" 2>/dev/null
-
+ while [[ $(mountpoint "$SQUASH_MOUNT" | grep "is a mount") ]]; do
+ umount "$SQUASH_MOUNT" 2>/dev/null
+ sleep 1
+ done
return $?
}
@@ -153,7 +155,8 @@ unmount_all () {
fi
# Union MUST be unmounted first
- unmount_union && unmount_squash || die "Failure during unmounting"
+ unmount_union
+ unmount_squash
}
check_for_resquash () {
@@ -227,7 +230,7 @@ action_backup () {
info "Backup requested at $(date --rfc-3339=seconds)"
# Cleanup union, in case user was doing a rollback and forgot to unmount (or error on last run)
- mountpoint -q "$UNION_MOUNT" && unmount_union
+ mountpoint "$UNION_MOUNT" &>/dev/null && unmount_union
info "Creating new bin"
# Make a new bin for this incremenetal
@@ -238,7 +241,7 @@ action_backup () {
# Determine the mount order via binventory
local bin_order=($(sort -n -r -t: -k2 "$BINVENTORY" | cut -d: -f1))
- mountpoint -q "${SQUASH_MOUNT}" || mount_squash
+ mountpoint "${SQUASH_MOUNT}" &>/dev/null || mount_squash
mount_union_with_bins ${bin_order[@]}
# Die with error on mount, else start rsync
@@ -333,8 +336,8 @@ action_rollback () {
local num_to_mount=$(( ${#bin_list[@]} - $1 ))
- mountpoint -q "$UNION_MOUNT" && unmount_union
- mountpoint -q "$SQUASH_MOUNT" || mount_squash
+ mountpoint "$UNION_MOUNT" &>/dev/null && unmount_union
+ mountpoint "$SQUASH_MOUNT" &>/dev/null || mount_squash
mount_union_with_bins ${bin_list[@]:(-$num_to_mount)}