cdrecord and scripts
Brian Densmore
DensmoreB at ctbsonline.com
Wed Jan 17 19:38:18 CST 2001
Well, it's not too long. About 60 lines. Let me know what you think. Don't
be too critical, it's my first real shell script. I do some basic error
checking, but haven't put in a check yet to verify a speed selection. I
tried using a case statement here but had problems parsing the arg list.
#!/bin/sh
usage="Usage: $0 -f <tree> -d <device> [-s <speed>]"
spd=1
while [ $1 ]
do
if [ "$1" = "-f" ]
then
shift
src="$1"
elif [ "$1" = "-d" ]
then
shift
dev="$1"
elif [ "$1" = "-s" ]
then
shift
spd="$1"
else
# echo $1
shift
fi
done
if [ "$src" = "" ]
then
echo "$usage"
exit 1
elif [ "$dev" = "" ]
then
echo "$usage"
exit 2
fi
if [ -d $src ]
then
echo "$src is a directory"
else
echo "$src is not a directory tree"
echo "$usage"
exit 3
fi
# is it a valid device?
cdrecord -checkdrive dev=$dev
if [ $? = 0 ]
then
# use RockRidge for portability and include a trans.tbl for converting
proper file names back in
mkisofs -R -T -o cdimage.raw $src
echo "Testing ISO image"
mount cdimage.raw -r -t ISO9660 -o loop /mnt
ls -lR /mnt
# did we make an image?
if [ $? = 0 ]
then
echo "ISO image good, proceeding"
umount /mnt
echo "recording at speed $spd"
cdrecord -v dev=$dev speed=$spd cdimage.raw
fi
# should clean up cdimage.raw here
else
# scan the bus and display to user so they can enter proper codes
cdrecord -scanbus
echo "$dev is not a valid device"
echo "$usage"
exit 4
fi
> -----Original Message-----
> From: Monty J. Harder [mailto:dmonster at juno.com]
> Sent: Wednesday, January 17, 2001 1:21 PM
> To: Brian Densmore
> Subject: Re: cdrecord and scripts
>
>
>
> On Wed, 17 Jan 2001 10:55:14 -0600 Brian Densmore
> <DensmoreB at ctbsonline.com> writes:
> > Since we have been having several discussions on CD recording. I
> > thought
> > I'd explore a little and came up with a simple script (as a
> > precursor to a
> > python interface I want to make). What is the LUG's policy on
> > posting
> > scripts or attaching them to e-mails?
>
>
> We argued a bit about that a while back. First question is how long
> they are. Just throw it in the message body if it's not too long.
> Attaching things tends to bring out the Attachment Nazis.
> ________________________________________________________________
> GET INTERNET ACCESS FROM JUNO!
> Juno offers FREE or PREMIUM Internet access for less!
> Join Juno today! For your FREE software, visit:
> http://dl.www.juno.com/get/tagj.
>
More information about the Kclug
mailing list