#!/bin/bash

Proc="test.iso"
IPhat="cd_root"
CDDEV="/dev/scd0"

echo "make $Proc to $IPhat"

if [ X$a != X"a" ]; then echo -n "mkisofs "$Proc" [a,y,n,q] :"; read a; fi
if [ X$a = X"q" ]; then exit 0; fi
if test X$a = X"y" -o X$a = X"j" -o test X$a = X"a"; then
  genisoimage -R $IPhat > $Proc
#  genisoimage -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table $IPhat > $Proc 
  if [ $? != 0 ]; then echo "** ERROR ** ERROR **"; exit 1; fi
fi

echo "make CD $IPhat"
if [ X$a != X"a" ]; then echo -n "cdrecord "$Proc" [y,n,q] :"; read a; fi
if [ X$a = X"q" ]; then exit 0; fi
if test X$a = X"y" -o X$a = X"j" -o test X$a = X"a"; then
  wodim dev=$CDDEV speed=8 blank=fast -pad -v -eject $Proc
fi
