From 0c0653410f04f89a9d42ebcf50632cc903cf4ee2 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 20 Jan 2010 18:59:56 -0500 Subject: Check for value in array, rather than blindly removing the backup when rsync returns non-zero --- squashfu | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'squashfu') diff --git a/squashfu b/squashfu index cedd6ae..e4d1f82 100755 --- a/squashfu +++ b/squashfu @@ -255,11 +255,15 @@ action_backup () { debug "rsync ${RSYNC_OPTS[@]} ${INCLUDES[@]} ${EXCLUDES[@]} "$UNION_MOUNT"" info "Creating new incremental" /usr/bin/rsync ${RSYNC_OPTS[@]} ${INCLUDES[@]} ${EXCLUDES[@]} "$UNION_MOUNT" + rsync_ret=$? - if [[ $? -gt 0 && $DEL_BIN_ON_FAIL == "true" ]]; then - warn "Unexpected hangup by rsync. Deleting backup." - action_remove_bin $new_bin override - fi + # TODO: convert to check for error code in array + for $error in ${DEL_BIN_ON_FAIL[@]}; do + if [[ $rsync_ret == $error ]]; then + warn "Unexpected hangup by rsync ($error). Deleting backup." + action_remove_bin $new_bin override + fi + done check_for_resquash if [[ val=$? -gt 0 ]]; then -- cgit v1.2.3