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"
# 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