#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/sbin/mkcd/burn_cd_gnu_dvdram.sh 1.1.1.2 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2000,2006 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)61 1.1.1.2 src/bos/usr/sbin/mkcd/burn_cd_gnu_dvdram.sh, cmdbsys, bos720 11/1/06 12:47:49 ############################################################ ## ## File: burn_cd_gnu_dvdram ## ## This is sample shell code for writing to a recordable ## DVD-RAM device using the GNU software application, readcd. ## ## If using this script with mkcd, this file must be linked ## to /usr/sbin/burn_cd. For example: ## ln -s /usr/samples/oem_cdwriters/burn_cd_gnu_dvdram /usr/sbin/burn_cd ## ## Parameters: cd_device cd_image ## use_dvd_flag (any non-zero parameter) ## cd_device (i.e. /dev/cd0) ## cd_image (i.e. /mkcd/cd_images/cd_image_67890) ## ## Return Codes: 0 for successful ## 1 for unsuccessful ## ############################################################ export PATH="/usr/bin:/usr/sbin:/etc:$PATH" MSGBUF=/tmp/.burn_cd.tmp.msg ON=1 OFF=0 DVD_FLAG=$OFF if [ $# -eq 3 ]; then DVD_FLAG=$1 CD_DEVICE=$2 CD_IMAGE=$3 elif [ $# -eq 2 ]; then CD_DEVICE=$1 CD_IMAGE=$2 else echo "Usage: burn_cd [-d] cd_device cd_image" echo " -d for writing DVD images" return 1 fi ############################################################ ## The readcd routine requires the device in format 1,0 ## where 1 is the CD device number associated with the name, ## and 0 is the logical unit number (i.e. /dev/cd1 = 1,0). ############################################################ CD_DEVICE="`basename $CD_DEVICE |sed 's/cd//'`,0" ############################################################ ## If writing to a rewritable CD on a CD-RW device, the ## "blank" parameter can be added to the cdrecord call, for ## erasing the CD before writing. ## For example: blank=fast ############################################################ if [ $DVD_FLAG = $OFF ];then ## create CD image echo "Running cdrecord ..." /usr/local/bin/cdrecord dev=$CD_DEVICE speed=1 $CD_IMAGE 2>$MSGBUF else ## create DVD image echo "Running readcd ..." /usr/local/bin/readcd -w dev=$CD_DEVICE f=$CD_IMAGE 2>$MSGBUF fi if [ $? -ne 0 ]; then cat $MSGBUF echo "burn_cd: Command error." rm -f $MSGBUF return 1 else echo "burn_cd was successful." rm -f $MSGBUF return 0 fi