diff options
author | Dave Reisner <d@falconindy.com> | 2010-01-17 20:58:40 -0500 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2010-01-17 20:58:40 -0500 |
commit | 959c2c6eb06ffa92172538de68f200ca6224f824 (patch) | |
tree | afd7e40e78a090b6c584f0e1d5872a7d5e9ccca0 /squashfu | |
parent | 7aedf0c69e48ecb79c81ffbe539f06b716abf042 (diff) | |
download | squashfu-959c2c6eb06ffa92172538de68f200ca6224f824.tar.gz |
Cleanup mounting calls. Don't needlessly unmount squash just to mount it again, just check if its mounted and mount if we need it. In line with this, restrict verbose output about mounting to the mount squash/union functions
Diffstat (limited to 'squashfu')
-rwxr-xr-x | squashfu | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -79,8 +79,7 @@ create_new_incremental () { # Determine the mount order via binventory local bin_order=($(sort -n -r -t: -k2 "$BINVENTORY" | cut -d: -f1)) - info "Mounting squash and union" - mount_squash + mountpoint "${SQUASH_MOUNT}" &>/dev/null || mount_squash mount_union_with_bins ${bin_order[@]} # Die with error on mount, else start rsync @@ -133,6 +132,7 @@ mount_squash () { mount_union_with_bins () { # Arguments: numbers of bins to be mounted (variable number) # Returns: 0 on successful mount, non-zero on failure + info "Mounting union" debug "Requested to mount bins: $*" # Mount first as rw, shift, and mount the rest ro @@ -255,9 +255,8 @@ action_backup () { info "Backup requested at $(date --rfc-3339=seconds)" - # Cleanup mounts, in case user was doing a rollback and forgot to unmount (or error on last run) + # Cleanup union, in case user was doing a rollback and forgot to unmount (or error on last run) mountpoint "$UNION_MOUNT" &>/dev/null && unmount_union - mountpoint "$SQUASH_MOUNT" &>/dev/null && unmount_squash create_new_incremental @@ -300,9 +299,7 @@ action_rollback () { local num_to_mount=$[ ${#bin_list[@]} - $1 ] mountpoint "$UNION_MOUNT" &>/dev/null && unmount_union - mountpoint "$SQUASH_MOUNT" &>/dev/null && unmount_squash - - mount_squash + mountpoint "$SQUASH_MOUNT" &>/dev/null || mount_squash mount_union_with_bins ${bin_list[@]:(-$num_to_mount)} |