From 47295fca28b2ea453af3b216c65bb1a288b54d35 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 11 Jun 2010 22:42:34 -0400 Subject: fix bug with rolling back when number of bins to rollback equals the number of bins available. leaves an unresolved issue of dating the rollback when you roll all the way back to the seed --- squashfu | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/squashfu b/squashfu index f7e518b..73a9476 100755 --- a/squashfu +++ b/squashfu @@ -273,9 +273,12 @@ action_rollback () { mountpoint -q "$UNION_MOUNT" && unmount_union mountpoint -q "$SQUASH_MOUNT" || mount_squash - mount_union_with_bins ${bin_list[@]:(-$num_to_mount)} - - local rb_timestamp=$(grep "^${bin_list[@]:(-$num_to_mount):1}:" "$BINVENTORY" | cut -d: -f2) + if [[ ${#bin_list[@]} -eq $1 ]]; then + local rb_timestamp=0 # XXX: What the hell is the timestamp of the seed... ? + else + mount_union_with_bins ${bin_list[@]:(-$num_to_mount)} + local rb_timestamp=$(grep "^${bin_list[@]:(-$num_to_mount):1}:" "$BINVENTORY" | cut -d: -f2) + fi info "You have rolled back to $(date --rfc-3339=seconds --date="@$rb_timestamp")" info "Your files can be found at '${UNION_MOUNT}'" @@ -430,13 +433,16 @@ OPTIONS the default config. If you specify alternate locations via a supplmenetal config, you will need to provide the config for all actions + -v + Show debugging output. + HELP exit 1 } [[ $# -eq 0 ]] && usage -while getopts :BG:CD:QR:Uc: opt; do +while getopts :BG:CD:QR:Uc:v opt; do case $opt in B) [[ -n $action ]] && die "only one operation may be used at a time" @@ -461,6 +467,8 @@ while getopts :BG:CD:QR:Uc: opt; do action=unmount ;; c) [[ -f $OPTARG ]] && source $OPTARG ;; + v) + DEBUG=true ;; \:) die "Argument missing from -$OPTARG" usage ;; -- cgit v1.2.3