From 7710ab2b827374767a518d9f5a3991474dd2fa95 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 18 Jan 2010 11:25:35 -0500 Subject: define new_bin in action_backup so it can be later used to remove the bin if/when required --- squashfu | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/squashfu b/squashfu index 8ca2b23..c6d2f9e 100755 --- a/squashfu +++ b/squashfu @@ -231,7 +231,8 @@ action_backup () { info "Creating new bin" # Make a new bin for this incremenetal get_next_available_bin - create_new_bin $? + local new_bin=$? + create_new_bin $new_bin # Determine the mount order via binventory local bin_order=($(sort -n -r -t: -k2 "$BINVENTORY" | cut -d: -f1)) @@ -252,9 +253,9 @@ action_backup () { /usr/bin/rsync ${RSYNC_OPTS[@]} ${INCLUDES[@]} ${EXCLUDES[@]} "$UNION_MOUNT" if [[ $? -gt 0 && $DEL_BIN_ON_FAIL == "true" ]]; then - # Remove the physical bin and edit binlist - # set next_bin to be local - # use return val from finding the next bin + # rsync failed and user doesn't want the bin kept + sed -n "/^$new_bin:[0-9]*/d" + rm -rf ${BINS_DIR}/$new_bin fi check_for_resquash -- cgit v1.2.3