X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=scripts%2Frestore-script.sh;fp=scripts%2Frestore-script.sh;h=1bf8dccfd4e8326670ef9ef189598d24c6cecc33;hb=11b38584ce4c12e7a83c1cb206fa87141f74de5c;hp=5ae9fe792ea69a2732958bdb842d94ba241e5cee;hpb=5c8c182b0f51eaa5fca5f917ed5cda5f12fb7366;p=backups%2F.git diff --git a/scripts/restore-script.sh b/scripts/restore-script.sh index 5ae9fe7..1bf8dcc 100755 --- a/scripts/restore-script.sh +++ b/scripts/restore-script.sh @@ -1,9 +1,5 @@ #!/bin/sh -echo "Ran restore script with $@" - -exit 0 - export PATH=$rundir:/bin:/usr/bin if [ $# != 1 ]; then @@ -12,17 +8,27 @@ if [ $# != 1 ]; then exit 1 fi -# Get the device with the CD in it here device=$(mount | grep "on $mountdir " | awk '{print$1}') -cp $mountdir/backups.db $mountdir +cp $mountdir/backups.db $mountdir/backup-status.txt $rundir +dbfile=$rundir/backups.db for date in $(cat $dbfile | list-dates.sh); do - eject $device - echo >&2 "Please insert backup disk: $date" - echo >&2 "Then press any key" - read bogus - # Mount the media - # rsync-cmd.sh won't work here in its current encarnation - cat $dbfile | files-from-date.sh | rsync-cmd.sh $1 + success=false + while ! $success; do + eject $device + echo >&2 "Please insert backup disk: $date" + read bogus + + # Mount the media + mount -t ext2 $device $mountdir + if [ "" != "$(grep -l $date $mountdir/backup-status.txt)" ]; then + success=true + else + echo >&2 "This doesn't seem to be the right disk." + fi + done + + rsyncopts="-l -p -t -g -o -0 --files-from=- --stats --progress " + cat $dbfile | files-from-date.sh | rsync $rsyncopts $1 $2 done