Sunday, June 19, 2011

quickiedisc.sh - An Oldie but a Goodie for Linux Burning

Copy->paste->save this into a file named quickiedisc.sh. 

#!/bin/bash
usage() {
   printf "*Usage: quickiedisc.sh [--copy --data --iso --rip] <\"file\">\n"
   printf " --copy: Copy CD or DVD utilizing one drive :)\n"
   printf " --data: Burn a specified file or folder to CD or DVD\n"
   printf " --iso : Burn an ISO file to CD or DVD\n"
   printf " --rip : Rip a CD or DVD\n"
   exit
}

if [[ $# != 2 ]]; then
   usage
fi

case $1 in
   "--copy" ) dd if=/dev/scd0 of=/tmp/quickie_tmp.iso;
              eject /dev/scd0;
              printf "Please insert blank disk.  Press any key to continue..."; read anykey;
              cdrecord -v speed=16 dev=ATA:1,0,0 /tmp/quickie_tmp.iso;
              rm /tmp/quickie_tmp.iso;;
   "--data" ) mkisofs -r -o "${2}.iso" "${2}";
              cdrecord -v speed=16 dev=ATA:1,0,0 "${2}.iso";
              #cdrecord -v speed=16 dev=ATAPI:0,0,0 "${2}.iso";
              rm ${2}.iso;;
   "--iso"  ) cdrecord -v speed=16 dev=/dev/scd0 "${2}";;
   "--rip"  ) dd if=/dev/scd0 of="${2}.iso";;
         *  ) printf "Invalid Flag.\n"; usage;;
esac
eject /dev/scd0
# End of script

Also, be sure you set permissions as executable:


$ chmod 755 quickiecd.sh

Enjoy, cheers!

If you enjoyed this post, send us = kudos = 
(Bitcoin Addr: 19n6q3GZfoM64oqv5HsDnhzqvcEvJUvmdx)


No comments:

Post a Comment