#!/bin/sh # Write a set of files to CD, automatically updating cdcatalog. # Adam Sampson umask 002 nocat=0 burnopts="" isoexts="-R -J" cddev=/dev/cdrw iso=/120g4/tmp/tmp.iso giveniso="" prefix=${BURN_PREFIX:-AT} while getopts "nori:I:p:" c ; do case $c in n) nocat=1 ;; o) burnopts="-dao -overburn" ;; r) isoexts="-R" ;; i) iso="$OPTARG" ;; I) giveniso="$OPTARG" ;; p) prefix="$OPTARG" ;; \?) echo "Usage: burn [-nor] [-i F] [-I f] [-p P] file ..." echo "-n Do not add to catalogue" echo "-p P Use the given catalogue prefix" echo "-o Overburn" echo "-r Do not use Joliet extensions" echo "-i F Use the given temporary filename for the ISO image" echo "-I F Burn the given existing ISO image" exit 1 ;; esac done shift `expr $OPTIND - 1` die () { rm -f $iso exit 1 } rm -f $iso # ext3 doesn't appear to return the disk space until the journal is synced... sync useiso="$giveniso" if [ "$giveniso" = "" ] ; then genisoimage -f $isoexts -o "$iso" "$@" || die useiso="$iso" fi wodim -v dev=$cddev $burnopts driveropts=burnfree "$useiso" || die sleep 2 ; sync eject /media/cdrw || die echo "Verifying..." verify-iso "$useiso" $cddev || die echo "Contents: " "$@" if [ $nocat = 0 ] ; then cdcatalog -p $prefix -a /media/cdrw || die fi eject /media/cdrw || die rm -f $iso