Reorganize the drive script
authorCarl N Baldwin <cnb@hpsvcnb.fc.hp.com>
Tue, 25 Oct 2005 16:32:59 +0000 (10:32 -0600)
committerCarl N Baldwin <cnb@hpsvcnb.fc.hp.com>
Tue, 25 Oct 2005 16:32:59 +0000 (10:32 -0600)
scripts/drive.sh

index 63ac79c5c7c572c2c7ac1d1a134feb8b6338fb44..6ea91a6bae84a8f21f89a4ec6221cd7ba57a27a5 100755 (executable)
@@ -3,27 +3,15 @@
 scriptsdir=$(dirname $0)
 bindir="$scriptsdir/../build"
 
-datadir="/var/lib/backups"
-tmpdir="/dev/shm/backups"
-
-mkdir -p $tmpdir
-chmod 700 $tmpdir
-
 export PATH=$scriptsdir:$bindir:$PATH
 
-files="$tmpdir/files.db"
-touch $files
-chmod 600 $files
-echo "Running find to get the status of files"
-find-cmd.sh /home > $files
-
-db="$datadir/backups.db"
+# file locations and other values
+datadir="/var/lib/backups"
+tmpdir="/dev/shm/backups"
+currentfiles="$tmpdir/files.db"
+backupdb="$datadir/backups.db"
 backups="$tmpdir/backup-list.db"
 statusfile="$tmpdir/backup-status.txt"
-
-echo "Determining list of files to backup with lsbackups"
-cat $files | lsbackups > $backups 2>$statusfile
-
 isomountdir="/backup/iso-mount"
 isoimage="/backup/iso-mount.iso"
 
@@ -39,11 +27,22 @@ echo "Mounting the iso image"
 # Mount iso image here
 mount -t ext2 -o loop $isoimage $isomountdir
 
+mkdir -p $tmpdir
+chmod 700 $tmpdir
+
+touch $currentfiles
+chmod 600 $currentfiles
+echo "Running find to get the status of files"
+find-cmd.sh /home > $currentfiles
+
+echo "Determining list of files to backup with lsbackups"
+cat $currentfiles | lsbackups > $backups 2>$statusfile
+
 echo "Running rsync to pack the image"
 cat $backups | rsync-cmd.sh $isomountdir
 
 echo "Copying over database and status file"
-cp $statusfile $db $isomountdir
+cp $statusfile $backupdb $isomountdir
 
 # umount $isomountdir