From: Carl N. Baldwin <cnb@cone.ecbaldwin.net>
Date: Wed, 30 Nov 2005 02:27:41 +0000 (-0700)
Subject: Don't check for the existence of sourcedir in the restore script.  It may not
X-Git-Tag: release-0.4~9
X-Git-Url: http://git.pippins.net/%7Blink_hometeaching%7D?a=commitdiff_plain;h=91a649790f76170c3d1a84bd4e18af005c7843c1;p=backups%2F.git

Don't check for the existence of sourcedir in the restore script.  It may not
be there.  Also, be strict about sourcedir being an actual directory.
---

diff --git a/scripts/restore-script.sh b/scripts/restore-script.sh
index 9d9baab..0796bef 100755
--- a/scripts/restore-script.sh
+++ b/scripts/restore-script.sh
@@ -12,7 +12,7 @@ function err() {
 
 export PATH=${rundir%%/}:/bin:/usr/bin:/sbin:/usr/sbin:/sw/bin
 
-if [ ! -d "$mountdir$1" -o ! -d "$2" ]; then
+if [ ! -z "$1" -o ! -d "$2" ]; then
   err "
 Usage: $0 <source-dir> <relocate-dir> [<mnt-dir>]
        source-dir   - directory on backup disks to restore from (relative to $mountdir)
@@ -57,5 +57,5 @@ for date in $dates; do
   done
 
   rsyncopts="-W -H -S -l -p -t -g -o -0 --files-from=- --stats --progress"
-  cat $dbfile | files-from-date.sh $date | grep -z -Z -e "^${1}" | rsync $rsyncopts ${mountdir%%/}/ ${2%%/}/
+  cat $dbfile | files-from-date.sh $date | grep -z -Z -e "^${1%/}/" | rsync $rsyncopts ${mountdir%%/}/ ${2%%/}/
 done