burning script
authorCarl Baldwin <cnb@ball.(none)>
Fri, 28 Oct 2005 04:02:51 +0000 (22:02 -0600)
committerCarl Baldwin <cnb@ball.(none)>
Fri, 28 Oct 2005 04:02:51 +0000 (22:02 -0600)
scripts/burn-imgs.sh [new file with mode: 0755]

diff --git a/scripts/burn-imgs.sh b/scripts/burn-imgs.sh
new file mode 100755 (executable)
index 0000000..1f38f7c
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+mailto=carl@ecbaldwin.net
+dev="/dev/hdc"
+sdev="ATA:1,0,0"
+imagedir="/backup/imgs"
+
+img=$(ls $imagedir | head -n 1)
+echo $img
+
+if [ -n "$img" ]; then
+  if cdrecord-wrapper.sh -dao speed=8 dev=$sdev $isoimage; then
+    md5sum=$(tempfile)
+    dd if=$dev bs=1M count=4440 | md5sum | awk '{print$1}' > $md5sum
+    if ! cmp $md5sum $isoimage.md5sum; then
+      echo "Failed" | mailx -s "DVD md5sum doesn't match image file!!!" $mailto
+      exit 1
+    else
+      echo $md5sum >> $img.stat
+    fi
+  else
+    echo "Failed" | mailx -s "DVD burning failed!!!" $mailto
+    exit 1
+  fi
+
+  if [ "$(wc -l $img.stat 2>/dev/null)" == "2" ]; then
+    echo "Burned the image twice.  Removing it!"
+    rm -f $img{,.md5sum,.stat}
+    rmdir $img.mnt
+  fi
+fi