Added restore script
[backups/.git] / scripts / restore-script.sh
1 #!/bin/sh
2
3 if [ $# != 1 ]; then
4   echo >&2 "Usage: $0 <target-directory>"
5   echo >&2 "Example: $0 /"
6   exit 1
7 fi
8
9 tmpdir=/tmp/restore-$(date +%Y%m%d%H%M%S)
10
11 export PATH=$tmpdir:/bin:/usr/bin
12
13 # Get the device with the CD in it here
14 device=/dev/hdc
15
16 for date in $(cat $dbfile | list-dates.sh); do
17   eject $device
18   echo >&2 "Please insert backup disk:  $date"
19   echo >&2 "Then press any key"
20   read bogus
21   # Mount the media
22   # rsync-cmd.sh won't work here in its current encarnation
23   cat $dbfile | files-from-date.sh | rsync-cmd.sh $1
24 done