2 # bup-import-rsnapshot.sh
4 # Does an import of a rsnapshot archive.
7 echo "Usage: bup import-rsnapshot [-n]" \
8 "<path to snapshot_root> [<backuptarget>]"
9 echo "-n,--dry-rung: don't do anything just print out what would be done"
13 if [ "$1" = "-n" -o "$1" = "--dry-run" ]; then
19 elif [ -n "$BUP_MAIN_EXE" ]; then
31 [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || usage
33 if [ ! -e "$1/." ]; then
34 echo "$1 isn't a directory!"
39 [ "$#" -eq 2 ] && TARGET="$2"
42 ABSPATH=`readlink -f "$1"`
44 for SNAPSHOT in "$ABSPATH/"*; do
45 if [ -e "$SNAPSHOT/." ]; then
46 for BRANCH_PATH in "$SNAPSHOT/"*; do
47 if [ -e "$BRANCH_PATH/." ]; then
48 # Get the snapshot's ctime
49 DATE=`stat -c %Z "$BRANCH_PATH"`
50 BRANCH=`basename "$BRANCH_PATH"`
53 if [ "$TARGET" = "" ] || [ "$TARGET" = "$BRANCH" ]; then
64 if [ -e "$TMPIDX" ]; then