From 0e30e52b2c0f7aeeb212790361730adfa8dbd90b Mon Sep 17 00:00:00 2001 From: Zoran Zaric Date: Tue, 25 Sep 2012 01:13:32 +0200 Subject: [PATCH 1/1] Make import-duplicity's output more verbose Signed-off-by: Zoran Zaric --- cmd/import-duplicity-cmd.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/import-duplicity-cmd.sh b/cmd/import-duplicity-cmd.sh index 6d4b0ef..3427e96 100755 --- a/cmd/import-duplicity-cmd.sh +++ b/cmd/import-duplicity-cmd.sh @@ -25,22 +25,35 @@ branch=$2 [ -n "$duplicity_target_url" -a "$#" = 2 ] || usage -duplicity collection-status --log-fd=3 \ - "$duplicity_target_url" 3>&1 1>/dev/null 2>/dev/null | -grep "[[:digit:]][[:digit:]]T" | -cut -d" " -f 3 | +dup_timestamps=$(duplicity collection-status --log-fd=3 \ + "$duplicity_target_url" 3>&1 1>/dev/null 2>/dev/null | + grep "[[:digit:]][[:digit:]]T" | + cut -d" " -f 3) +backups_count=$(echo "$dup_timestamp" | wc -l) +counter=1 +echo "$dup_timestamps" | while read dup_timestamp; do timestamp=$(python -c "import time,calendar; " \ "print str(int(calendar.timegm(time.strptime('$dup_timestamp', " \ "'%Y%m%dT%H%M%SZ'))))") + echo "Importing backup from $(date --date=@$timestamp +%c) " \ + "($counter / $backups_count)" 1>&2 + echo 1>&2 + tmpdir=$(mktemp -d) + echo "Restoring from rdiff-backup..." 1>&2 duplicity restore -t "$dup_timestamp" "$duplicity_target_url" "$tmpdir" + echo 1>&2 + echo "Importing into bup..." 1>&2 tmpidx=$(mktemp -u) bup index -ux -f "$tmpidx" "$tmpdir" bup save --strip --date="$timestamp" -f "$tmpidx" -n "$branch" "$tmpdir" rm -f "$tmpidx" rm -rf "$tmpdir" + counter=$((counter+1)) + echo 1>&2 + echo 1>&2 done -- 2.39.2