-
-echo "Creating the iso image in $isoimage"
-dd if=/dev/null of=$isoimage bs=1M count=0 seek=4440
-mke2fs -b 2048 -F $isoimage
-
-echo "Mounting the iso image"
+if [ $? != 0 ]; then
+ test -d $isomountdir && rm -rf $isomountdir
+ err "Unable to create the following directories:
+ $datadir $imagedir $isomountdir $tmpdir"
+fi
+
+echo "-> Creating the iso image in $isoimage"
+dd of=$isoimage bs=1M count=0 seek=$imagesizemb
+
+[ $? != 0 ] && err "dd failed to create $isoimage"
+
+mke2fs -b $blocksize -F $isoimage
+if [ $? != 0 ]; then
+ rm -rf $isomountdir $isoimage
+ err "Unable to create the iso image: $isoimage"
+fi
+
+e2label $isoimage $today
+if [ $? != 0 ]; then
+ rm -rf $isomountdir $isoimage
+ err "Unable to label the iso image: $isoimage"
+fi
+
+echo "-> Mounting the iso image"