# use the following command to burn the image produced by this script:
BURNCMD="cdrdao write --eject --overburn --speed 2 --device <device> --driver generic-mmc-raw <.toc file>"
# drive used to read the disc
DRIVE="ASUS BW-16D1HT"
# optical drive to image disc from
DEV=/dev/sr0
if [ -n "$1" ]; then
if [ -n "$2" ]; then
mkdir -p $1
cd $1
CMD="cdrdao read-cd --read-raw --read-subchan rw_raw --datafile $2.bin --device $DEV --driver generic-mmc-raw $2.toc"
echo "Dumping cdrom using command: $CMD"
$CMD
echo "--------------------------------------------------------"
ISOCMD="readcd dev=$DEV -edc-corr speed=8 f=$2.iso"
echo "Dumping cdrom iso using command: $ISOCMD"
$ISOCMD
printf "Read with: $CMD \nUsing a $DRIVE drive\nBurn with: $BURNCMD \nISO Read with: $ISOCMD \n" >> about.txt
else
mkdir -p $1
cd $1
CMD="cdrdao read-cd --read-raw --read-subchan rw_raw --datafile $1.bin --device $DEV --driver generic-mmc-raw $1.toc"
echo "Dumping cdrom using command: $CMD"
$CMD
echo "--------------------------------------------------------"
ISOCMD="readcd dev=$DEV -edc-corr speed=8 f=$1.iso"
echo "Dumping cdrom iso using command: $ISOCMD"
$ISOCMD
printf "Read with: $CMD \nUsing a $DRIVE drive\nBurn with: $BURNCMD \nISO Read with: $ISOCMD \n" >> about.txt
fi
else
echo "Usage: dump_cdrom.sh <game name> [disc name]"
fi