find-cmd.sh \
list-dates.sh \
restore-script.sh \
- rsync-cmd.sh
+ rsync-cmd.sh \
+ restore.sh
EXTRA_DIST = $(bin_SCRIPTS)
+
+restore_scripts = \
+ files-from-date.sh \
+ list-dates.sh \
+ restore-script.sh
+
+restore_tar = restore.tgz
+
+restore.sh : restore-header.sh $(restore_tar)
+ { cat $<; cat $(restore_tar); } > $@
+ chmod +x $@
+
+$(restore_tar) : $(restore_scripts)
+ tar cf - $^ | gzip > $@
--- /dev/null
+#!/bin/sh
+export rundir=/tmp/restore-$(date +%Y%m%d%H%M%S)
+if ! mkdir $rundir; then
+ echo 2> "Cannot create temp dir"
+ exit 1
+fi
+echo $rundir
+
+unset CDPATH
+export mountdir=$(cd $(dirname $0) && pwd)
+echo $mountdir
+
+SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`
+
+# take the archive portion of this file and pipe it to tar
+tail +$SKIP $0 | tar xzf - -C $rundir
+
+exec $rundir/restore-script.sh ${1+"$@"}
+
+__ARCHIVE_FOLLOWS__
#!/bin/sh
+echo "Ran restore script with $@"
+
+exit 0
+
+export PATH=$rundir:/bin:/usr/bin
+
if [ $# != 1 ]; then
- echo >&2 "Usage: $0 <target-directory>"
- echo >&2 "Example: $0 /"
+ echo >&2 "Usage: $0 <source-directory> <target-directory>"
+ echo >&2 "Example: $0 / /"
exit 1
fi
-tmpdir=/tmp/restore-$(date +%Y%m%d%H%M%S)
-
-export PATH=$tmpdir:/bin:/usr/bin
-
# Get the device with the CD in it here
-device=/dev/hdc
+device=$(mount | grep "on $mountdir " | awk '{print$1}')
+
+cp $mountdir/backups.db $mountdir
for date in $(cat $dbfile | list-dates.sh); do
eject $device
[ -d $1 ] || exit 1
# -H ? -W ?
-rsync_opts='-W -H -l -p -t -g -o -0 --files-from=-'
+rsync_opts='-l -p -t -g -o -0 --files-from=-'
other_opts='--stats --progress'