More more more
[backups/.git] / scripts / burn-imgs.sh
index 27f7ad201b06b7d0e9b689c43fd905886d22ca13..0e1a6bfa139368d2b92dd3c7ca88efbba4517d29 100755 (executable)
@@ -4,14 +4,15 @@ PATH=$(dirname $0):/bin:/usr/bin
 
 . config.sh
 
+# If the noburn file is there then don't burn.
+[ -f "$noburnfile" ] && exit 0
+touch $noburnfile
+
 # Discover disk images by looking for .img.md5sum files in $imagedir
 imgmd5=$(ls $imagedir/*.img.md5sum | head -n 1)
 
 logfile=$(tempfile)
 
-# If the noburn file is there then don't burn.
-[ -f "$burnlockfile" ] && exit 0
-
 # If we didn't find an non-empty file then exit gracefully
 [ -z "$imgmd5" ] && exit 0
 [ -s "$imgmd5" ] || exit 0
@@ -26,7 +27,7 @@ img=${imgmd5%.md5sum}
 # Burn the image to a disk.
 cdrecord-wrapper.sh -dao dev=$sdev $isoimage > $logfile 2>&1
 
-if [ 0 != "$?" ]; then
+if [ "0" != "$?" ]; then
   echo >&2 "cdrecord failed!"
   exit 1
 fi
@@ -44,8 +45,6 @@ fi
 # Record the date in the stat file to indicate that this burn was a success
 date >> $img.stat
 
-touch $burnlockfile
-
 { # Send e-mail
   echo "Image md5sum:"
   cat $img.md5sum
@@ -54,7 +53,7 @@ touch $burnlockfile
   cat $img.stat
   echo
   cat $logfile
-} | mailx -s "DVD burned.  File it as ${img%.*}" $mailto > $logfile 2>&1
+} | mailx -s "DVD burned.  File as ${img%.*}" $mailto > $logfile 2>&1
 
 # Two lines in the stat file indicate two successful burns.  Clean-up the image.
 if [ "$(wc -l $img.stat 2>/dev/null)" == "2" ]; then