Add more directories
[backups/.git] / scripts / drive.sh
index 0b0268933ac5c18d1e0c80c350870558bdd55cd0..2b758b183045dfbd7aa10dd04ce4664b44126976 100755 (executable)
@@ -1,20 +1,20 @@
 #!/bin/bash
 
 scriptsdir=$(dirname $0)
-bindir="$scriptsdir/../build"
 
-export PATH=$scriptsdir:$bindir:$PATH
+export PATH=$scriptsdir:$PATH
 
 # file locations and other values
 today=$(date +%Y%m%d%H%M%S)
 datadir="/var/lib/backups"
+backupdirs="/home /etc /var/backups /var/lib/debfoster /var/lib/mailman /var/lib/iptables /var/lib/dpkg"
 tmpdir="/dev/shm/backups"
 currentfiles="$tmpdir/files.db"
 backupdb="$datadir/backups.db"
 backups="$tmpdir/backup-list.db"
 statusfile="$tmpdir/backup-status.txt"
 isomountdir="/backup/iso-mount"
-isoimage="/backup/iso-mount.iso"
+isoimage="/backup/ISOs/$today.iso"
 restorescript="$scriptsdir/restore.sh"
 
 echo "Creating the iso image in $isoimage"
@@ -22,7 +22,7 @@ touch $isoimage
 # chmod 600 $isoimage
 
 # Create filesystem on iso image here
-dd if=/dev/null of=$isoimage bs=2048k count=0 seek=2220
+dd if=/dev/null of=$isoimage bs=1M count=0 seek=4440
 mke2fs -b 2048 -F $isoimage
 
 echo "Mounting the iso image"
@@ -38,7 +38,7 @@ echo "Running find to get the status of files"
 {
   for type in d f l; do
     findformat="$type %#m %u %g %s %CY%Cm%Cd%CH%CM%CS 0 %p\0"
-    find /home -type $type -printf "$findformat"
+    find $backupdirs -type $type -printf "$findformat"
   done
 } > $currentfiles
 
@@ -56,8 +56,14 @@ cat $backups | rsync $rsyncopts / $isomountdir
 echo "Copying over database and status file"
 cp $statusfile $backupdb $restorescript $isomountdir
 
+mount -o remount -o ro $isomountdir
+# Should be
 # umount $isomountdir
 
+md5sum $isoimage > $isoimage.md5sum
+
 # Burn the iso image
 # dvdrecord [-dummy] [-overburn] -dao speed=8 dev=[ATAPI:]?,?,? iso-image.iso
+
+# Email me
 cat $statusfile | mailx -s "DVD Image available on ball, burn it!" carl@ecbaldwin.net