]> arthur.barton.de Git - bup.git/commitdiff
Make import-duplicity's output more verbose
authorZoran Zaric <zz@zoranzaric.de>
Mon, 24 Sep 2012 23:13:32 +0000 (01:13 +0200)
committerRob Browning <rlb@defaultvalue.org>
Mon, 9 Mar 2015 01:55:14 +0000 (20:55 -0500)
Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
cmd/import-duplicity-cmd.sh

index 6d4b0ef6ed8bbd51b44ac6823f712d41ecdd522b..3427e96f8dc31e54e0e9489ac131f98aa330b48b 100755 (executable)
@@ -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