From: Carl N Baldwin <cnb@hpsvcnb.fc.hp.com>
Date: Tue, 25 Oct 2005 16:32:59 +0000 (-0600)
Subject: Reorganize the drive script
X-Git-Tag: release-0.4~69
X-Git-Url: http://git.pippins.net/%7Bdelete%7D?a=commitdiff_plain;h=109d5e46a35ba3c1790fe5bbcd37b920f48b09cd;p=backups%2F.git

Reorganize the drive script
---

diff --git a/scripts/drive.sh b/scripts/drive.sh
index 63ac79c..6ea91a6 100755
--- a/scripts/drive.sh
+++ b/scripts/drive.sh
@@ -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