projects
/
backups
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
630a0aa
)
Silly cosmetic changes I probably don't need to make
author
Carl N Baldwin
<cnb@plane.localdomain>
Wed, 30 Nov 2005 02:46:56 +0000
(19:46 -0700)
committer
Carl N Baldwin
<cnb@plane.localdomain>
Wed, 30 Nov 2005 02:46:56 +0000
(19:46 -0700)
scripts/restore-script.sh
patch
|
blob
|
history
diff --git
a/scripts/restore-script.sh
b/scripts/restore-script.sh
index daff5e571c414660f82e3e6d4da1c0e9de91cabd..ed42a96bd700f00108b1ba99a6b3026b1afd83a0 100755
(executable)
--- a/
scripts/restore-script.sh
+++ b/
scripts/restore-script.sh
@@
-10,7
+10,7
@@
function err() {
[ -z "$mountdir" ] && err '$mountdir must be set'
[ -z "$rundir" ] && err '$rundir must be set'
[ -z "$mountdir" ] && err '$mountdir must be set'
[ -z "$rundir" ] && err '$rundir must be set'
-export PATH=${rundir%
%
/}:/bin:/usr/bin:/sbin:/usr/sbin:/sw/bin
+export PATH=${rundir%/}:/bin:/usr/bin:/sbin:/usr/sbin:/sw/bin
if [ ! -z "$1" -o ! -d "$2" ]; then
err "
if [ ! -z "$1" -o ! -d "$2" ]; then
err "
@@
-27,19
+27,19
@@
Usage: $0 <source-dir> <relocate-dir> [<mnt-dir>]
"
fi
"
fi
-device=$(mount | grep "on ${mountdir%
%
/} " | awk '{print$1}')
+device=$(mount | grep "on ${mountdir%/} " | awk '{print$1}')
[ -z "$device" ] && err "Cannot determine cdrom device"
[ -z "$device" ] && err "Cannot determine cdrom device"
-cp ${mountdir%
%/}/backups.db ${mountdir%
%/}/backup-status.txt $rundir
-dbfile=${rundir%
%
/}/backups.db
+cp ${mountdir%
/}/backups.db ${mountdir
%/}/backup-status.txt $rundir
+dbfile=${rundir%/}/backups.db
dates=$(cat $dbfile | list-dates.sh)
for date in $dates; do
filelist=$(tempfile)
# Check to see if files are actually needed from the current disk before requesting it.
dates=$(cat $dbfile | list-dates.sh)
for date in $dates; do
filelist=$(tempfile)
# Check to see if files are actually needed from the current disk before requesting it.
- cat $dbfile | files-from-date.sh $date | grep -z -Z -e "^${1%
%
/}/" > $filelist
+ cat $dbfile | files-from-date.sh $date | grep -z -Z -e "^${1%/}/" > $filelist
if [ -s $filelist ]; then
success=false
while ! $success; do
if [ -s $filelist ]; then
success=false
while ! $success; do
@@
-51,9
+51,9
@@
for date in $dates; do
eject -t $device
# Mount the media
eject -t $device
# Mount the media
- mount -t ext2 $device ${mountdir%
%
/}
+ mount -t ext2 $device ${mountdir%/}
- if grep -q $date ${mountdir%
%
/}/backup-status.txt; then
+ if grep -q $date ${mountdir%/}/backup-status.txt; then
success=true
else
echo "This doesn't seem to be the right disk."
success=true
else
echo "This doesn't seem to be the right disk."
@@
-61,7
+61,7
@@
for date in $dates; do
done
rsyncopts="-W -H -S -l -p -t -g -o -0 --files-from=- --stats --progress"
done
rsyncopts="-W -H -S -l -p -t -g -o -0 --files-from=- --stats --progress"
- cat $filelist | rsync $rsyncopts ${mountdir%
%/}/ ${2%
%/}/
+ cat $filelist | rsync $rsyncopts ${mountdir%
/}/ ${2
%/}/
else
echo "No files are needed from disk: $date. Skipping it."
fi
else
echo "No files are needed from disk: $date. Skipping it."
fi