#!/bin/bash -x
# burndvd.sh
# Figure out a Volume Lable - either parameter or use the curent dir
if [ -z $1 ]; then
VOLLABEL=`basename $PWD`
else
VOLLABEL=$1
fi
# Setup the mkIsoFS options - same get used to get size and then again
MKISOOPTS="-J -R -V $VOLLABEL ./"
# if this is a 'video DVD' add the switch
if [ -d video_ts ]; then mv video_ts VIDEO_TS; fi
if [ -d VIDEO_TS ]; then MKISOOPTS="-dvd-video $MKISOOPTS"; fi
# Make a md5 of all the files, in all the dirs.
if [ ! -f index.md5 ]; then
find ./ -type f -not -name index.md5 -exec md5sum {} \;|tee index.md5
fi
# Figure out the size, and abort if mkisofs fails
if ! SIZE=`mkisofs -print-size $MKISOOPTS`s; then
echo mkisofs error!
eject /mnt/dvd
exit
fi
mkisofs -v $MKISOOPTS\
| cdrecord -v \
tsize=$SIZE \
-sao \
dev=/dev/hdb \
-eject \
driveropts=burnfree \
-ignsize -
# check the md5s of the burn - save the results in the source dir.
mount /mnt/dvd
SRCDIR=$PWD
cd /mnt/dvd
if md5sum --check index.md5; then echo md5sum is A-OK;else echo md5sum is hosed; fi 2>&1 |tee $SRCDIR/check.md5
cd $SRCDIR
eject -v /mnt/dvd
I need to define the burner drive and mountpoint at the top.
cdrecord will look to a config file for burner device and options, that would make this more portable.