DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th May 2008
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,051
Thanked 118 Times in 93 Posts
Default HOWTO: BURNCD like DVD and CD CLI burning

I like to use burncd for burning CDs and I wanted to burn DVDs the same way so I wrote this simple script. The script will tell You the same but here are the options:
Code:
usage: burndvd.sh OPTION [ /path/to/data | image_to_burn ]
 avialable OPTIONS:
  burndvd.sh --blank
    blanks DVD-RW
  burndvd.sh --blank+rw
    blanks DVD+RW (useful only for privacy reasons)
  burndvd.sh --burn /paths /to /multiple /files
    burn files to DVD/DVD+/-RW
  burndvd.sh --add /paths /to /multiple /files
    append files to already burned DVD+/-RW
  burndvd.sh --iso image.iso
    burn ISO image
  burndvd.sh --cue image.cue
    burn CUE/BIN image
to set DEVICE use that command:
Code:
% dmesg | grep ^cd | uniq
cd0: <HL-DT-ST DVDRAM GSA-H42N RL00> Removable CD-ROM SCSI-0 device
to set CDRDAO_DEVICE use that command:
Code:
# cdrdao scanbus
Cdrdao version 1.2.1 - (C) Andreas Mueller <andreas@daneb.de>
  SCSI interface library - (C) Joerg Schilling
  Paranoia DAE library - (C) Monty

Check http://cdrdao.sourceforge.net/drives.html#dt for current driver tables.

Using libscg version 'schily-0.8'

1,0,0 : HL-DT-ST, DVDRAM GSA-H42N , RL00
Code:
#! /bin/sh

# simple script for dvd burning
# ----------------------------
# vermaden [AT] interia [DOT] pl
# http://toya.net.pl/~vermaden/links.htm

# mandatory for growisofs(1) to work with sudo(8)
unset SUDO_COMMAND
export MKISOFS=/usr/local/bin/mkisofs

# modules and device
MODULES="cd pass atapicam"
DEVICE=/dev/cd0
CDRDAO_DEVICE="1,0,0"

# mandatory binaries
CDRDAO=/usr/local/bin/cdrdao
FORMAT=/usr/local/bin/dvd+rw-format
GROWISOFS=/usr/local/bin/growisofs

load_modules () # load modules if needed
{
  for module in ${MODULES} ;do
    if ! kldstat -v | grep -q ${module}; then
      if kldload ${module}; then
        echo "OK: ${module} module loaded."
      else
        echo "ER: ${module} module failed to load."
        exit 1
      fi
    fi
  done
}

case $1 in

  --blank)
    if [ -x ${FORMAT} ]; then
      load_modules
      ${FORMAT} -blank ${DEVICE}
    else
      echo "ER: growisofs(1) not avialable."
      echo "install sysutils/dvd+rw-tools port."
      exit 1
    fi
    ;;

  --blank+rw | --burn | --add | --iso)
    if [ -x ${GROWISOFS} ]; then
      load_modules
      case $1 in
        --blank+rw)
          exec ${GROWISOFS} -Z ${DEVICE}=/dev/zero
          ;;
        --burn)
          shift
          exec ${GROWISOFS} -dvd-compat -Z ${DEVICE} -J -R ${*}
          ;;
        --add)
          shift
          exec ${GROWISOFS} -dvd-compat -M ${DEVICE} -J -R ${@}
          ;;
        --iso)
          exec ${GROWISOFS} -use-the-force-luke=dao -dvd-compat -Z ${DEVICE}=${2}
          ;;
      esac
    else
      echo "ER: dvd+rw-format not avialable."
      echo "install sysutils/dvd+rw-tools port."
      exit 1
    fi
    ;;

  --cue)
    if [ -x ${CDRDAO} ]; then
      load_modules
      ${CDRDAO} write --device ${CDRDAO_DEVICE} --driver generic-mmc ${2}
    else
      echo "ER: cdrdao(1) not avialable."
      echo "install sysutils/cdrdao port."
      exit 1
    fi
    ;;

  *)
    echo "usage: `basename ${0}` OPTION [ /path/to/data | image_to_burn ]"
    echo " avialable OPTIONS:"
    echo "  `basename ${0}` --blank"
    echo "    blanks DVD-RW"
    echo "  `basename ${0}` --blank+rw"
    echo "    blanks DVD+RW (useful only for privacy reasons)"
    echo "  `basename ${0}` --burn /paths /to /multiple /files"
    echo "    burn files to DVD/DVD+/-RW"
    echo "  `basename ${0}` --add /paths /to /multiple /files"
    echo "    append files to already burned DVD+/-RW"
    echo "  `basename ${0}` --iso image.iso"
    echo "    burn ISO image"
    echo "  `basename ${0}` --cue image.cue"
    echo "    burn CUE/BIN image"
    ;;
esac
I propably forgot about something so fell free to point that out.

HF

Also little script for burning CDs with burncd

Code:
usage: burncd.sh OPTION [ /path/to/data | image_to_burn ]
 avialable OPTIONS:
  burncd.sh --blank
    blank CD-RW
  burncd.sh --burn /paths /to /multiple /files
    burn files to CD-R[W]
  burncd.sh --iso image.iso
    burn ISO image
Code:
#! /bin/sh

# simple script for cd burning
# ----------------------------
# vermaden [AT] interia [DOT] pl
# http://toya.net.pl/~vermaden/links.htm

MKISOFS=/usr/local/bin/mkisofs
MAX_SIZE=716800 # CD size in KB

case $1 in

  --blank)
    burncd blank
    ;;

  --burn)
    if [ -x ${MKISOFS} ]; then
      shift
      if [ $( du -kc ${*} | grep total | awk '{ print $1 }' ) -gt ${MAX_SIZE} ]; then
        echo "ER: data is larger then 700mb"
        exit 1
      fi
      ${MKISOFS} -J -R ${*} | burncd data - fixate
    else
      echo "ER: mkisofs(8) not avialable."
      echo "install sysutils/cdrtools port."
      exit 1
    fi
    ;;

  --iso)
    burncd data ${2} fixate
    ;;

  *)
    echo "usage: `basename ${0}` OPTION [ /path/to/data | image_to_burn ]"
    echo " avialable OPTIONS:"
    echo "  `basename ${0}` --blank"
    echo "    blank CD-RW"
    echo "  `basename ${0}` --burn /paths /to /multiple /files"
    echo "    burn files to CD-R[W]"
    echo "  `basename ${0}` --iso image.iso"
    echo "    burn ISO image"
    ;;
esac
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote
Reply

Tags
burncd

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FreeBSD howto: burning and ripping cd's graudeejs Guides 9 31st December 2008 06:39 AM
CD/DVD burner becomes unresponsive after burncd dewarrn1 FreeBSD General 2 23rd October 2008 01:45 AM
CD Burning Software ninjatux FreeBSD Ports and Packages 7 17th July 2008 08:37 AM
Trouble burning to dvdrw part 2 whispersGhost Solaris 32 3rd June 2008 12:51 PM
trouble burning to dvdrw whispersGhost Solaris 2 21st May 2008 02:05 PM


All times are GMT. The time now is 03:40 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick