Cdrwtester

From FreekiWiki

Jump to: navigation, search

cdrwtester

This is the main source of information on a script I have writen for fgdiag.

you can check it out of cvs or find it on the web at:

http://cvs.freegeek.org/cgi-bin/viewcvs.cgi/fgdiag/bin/cdrwtester

cdrwtester is just a shell script that I have been working on... for a while.

The following is really the only part that does anything useful.

IMAGE=null

if [ ! -n "$1" ]; then

   echo "Usage: test.sh filename"
   exit

fi

if [ -e "$1" ]; then

   IMAGE=$1
   export IMAGE

else

   echo "$1 is not a file!"
   exit

fi

echo $IMAGE is the image that I will burn press ^c to stop \( Ctrl+c \)

DEVICE=null

for REPLY in $(cdrecord -scanbus 2>/dev/null \ | egrep ' *[0-9]+,[0-9]+,[0-9]+' | grep -v "*" \ | awk '{print $1}'); do

   if cdrecord -checkdrive dev=$REPLY 2>/dev/null \                                                                             | egrep -q 'Device seems to be:.*CD-RW'; then
       DEVICE=$REPLY
       export DEVICE
   fi

done echo " I will now burn the ISO please press enter" read echo echo cdrecord dev=$DEVICE $IMAGE