3 # Support script for restoring individual directories and files
6 CONFIG=/etc/duplicity-daily.conf
7 eval $(grep ^TARGET= $CONFIG)
8 eval $(grep ^OPTIONS= $CONFIG)
11 SRCS=( $(grep ^/ $CONFIG) )
12 if [ -z "$SRCS" ] ; then
14 ** There are no backup sources.
15 ** Check /etc/duplicity-daily.conf
19 echo "= Select backup set ==="
20 select SRC in ${SRCS[@]} ; do [ -n "$SRC" ] && break ; done
23 if [ "$BASE" = "$SRC" ] ; then
31 ## Check for existing backups
32 TIMES=( $(ssh $REMOTE ls $STORE |grep sigtar |awk -F. '{ print $(NF-2); }') )
33 if [ -z "$TIMES" ] ; then
35 ** No backups found for $SRC
39 echo "= Select backup timestamp ==="
40 select TIME in ${TIMES[@]} ; do [ -n "$TIME" ] && break ; done
47 duplicity list-current-files $OPTIONS --time $TIME pexpect+scp://$URI |\
48 sed '1d;2d;3d;s/.\{25\}//' > $LIST
57 Restore at = $RESTORE/$TIME$BASE/$1
61 read -p "Go ahead [Yn]?" X
62 [ "$X" = n ] && return 0
63 duplicity restore $OPTIONS --file-to-restore "$1" --time "$TIME" \
64 "pexpect+scp://$URI" "$RESTORE/$TIME$BASE/$1"
71 X="$(grep -oE "^$1[^/]*/?" < $LIST | uniq | iselect -fa)"
73 if [ -z "${X##*/}" ] ; then