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" ] || [ "$1" == "--dry-run" ]; then
14 bup () { echo "bup $@"; }
18 [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || usage
20 if [ ! -e "$1/." ]; then
21 echo "$1 isn't a directory!"
26 [ "$#" -eq 2 ] && TARGET="$2"
29 ABSPATH=`readlink -f "$1"`
31 for SNAPSHOT in "$ABSPATH/"*; do
32 if [ -e "$SNAPSHOT/." ]; then
33 for BRANCH_PATH in "$SNAPSHOT/"*; do
34 if [ -e "$BRANCH_PATH/." ]; then
35 # Get the snapshot's ctime
36 DATE=`stat -c %Z "$BRANCH_PATH"`
37 BRANCH=`basename "$BRANCH_PATH"`
40 if [ "$TARGET" == "" ] || [ "$TARGET" == "$BRANCH" ]; then
51 if [ -e "$TMPIDX" ]; then