#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/sbin/mkcd/mkrr_fs_youngminds.sh 1.12 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1999,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 
# @(#)91        1.12  src/bos/usr/sbin/mkcd/mkrr_fs_youngminds.sh, cmdbsys, bos720 11/1/06 12:43:53
############################################################
##
## File:  mkrr_fs_youngminds
##
## This is sample shell code for creating ISO9660 CD 
## images, with Rock Ridge extensions, using the 
## Young Minds, Inc. software application, makedisc.
##
## If using this script with mkcd, this file must be linked 
## to /usr/sbin/mkrr_fs.  For example:
##    ln -s /usr/samples/oem_cdwriters/mkrr_fs_youngminds /usr/sbin/mkrr_fs
##
## Parameters:  output_file file_system
##                use_dvd_flag (any non-zero parameter)
##                output_file (i.e. /mkcd/cd_images/cd_image_67890)
##                file_system (i.e. /mkcd/cd_fs/67890)
##
## Return Codes:  0 for successful
##                1 for unsuccessful
##
############################################################

export PATH="/usr/bin:/usr/sbin:/etc:$PATH"
MSGBUF=/tmp/.mkrr_fs.tmp.msg
ON=1
OFF=0
DVD_FLAG=$OFF

if (( $# == 3 )); then
   DVD_FLAG=$1
   OUTPUT_FILE=$2
   FS_NODE=$3
elif (( $# == 2 )); then
   OUTPUT_FILE=$1
   FS_NODE=$2
else
   echo "mkrr_fs: Syntax error."
   echo "Usage: mkrr_fs [-d] output_file fs_node"
   echo "       -d flag for writing DVD images"
   return 1
fi

if [[ $DVD_FLAG != $OFF ]]; then
   MEDIA_SIZE=4095
else
   MEDIA_SIZE=650
fi

echo "Running makedisc ..."
/usr/local/makedisc/makedisc -p -t -g -l -q -R -b16 -r -s -w -d -v \
   /tmp/makedisc $FS_NODE $OUTPUT_FILE $MEDIA_SIZE 2>$MSGBUF
if (( $? != 0 )); then
   cat $MSGBUF 
   echo "Error mkrr_fs: command error."
   rm -f $MSGBUF
   return 1
else
   echo "mkrr_fs was successful."
   rm -f $MSGBUF
   return 0
fi