[Bootcd-user] FW: cloop & bootcd

SCHUMACHER,BERND (HP-Germany,ex1) bernd.schumacher@hp.com
Mon, 29 Sep 2003 14:26:19 +0200


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C38684.E2ADEC80
Content-Type: text/plain;
	charset="iso-8859-1"

Hello Blake,

thank you for your mail. 
I am in the office for the first day now after vacation. It will take some
time until I can try your changes. But I will forward your mail to the
bootcd-user list now to make sure it will be tried.

Regards
Bernd


-----Original Message-----
From: klhaung@palm208.nchc.org.tw [mailto:klhaung@palm208.nchc.org.tw]
Sent: Donnerstag, 25. September 2003 02:49
To: bernd.schumacher@hp.com
Subject: cloop & bootcd


hello,

	My name is Blake.
	I am working on a project, named DRBL (http://drbl.nchc.org.tw,
http://drbl.sf.net), 
	and use your bootcd to create the installation CD.
	Thank you for your bootcd that help us to create CD quickly and
easily.

	I had added one new funcationality that use Knopper's cloop to
	compress the image.
	Attached are the files I modified.
	I hope it is useful.

	Best Regards,
	Blake


------_=_NextPart_000_01C38684.E2ADEC80
Content-Type: text/plain;
	name="bootcdwrite"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bootcdwrite"

#!/bin/sh
#
# bootcdwrite=20
#

isoneword()
{
  [ $(echo "$*" | wc -w) -eq 1 ] && return 0
  return 1
}
#for i in "a b" "a" "a
#b"; do
#if isoneword "$i"; then echo "<$i> ok"; else echo "<$i> nok"; fi
#done
#exit 1

cleanup()
{
  echo "--- Cleanup ---" | tee -a $ERRLOG

  # Be sure that VAR and SRCDISK have no spaces=20
  # to not accidently remove anything (for example VAR=3D"/ /var")
  if ! isoneword "$VAR"; then
    echo "Error in VAR <$VAR>" >&2
    exit 1
  fi

  if ! isoneword "$SRCDISK"; then
    echo "Error in SRCDISK <$SRCDISK>" >&2
    exit 1
  fi

  rm -f "$VAR/cdimage"
  rm -rf "$VAR/input_dir"
  rm -rf "$VAR/compressed_dir"
  rm -rf "$VAR/cloop"
  rm -rf "$VAR/cloop/isolinux"

  umount "$VAR/mnt" 2>/dev/null
  [ -d $VAR/mnt ] && rmdir "$VAR/mnt"

  # do not use "rm -r $VAR"
  rm -f "$ERRLOG.tmp"
  rm -rf "$CHANGES" "$VAR/ram1" "$VAR/ram2"
  # Blake, 2003/09/09
  # $VAR/cloop always exists, so rmdir $VAR is not working ..
  #[ -d $VAR -a ! -f $VAR/cdimage.iso ] && rmdir "$VAR"
}

oneline()
{
  if [ "$*" ]; then
    echo "$*"
  else
    cat
  fi | awk '{printf("%s ",$1)} END {printf("\n")}' | sed "s/ *$//"
}

# df_file - How much free space has the filesystem on which file $1 =
resides ?
df_file()
{
  df -k | awk '{printf("%s %s\n",$4,$6)}' |
  while read size filesys
  do
    if [ "`echo $1 | grep ^$filesys`" ]; then
      namelen=3D`echo $filesys | wc -c`=20
      echo "$namelen $filesys $size"
    fi
  done |
  sort -n | tail -1 | awk '{print $3}'
}

# p - simplify path=20
p()
{
  ERR=3D0
  for i in $*; do
    if [ -d $i ]; then
      ( cd $i; /bin/pwd )
    elif [ -f $i ]; then
      ( cd $(dirname $i); echo "$(/bin/pwd)/$(basename $i)" )
    else
      echo "$i does not exist." >> $ERRLOG
      ERR=3D1
      continue
    fi
  done | oneline
  return $ERR
}
# example:=20
#echo "p ////home/../etc/passwd //usr//lib// -> /etc/passwd /usr/lib =
=3D"
#echo "$(p ////home/../etc/passwd //usr/lib//)"
#exit 0

# ex_proc - exclude SRCDI/proc
ex_proc()
{
  for i in $*; do
    if [ "$(p $i)" =3D "$SRCDISK" ]; then
      find $SRCDISK -maxdepth 1 |=20
        grep -v -e "^$SRCDISK$" -e "^$SRCDI/proc$"
    else
      p $i
    fi
  done | oneline
}
#SRCDISK=3D"/"; SRCDI=3D""
#echo "SRCDISK=3D/; ex_proc / -> /home /etc /bin ... (without /proc)"
#ex_proc /
#echo "SRCDISK=3D/; ex_proc /tmp /etc -> /tmp /etc"
#ex_proc /tmp /etc
#exit 0

# du_dir - How much space do given dirs need togehter
du_dir()
{
  LIST1=3D"$(for i in $(p $*); do echo $i; done | sort)"
  LAST=3D""; LIST2=3D""
  for i in $LIST1; do
    if [ "$LAST" ]; then
      if [ "$LAST" =3D "/" ]; then=20
        [ "$(echo "$i" | grep "^/")" ] && i=3D""
      else
        [ "$(echo "$i" | grep "^$LAST\>")" ] && i=3D""
      fi
    fi
    if [ "$i" ]; then
      LIST2=3D"$LIST2 $i"
      LAST=3D"$i"
    fi
  done
  LIST3=3D$(ex_proc "$LIST2")
  echo "du -klsc $LIST3" >> $ERRLOG
  du -klsc $LIST3 | tee -a $ERRLOG | tail -1 | awk '{print $1}'
}
#ERRLOG=3D/var/log/errlog
#echo "du_dir /etc; du_dir /tmp; du_dir /etc /tmp -> A + B =3D C"
#du_dir /etc; du_dir /tmp; du_dir /etc /tmp
#exit 0
#echo "du_dir /etc; du_dir /etc /etc/network -> A =3D B"
#du_dir /etc; du_dir /etc /etc/network
#exit 0

trapfunc()
{
  echo "trap" >> $ERRLOG
  trap "" EXIT SIGINT # Ignore Traps
  cleanup
  exit 1
}


mk_grep()
{
  if [ "$*" ]; then
    echo "$*" |=20
    sed 's/\(^\| \)*\([^ ]*\)/-e ^\2 /g' | 	# Insert all "-e"
    sed "s/[[:space:]]*$//" |			# Delete trailing spaces
    sed "s/^/grep -v /"				# Insert "grep -v"
  else
    echo "cat"
  fi
}
#echo "mk_grep /usr/lib /usr/share -> grep -v -e ^/usr/lib\> -e =
^/usr/share\>"
#echo "<$(mk_grep /usr/lib /usr/share)>"
#echo "mk_grep "" -> cat"
#echo "<$(mk_grep "")>"
#exit 0
#
#t=3D$(mk_grep /x)
#echo "t=3D<$t>"
#echo "a/x/b: $(echo "a/x/b" | $t)"
#echo "/xb: $(echo "/xb" | $t)"
#echo "/x/b: $(echo "/xb" | $t)"
#exit 0

# chnglist [-add_ro] [-no_mnt] <MNT> <LIST>
#   -add_ro =3D add ".ro" to directory following <MNT>
#   -no_mnt =3D path without <MNT>
#   -rel    =3D start without /
chnglist()
{
  ADD_RO=3D""
  NO_MNT=3D""
  REL=3D""
  OPT=3D"1"
  while [ "$OPT" ]; do
    if [ "$1" =3D "-no_mnt" ]; then
      NO_MNT=3D"1"
      shift
    elif [ "$1" =3D "-add_ro" ]; then
      ADD_RO=3D"1"
      shift
    elif [ "$1" =3D "-rel" ]; then
      REL=3D"1"
      shift
    else
      OPT=3D""
    fi
  done
  [ $# -ne 2 ] && err "Internal Error calling Function chnglist"
   =20
  S=3D"$1"; [ "$S" =3D "/" ] && S=3D""
  echo " $2" |
  if [ "$ADD_RO" ]; then
    if [ "$NO_MNT" ]; then
      sed "s|[[:space:]]$S/\([^/]*\)\>| \1.ro|g" | sed =
"s/[[:space:]]*//"
    else
      sed "s|[[:space:]]$S\(/[^/]*\)\>| $S\1.ro|g" | sed =
"s/[[:space:]]*//"
    fi
  else
    if [ "$NO_MNT" ]; then
      sed "s|[[:space:]]$S/\([^/]*\)\>| \1|g"
    else
      cat
    fi
  fi | =20
  sed 's|[^[:graph:]]/\+\([[:graph:]]\+\)| \1|g' | # without leading /
  if [ "$REL" ]; then
    cat=20
  else
    sed 's|\([[:graph:]]\+\)|/\1|g'
  fi |
  sed "s/[[:space:]]*//" # remove leading space
}
#echo 'chnglist -add_ro "/" "/etc/a /etc/b /root" -> /etc.ro/a =
/etc/.ro/b /root.ro'
#echo "  <$(chnglist -add_ro "/" "/etc/a /etc/b /root")>"
#echo 'chnglist -add_ro "/mnt" "/mnt/etc/a /mnt/root" -> /mnt/etc.ro/a =
/mnt/root.ro'
#echo "  <$(chnglist -add_ro "/mnt" "/mnt/etc/a /mnt/root")>"
#echo 'chnglist -add_ro -no_mnt "/" "/home/a /root" -> /home.ro/a =
/root.ro'
#echo "  <$(chnglist -add_ro -no_mnt "/" "/home/a /root")>"
#echo 'chnglist -add_ro -no_mnt "/mnt" "/mnt/home/b /mnt/root" -> =
/home.ro/b /root.ro'
#echo "  <$(chnglist -add_ro -no_mnt "/mnt" "/mnt/home/b /mnt/root")>"
#echo 'chnglist -no_mnt "/" "/etc/a ///etc/b /root" -> /etc/a /etc/b =
/root'
#echo "  <$(chnglist -no_mnt "/" "/etc/a ///etc/b /root")>"
#echo 'chnglist -no_mnt "/mnt" "/mnt/etc/a /mnt/root" -> /etc/a /root'
#echo "  <$(chnglist -no_mnt "/mnt" "/mnt/etc/a /mnt/root")>"
#echo 'chnglist -rel -no_mnt "/" "/etc/a /etc/b /root" -> etc/a etc/b =
root'
#echo "  <$(chnglist -rel -no_mnt "/" "/etc/a /etc/b /root")>"
#echo 'chnglist -no_mnt -rel "/mnt" "/mnt/etc/a /mnt/root" -> etc/a =
root'
#echo "  <$(chnglist -no_mnt -rel "/mnt" "/mnt/etc/a /mnt/root")>"
#exit 0

# mk_bootcdram <SRCDISK> <NOT_TO_RAM>
mk_bootcdram()
{
  CHNG=3D$(chnglist -add_ro -no_mnt "$1" "$2")
  CHNGGREP=3D$(mk_grep $CHNG)
  cat /usr/share/bootcd/S12bootcdram.sh |=20
    sed "s|<CHNG>|$CHNG|" |
    sed "s|<CHNGGREP>|$CHNGGREP|"=20
}
#echo 'mk_bootcdram "/mnt" "/mnt/root /mnt/home/a" -> skript with:'
#echo '...| grep -v -e ^/root.ro -e ^/home.ro/a |...'
#mk_bootcdram "/mnt" "/mnt/root /mnt/home/a"
#exit 0

#echo 'mk_bootcdram "/" "/root /home/a" -> skript with:'
#echo '...| grep -v -e ^/root.ro -e ^/home.ro/a |...'
#mk_bootcdram "/" "/root /home/a"
#exit 0

#echo 'mk_bootcdram "/" "" -> skript with: "...| cat |..." and without =
"ln -s"'
#mk_bootcdram "/" ""
#exit 0

do_syslinux()
{
  if [ "$SYSLINUX_SAVE" =3D "yes" ]; then
    SYSLINUX_SAVE=3D"-s"
  elif [ "$SYSLINUX_SAVE" =3D "no" ]; then
    SYSLINUX_SAVE=3D""
  else
    SYSLINUX_SAVE=3D""
    warn 'SYSLINUX_SAVE is not defined as "yes" or "no".' \
         'It will be treated as "no".'
  fi
 =20
  # Build cdboot.img=20
  # do not use /usr/lib/syslinux/img1440k.gz, to be able to use other
  # syslinux options

  # using 1743k
  ignore "^1440+0 records"
  run dd bs=3D1024 count=3D1440 if=3D/dev/zero =
of=3D/$CHANGES/cdboot.img

  ignore "^mkfs.vfat" # mkfs.vfat 2.8 (28 Feb 2001)
  run mkfs -t vfat /$CHANGES/cdboot.img

  run syslinux $SYSLINUX_SAVE /$CHANGES/cdboot.img

  run mount -o loop /$CHANGES/cdboot.img $VAR/mnt -t msdos
  run cp $KERNEL $VAR/mnt/vmlinuz.img

run "cat <<END >$VAR/mnt/syslinux.cfg
default linux
timeout 50
prompt 1
label linux
  kernel vmlinuz.img
  append root=3D$CDDEV1 ramdisk_size=3D$RAMDISK_SIZE $APPEND
END"

  for i in $CDDEVR; do
    echo "label $(basename $i)"
    echo "  kernel vmlinuz.img"
    echo "  append root=3D$i ramdisk_size=3D$RAMDISK_SIZE $APPEND"
  done >>$VAR/mnt/syslinux.cfg

  if [ "$DISPLAY" ]; then=20

run "cat <<END >>$VAR/mnt/syslinux.cfg
display display.txt
END"

    run cp $DISPLAY $VAR/mnt/display.txt
  fi

  run umount $VAR/mnt
  losetup -d /dev/loop0 2>/dev/null
}

do_isolinux()
{
  run mkdir /$CHANGES/isolinux
  run cp /usr/lib/syslinux/isolinux.bin /$CHANGES/isolinux
  run cp $KERNEL /$CHANGES/isolinux/vmlinuz
  LILOINITRD=3D""
  if [ "$INITRD" ]; then=20
    run cp $INITRD /$CHANGES/isolinux/initrd
    LILOINITRD=3D"initrd=3D/isolinux/initrd"
  fi

run "cat <<END >/$CHANGES/isolinux/isolinux.cfg
default linux
timeout 50
prompt 1
label linux
  kernel /isolinux/vmlinuz
  append $LILOINITRD root=3D$CDDEV1 ramdisk_size=3D$RAMDISK_SIZE =
$APPEND
END"

  for i in $CDDEVR; do
    echo "label $(basename $i)"
    echo "  kernel /isolinux/vmlinuz"
    echo "  append $LILOINITRD root=3D$i ramdisk_size=3D$RAMDISK_SIZE =
$APPEND"
  done >>$CHANGES/isolinux/isolinux.cfg

  if [ "$DISPLAY" ]; then=20

run "cat <<END >>/$CHANGES/isolinux/isolinux.cfg
display display.txt
END"

    run cp $DISPLAY /$CHANGES/isolinux/display.txt
  fi

  # add by Blake, Kuo-Lien Huang
  # copy LOGO to $CHANGES/isolinux
  if [ "LOGO" ]; then
    for logo in `echo $LOGO`
	do
	  name=3D${logo%%.*}
	  sub=3D${logo#$name.}
	  case "$sub" in
	    "png")
		  pngtopnm $logo | ppmtolss16 > /$CHANGES/isolinux/$name.lss
		  ;;
		"pnm")
		  ppmtolss16 < $logo > /$CHANGES/isolinux/$name.lss
		  ;;
		*)
	      run cp $logo /$CHANGES/isolinux/
		  ;;
	  esac
	done
  fi
}

blank_cd()
{
  echo "--- Blanking CD ---" | tee -a $ERRLOG
  ignore "Drive needs to reload the media to return to proper status"
  ignore "Copyright (C)"
  ignore "^scsidev:"
  ignore "^scsibus:"
  ignore "^Using libscg version"
  ignore "^Device type"
  ignore "^Version"
  ignore "^Response Format"
  ignore "^Capabilities"
  stdout "^Vendor_info"
  stdout "^Identifikation"
  stdout "^Revision"
  ignore "^Device seems to be:"
  ignore "^Using"
  ignore "^Driver flags"
  stdout "^Starting to write CD/DVD"
  ignore "^Last chance to quit"
  ignore "^Blocks total: .* Blocks current: .* Blocks remaining: .*"
  ignore "^Linux sg driver version:"
  stdout "^Blanking"
  ignore "^Supported modes:"
  if [ "$BLANKING" =3D "auto" ]; then
    stdout "Cannot blank disk"
    ignore ".*"
  fi
  run cdrecord blank=3Dfast speed=3D$CDSPEED dev=3D$CDSCSI
}

write_cd()
{
  echo "--- Writing CD ---" | tee -a $ERRLOG
  ignore "Copyright (C)"
  ignore "^Vendor_info"
  ignore "^Identifikation"
  ignore "^Revision"
  ignore "^FIFO size"
  ignore "^Linux sg driver version:"
  ignore "^Lout start:"
  ignore "^Waiting for reader process to fill input buffer"
  stdout "^Starting new track at sector"
  stdout ".* of .* MB written"
  stdout "^Writing..time:"
  stdout "^Fixating"
  ignore "fifo had .* puts and .* gets"
  ignore "fifo was 0 times empty and .* times full"
  ignore "^Device seems to be:"
  ignore "^Using"
  ignore "^Driver flags"
  ignore "^Drive buf size :"
  ignore "^Total size:"
  ignore "^Current Secsize:"
  ignore "^ATIP info from disk:"
  ignore "^..Indicated writing power:"
  ignore "^..Reference speed:"
  ignore "^..Is not unrestricted"
  ignore "^..Is erasable"
  ignore "^..Is not erasable"
  ignore "^..Disk sub type:"
  ignore "^..ATIP start of lead in:"
  ignore "^..ATIP start of lead out:"
  ignore "^..speed low: .* speed high:"
  ignore "^..power mult factor:"
  ignore "^..recommended erase/write power:"
  ignore "^..A2 values:"
  ignore "^Disk type:"
  ignore "^Manuf. index:"
  ignore "^Manufacturer:"
  ignore "Blocks total:.*Blocks current:.*Blocks remaining:"
  ignore "^Starting to write CD/DVD at speed"
  ignore "^Last chance to quit, starting real write in"
  ignore "^TOC Type:"
  ignore "^scsidev:"
  ignore "^scsibus:"
  ignore "^atapi:"
  ignore "^Device type"
  ignore "^Version"
  ignore "^Response Format"
  ignore "^Capabilities"
  ignore "^Track .*: data .* MB"
  ignore "^Track .*: Total bytes read/written:"
  ignore "^Performing OPC..."
  ignore "^Supported modes:"
  ignore "^..1T speed low:"
  ignore "^..2T speed low:"
  ignore "^..A1 values:"
  stdout "^Average write speed"
  stdout "^Min drive buffer fill was"
  run cdrecord -v -eject speed=3D$CDSPEED dev=3D$CDSCSI $VAR/cdimage
}

compress_dir()
{
  if [ "$EXCLUDE" -o "$MKISO_NOT" ]; then
    ZFTREEEX=3D"$(echo $EXCLUDE $MKISO_NOT | sed "s/-x/-e/g")"
  fi
  echo "--- Building input_dir for compression ---" | tee -a $ERRLOG
  run "cd $SRCDISK; rm -rf $VAR/input_dir; mkdir $VAR/input_dir;=20
    find $(ex_proc $SRCDISK) |
    grep -v -e $VAR -e $ERRLOG -e $SRCDI/tmp $ZFTREEEX |
    sed \"s|^$SRCDI/||\" |
    cpio --quiet -pdum $VAR/input_dir/"

  run mv $VAR/input_dir/home $VAR/input_dir/home.ro
  run mv $VAR/input_dir/root $VAR/input_dir/root.ro
  run mv $VAR/input_dir/var $VAR/input_dir/var.ro
  run mv $VAR/input_dir/etc $VAR/input_dir/etc.ro
  run mv $VAR/input_dir/dev $VAR/input_dir/dev.ro
  run "cd $CHANGES; find . | cpio --quiet -pdum $VAR/input_dir/"
  [ "$DEVFS" =3D "yes" ] && run rm -r $VAR/input_dir/dev.ro

  echo "--- Compressing input_dir to compressed_dir ---" | tee -a =
$ERRLOG
  run "rm -rf $VAR/compressed_dir; mkzftree $VAR/input_dir =
$VAR/compressed_dir"
  run rm -r $VAR/input_dir
}

mkisofs_ignore()
{
  stdout "Warning: using transparent compression"
  stdout "The resulting filesystem can only be transparently"
  stdout "On other operating systems you need to call"
  stdout "mkzftree by hand to decompress the files"
  ignore "^Using .* for"
  ignore "^Total "
  ignore "estimate finish"
  ignore "^Path table size"
  ignore "^Max brk space used"
  ignore "^$"
  stdout "^Size of boot image is"
  stdout "extents written"
  stdout "Unable to open directory .*/dev/pts"
}

uncompress_files()
{
  for i in $*; do
    F=3D"-F"
    [ -d $VAR/compressed_dir/$i ] && F=3D""
    run mkzftree -u $F $VAR/compressed_dir/$i $VAR/uncompress.tmp
    run rm -rf $VAR/compressed_dir/$i
    run mv $VAR/uncompress.tmp $VAR/compressed_dir/$i
  done
}

cdimage_compressed_isolinux()
{
  compress_dir
  uncompress_files isolinux
  mkisofs_ignore
  run mkisofs -z -R -b isolinux/isolinux.bin -c isolinux/boot.cat \
    -o $VAR/cdimage \ -no-emul-boot -boot-load-size 4 -boot-info-table =
\
    $VAR/compressed_dir
  run rm -r $VAR/compressed_dir
}

cdimage_compressed_normal()
{
  compress_dir
  uncompress_files cdboot.img
  mkisofs_ignore
  run mkisofs -z -R -b cdboot.img -c cdboot.catalog -o $VAR/cdimage \
    $VAR/compressed_dir
  run rm -r $VAR/compressed_dir
}

cdimage_compressed_hppa()
{
  compress_dir
  uncompress_files /usr/share/palo/iplboot $KERNEL
  mkisofs_ignore
  run mkisofs -z -R -o $VAR/cdimage $VAR/compressed_dir
  run rm -r $VAR/compressed_dir

  ignore "^palo version "
  ignore "^ELF32 executable"
  ignore "^ELF64 executable"
  ignore "^ipl: addr "
  ignore "^ ko 0x"
  ignore "^<0/boot/vmlinux root=3D$CDDEV1 ramdisk_size=3D$RAMDISK_SIZE =
$APPEND>"
  ignore "^<>$"
  run palo -k $KERNEL \
    -f /dev/null \
    -b $SRCDI/usr/share/palo/iplboot \
    -c \"0/boot/vmlinux root=3D$CDDEV1 ramdisk_size=3D$RAMDISK_SIZE =
$APPEND\" \
    -C $VAR/cdimage
}

# modified by Blake, Kuo-Lien Huang for cloop support
#cdimage_isolinux()
#{
#  mkisofs_ignore
#  run mkisofs $GRAFTPOINTS $MKISO_NOT \
#    -R -b isolinux/isolinux.bin -c isolinux/boot.cat -o $VAR/cdimage \
#    -no-emul-boot -boot-load-size 4 -boot-info-table \
#    -x $SRCDI/proc -x $VAR -x $ERRLOG \
#    -x $SRCDI/etc -x $SRCDI/var -x $SRCDI/tmp \
#    -x $SRCDI/dev -x $SRCDI/home -x $SRCDI/root $EXCLUDE \
#    /=3D$SRCDI/ /=3D$CHANGES \
#    /home.ro/=3D$SRCDI/home /root.ro/=3D$SRCDI/root =
/var.ro/=3D$SRCDI/var \
#    /etc.ro/=3D$SRCDI/etc $MKISODEVFS
#}

cdimage_isolinux()
{
  mkisofs_ignore
  if [ "$USE_CLOOP" =3D "no" ]; then
    run mkisofs $GRAFTPOINTS $MKISO_NOT \
      -R -b isolinux/isolinux.bin -c isolinux/boot.cat -o $VAR/cdimage =
\
      -no-emul-boot -boot-load-size 4 -boot-info-table \
      -x $SRCDI/proc -x $VAR -x $ERRLOG \
      -x $SRCDI/etc -x $SRCDI/var -x $SRCDI/tmp \
      -x $SRCDI/dev -x $SRCDI/home -x $SRCDI/root $EXCLUDE \
      /=3D$SRCDI/ /=3D$CHANGES \
      /home.ro/=3D$SRCDI/home /root.ro/=3D$SRCDI/root =
/var.ro/=3D$SRCDI/var \
      /etc.ro/=3D$SRCDI/etc $MKISODEVFS
  else
    mkdir -p $SRCDI/initrd

    ## create compressed fs
    CLOOPDI=3D$VAR/cloop
    mkdir -p $CLOOPDI
    # Blake, 2003/09/09, create CDIMAGE if needed
    if [ ! -f $CLOOPDI/CDIMAGE ]; then
      mkisofs $GRAFTPOINTS $MKISO_NOT \
        -R \
        -x $SRCDI/proc -x $VAR -x $ERRLOG \
        -x $SRCDI/etc -x $SRCDI/var -x $SRCDI/tmp \
        -x $SRCDI/dev -x $SRCDI/home -x $SRCDI/root $EXCLUDE \
        /=3D$SRCDI/ /=3D$CHANGES \
        /home.ro/=3D$SRCDI/home /root.ro/=3D$SRCDI/root =
/var.ro/=3D$SRCDI/var \
        /etc.ro/=3D$SRCDI/etc $MKISODEVFS | \
        create_compressed_fs - 65536 > $CLOOPDI/CDIMAGE
    fi

    # Blake, 2003/09/24
    # Starting from cloop version 1.0, cloop compressed files can be =
setup using=20
    # the command losetup. MAX loop device is 8, so cloop module can =
handle 8=20
    # compressed files through 8 different cloop devices.
    # $CLOOP_DEV_$i
    for i in 1 2 3 4 5 6 7
    do
      cloop_dev=3D$(eval echo $(echo \$CLOOP_DEV_$i))
      cloop_srcdisk=3D$(eval echo $(echo \$CLOOP_SRCDISK_$i))
      if [ "$cloop_dev" !=3D "" -a \
           "$cloop_srcdisk" !=3D "" -a \
           -d "$cloop_srcdisk" ]; then
        # create CDIMAGE_$1 if needed
        if [ ! -f $CLOOPDI/CDIMAGE_$i ]; then
          mkisofs $GRAFTPOINTS $MKISO_NOT \
            -R /=3D$cloop_srcdisk | \
            create_compressed_fs - 65536 > $CLOOPDI/CDIMAGE_$i
        fi
      fi
    done

    ## create initrd for cloop
    initrd=3D"/tmp/initrd.$$"
    initrdimg=3D`mktemp /tmp/initrd.img.XXXXXX`
    initrdmnt=3D"/tmp/initrd.mnt.$$"
    mkdir -p $initrd
    mkdir -p $initrdmnt
    mkdir -p $initrd/dev
    mkdir -p $initrd/etc
    mkdir -p $initrd/bin
    mkdir -p $initrd/lib
    mkdir -p $initrd/lib/modules
    mkdir -p $initrd/proc
    mkdir -p $initrd/sysroot
    mkdir -p $initrd/cdrom
    ln -s bin $initrd/sbin

    # busybox
    BUSYBOX_VERSION=3D"0.60.3"
    BUSYBOX=3Dbusybox-$BUSYBOX_VERSION
    BUSYBOX_SOURCE=3Dhttp://www.busybox.net/downloads/$BUSYBOX.tar.bz2

    [ -f $BUSYBOX.tar.bz2 ] || wget $BUSYBOX_SOURCE
    [ -d $BUSYBOX ] || tar xvjf $BUSYBOX.tar.bz2
    perl -pi.orig -e 's/^.*(#define =
BB_(INSMOD|PIVOT_ROOT|LOSETUP)).*/$1/' $BUSYBOX/Config.h
    perl -pi.orig -e 's/^(DOSTATIC).*$/$1 =3D true/' $BUSYBOX/Makefile
    make -C $BUSYBOX
    install -m 755 $BUSYBOX/busybox $initrd/bin/
    ln -s busybox $initrd/bin/sh
    ln -s busybox $initrd/bin/echo
    ln -s busybox $initrd/bin/mknod
    ln -s busybox $initrd/bin/chmod
    ln -s busybox $initrd/bin/insmod
    ln -s busybox $initrd/bin/ifconfig
    ln -s busybox $initrd/bin/route
    ln -s busybox $initrd/bin/mount
    ln -s busybox $initrd/bin/pivot_root
    ln -s busybox $initrd/bin/umount
    ln -s busybox $initrd/bin/sleep
    ln -s busybox $initrd/bin/grep
    ln -s busybox $initrd/bin/[
    ln -s busybox $initrd/bin/sed
    ln -s busybox $initrd/bin/cat
    ln -s busybox $initrd/bin/cut
    ln -s busybox $initrd/bin/losetup
    rm -rf $BUSYBOX

    # cloop modules and linuxrc
    cp $CLOOP_O $initrd/lib/modules

    cat <<-EOF > $initrd/linuxrc
#!/bin/sh
PATH=3D/sbin:/bin

echo Busybox /linuxrc starting

echo Mounting /proc filesystem
mount -t proc none /proc

echo Creating root device
mknod /dev/root b 1 0
chmod 700 /dev/root
echo 0x100 > /proc/sys/kernel/real-root-dev

DEVICES=3D"/dev/hda /dev/hdb /dev/hdc /dev/hdd"
for i in \$DEVICES
do
  echo Looking for CDROM in: \$i
  if mount -t iso9660 -o ro \$i /cdrom >/dev/null 2>&1
  then
    if [ -f /cdrom/CDIMAGE ]; then
      echo Found CDIMAGE at \$i
      break
    fi
    umount /cdrom
  fi
done

echo Inserting modules
/sbin/insmod /lib/modules/cloop.o
/sbin/losetup /dev/cloop /cdrom/CDIMAGE
mount -o ro /dev/cloop /sysroot
EOF

    for i in 1 2 3 4 5 6 7
    do
      cloop_dev=3D$(eval echo $(echo \$CLOOP_DEV_$i))
      cloop_srcdisk=3D$(eval echo $(echo \$CLOOP_SRCDISK_$i))
      if [ "$cloop_dev" !=3D "" -a "$cloop_srcdisk" !=3D "" ]; then
        echo "/sbin/losetup /dev/$cloop_dev /cdrom/CDIMAGE_$i" >> =
$initrd/linuxrc
        echo "mount -o ro /dev/$cloop_dev /sysroot/$cloop_srcdisk" >> =
$initrd/linuxrc
      fi
    done

    cat <<-EOF >> $initrd/linuxrc

if [ -d /sysroot/initrd ]; then
  echo Unmounting /proc prior to pivot_root
  umount /proc

  echo Pivoting root to /sysroot
  pivot_root /sysroot /sysroot/initrd
  cd /
=20
  echo Releasing locks on old dev
  exec 0</dev/null
  exec 1>/dev/console
  exec 2>/dev/console
else
  # Failed to mount root: report error and hang
  echo FATAL ERROR: Failed to mount root filesystem
  #echo Press Alt-SysRq-B or hit the reset switch to reboot
  #while : ; do sleep 6000 ; done
fi
EOF
    chmod 755 $initrd/linuxrc

    dd if=3D/dev/zero bs=3D1k of=3D$initrdimg count=3D$((`du -sk =
$initrd | cut -f1` * 7 / 6)) 2> /dev/null
    /sbin/mke2fs -q -F $initrdimg 2> /dev/null
    mount -o loop $initrdimg $initrdmnt
    cp -a $initrd/* $initrdmnt/
    mknod $initrdmnt/dev/console c 5 1
    mknod $initrdmnt/dev/null c 1 3
    mknod $initrdmnt/dev/ram b 1 1
    mknod $initrdmnt/dev/systty c 4 0
    mknod $initrdmnt/dev/random c 1 8
    mknod $initrdmnt/dev/urandom c 1 9
    for i in 1 2 3 4; do mknod $initrdmnt/dev/tty$i c 4 $i; done
    mknod $initrdmnt/dev/hda b 3 0
    mknod $initrdmnt/dev/hdb b 3 64
    mknod $initrdmnt/dev/hdc b 22 0
    mknod $initrdmnt/dev/hdd b 22 64
    mknod $initrdmnt/dev/sda b 8 0
    mknod $initrdmnt/dev/sdb b 8 16
    mknod $initrdmnt/dev/cloop b 240 0

    for i in 1 2 3 4 5 6 7
    do
      cloop_dev=3D$(eval echo $(echo \$CLOOP_DEV_$i))
      if [ "$cloop_dev" !=3D "" ]; then
        mknod $initrdmnt/dev/$cloop_dev b 240 $i
      fi
    done

    umount -d $initrdmnt
    gzip -9 -n -c $initrdimg > initrd-cloop.img

    # cleanup
    rm -rf $initrd
    rm -f $initrdimg
    rmdir $initrdmnt

    ## do isolinux
    run mkdir -p /$CLOOPDI/isolinux
    run cp /usr/lib/syslinux/isolinux.bin /$CLOOPDI/isolinux
    run cp $KERNEL /$CLOOPDI/isolinux/vmlinuz
    run mv initrd-cloop.img /$CLOOPDI/isolinux/initrd
    run "cat <<END >/$CLOOPDI/isolinux/isolinux.cfg
default linux
timeout 50
prompt 1
label linux
  kernel /isolinux/vmlinuz
  append initrd=3D/isolinux/initrd root=3D$CDDEV1 =
ramdisk_size=3D$RAMDISK_SIZE $APPEND
END"

    for i in $CDDEVR; do
      echo "label $(basename $i)"
      echo "  kernel /isolinux/vmlinuz"
      echo "  append initrd=3D/isolinux/initrd root=3D$i =
ramdisk_size=3D$RAMDISK_SIZE $APPEND"
    done >>$CLOOPDI/isolinux/isolinux.cfg

    if [ "$DISPLAY" ]; then
      run "cat <<END >>/$CLOOPDI/isolinux/isolinux.cfg
display display.txt
END"
      run cp $DISPLAY /$CLOOPDI/isolinux/display.txt
    fi

    # add by Blake, Kuo-Lien Huang
    # copy LOGO to $CHANGES/isolinux
    if [ "LOGO" ]; then
      for logo in `echo $LOGO`
	  do
	    name=3D${logo%%.*}
	    sub=3D${logo#$name.}
	    case "$sub" in
	      "png")
		    pngtopnm $logo | ppmtolss16 > /$CLOOPDI/isolinux/$name.lss
		    ;;
		  "pnm")
		    ppmtolss16 < $logo > /$CLOOPDI/isolinux/$name.lss
		    ;;
		  *)
	        run cp $logo /$CLOOPDI/isolinux/
		    ;;
	    esac
	  done
    fi

    # create cdimage
    mkisofs_ignore
    run mkisofs $GRAFTPOINTS $MKISO_NOT \
      -R -b isolinux/isolinux.bin -c isolinux/boot.cat -o $VAR/cdimage =
\
      -no-emul-boot -boot-load-size 4 -boot-info-table \
      /=3D$CLOOPDI
  fi
}

cdimage_normal()
{
  mkisofs_ignore
  run mkisofs $GRAFTPOINTS $MKISO_NOT \
    -R -b cdboot.img -c cdboot.catalog -o $VAR/cdimage \
    -x $SRCDI/proc -x $VAR -x $ERRLOG \
    -x $SRCDI/etc -x $SRCDI/var -x $SRCDI/tmp \
    -x $SRCDI/dev -x $SRCDI/home -x $SRCDI/root $EXCLUDE \
    /=3D$SRCDI/ /=3D$CHANGES \
    /home.ro/=3D$SRCDI/home /root.ro/=3D$SRCDI/root =
/var.ro/=3D$SRCDI/var \
    /etc.ro/=3D$SRCDI/etc $MKISODEVFS
}

cdimage_hppa()
{
  mkisofs_ignore
  run mkisofs $GRAFTPOINTS $MKISO_NOT \
    -R -o $VAR/cdimage \
    -x $SRCDI/proc -x $VAR -x $ERRLOG \
    -x $SRCDI/etc -x $SRCDI/var -x $SRCDI/tmp \
    -x $SRCDI/dev -x $SRCDI/home -x $SRCDI/root $EXCLUDE \
    /=3D$SRCDI/ /=3D$CHANGES \
    /home.ro/=3D$SRCDI/home /root.ro/=3D$SRCDI/root =
/var.ro/=3D$SRCDI/var \
    /etc.ro/=3D$SRCDI/etc $MKISODEVFS

  ignore "^palo version "
  ignore "^ELF32 executable"
  ignore "^ELF64 executable"
  ignore "^ipl: addr "
  ignore "^ ko 0x"
  ignore "^<0/boot/vmlinux root=3D$CDDEV1 ramdisk_size=3D$RAMDISK_SIZE =
$APPEND>"
  ignore "^<>$"
  run palo -k $KERNEL \
    -f /dev/null \
    -b $SRCDI/usr/share/palo/iplboot \
    -c \"0/boot/vmlinux root=3D$CDDEV1 ramdisk_size=3D$RAMDISK_SIZE =
$APPEND\" \
    -C $VAR/cdimage
}

CONFDIR=3D"/etc/bootcd"
ONLY_FLOPPY=3D""
while [ $# -gt 0 ]; do
  if [ "$1" =3D "-only_floppy" ]; then
    shift
    ONLY_FLOPPY=3D"yes"
  elif [ "$1" =3D "-c" -a $# -gt 1 ]; then
    CONFDIR=3D$2
    shift 2
  else
    echo "Usage: bootcdwrite [-only_floppy] [-c <config directory>]"
    echo "  use man bootcdwrite to get help"
    echo "  and see $CONFDIR/bootcdwrite.conf"
    exit 1
  fi
done

if [ "`whoami`" !=3D "root" ]; then
  echo "You have to run bootcdwrite as root"
  exit 1
fi

if [ ! -f $CONFDIR/bootcdwrite.conf  ]; then
  echo "No file $CONFDIR/bootcdwrite.conf" >&2
  exit 1
fi

CONFVARS=3D"SRCDISK KERNEL APPEND NOT_TO_CD NOT_TO_RAM SSHHOSTKEY =
RAMDISK_SIZE \
ERRLOG VAR DO_CHECK BLANKING CDSCSI CDSPEED CDDEV DISPLAY FASTBOOT \
FLOPPY_RUNTIME_DEV FLOPPY_CREATE_DEV BOOTFLOPPY BOOT_ONLY_WITH_FLOPPY \
CLEAN_VAR ISO_ONLY SYSLINUX_SAVE ISOLINUX ARCH INITRD DEVFS TO_FSTAB =
TYP
COMPRESS"

unset $CONFVARS
. $CONFDIR/bootcdwrite.conf
. /usr/share/bootcd/bootcd-run.lib
. /usr/share/bootcd/bootcd-check.lib

for i in $CONFVARS; do
  [ "`set | grep ^$i=3D`" ] || err "$i is not set in =
$CONFDIR/bootcdwrite.conf"
done

if [ "$TYP" =3D "DVDPLUS" ]; then
  PROBLEM=3D"You have defined TYP=3DDVDPLUS, but =
/usr/share/bootcd/bootcd-dvdplus.lib
  is not installed. Please apt-get bootcd-dvdplus."
  [ -f /usr/share/bootcd/bootcd-dvdplus.lib ] || err "$PROBLEM"
  . /usr/share/bootcd/bootcd-dvdplus.lib
fi

if [ "$ARCH" =3D "HPPA" ]; then
  PROBLEM=3D"You have defined ARCH=3DHPPA, but =
/usr/share/bootcd/bootcd-hppa.lib is=20
not installed. Please apt-get bootcd-hppa."
  [ -f /usr/share/bootcd/bootcd-hppa.lib ] || err "$PROBLEM"
  . /usr/share/bootcd/bootcd-hppa.lib
fi

CHANGES=3D$VAR/changes

if [ -e $VAR/cdimage.iso ] ; then
    echo "The image destination $VAR/cdimage.iso exists." | tee -a =
$ERRLOG
    echo "Delete $VAR/cdimage.iso and try again!" | tee -a $ERRLOG
    exit 1
fi

trap trapfunc EXIT SIGINT

date "+--- $0 %d.%m.%Y ---" > $ERRLOG
echo "To see full output: tail -f $ERRLOG" | tee -a $ERRLOG
cleanup

# Write Debug Information to Logfile
VERSION=3D$(COLUMNS=3D200 dpkg -l bootcd | tail -1 | awk '{print $3}')
echo "bootcd Version $VERSION" >>$ERRLOG
for i in $CONFVARS; do
  eval "echo $i \$$i" >>$ERRLOG=20
done

#
# marked by Blake,Kuo-Lien Huang
# do not warn user
#
#warn_user
check_config
# We have to get the sizes (get_sizes) before before the final=20
# check (check_sizes), because some variables with the value "auto"
# need the information to become either "yes" or "no".
#get_sizes
check_arch
check_file_rc
check_compress
check_not2ram
check_cdfiles
check_kernel
check_initrd
[ "$ARCH" =3D "HPPA" ] && check_hppa

# modified by Blake, Kuo-Lien Huang for cloop support
#check_sizes
if [ "$USE_CLOOP" =3D "no" ]; then
  check_sizes
else
  if [ "$(which create_compressed_fs)" =3D "" -o \
       "$CLOOP_O" =3D "" -o \
       ! -f $CLOOP_O ]; then
    echo -n "USE_CLOOP is not allowed.. (e)xit or (d)isable? "
    while read ans
    do
      if [ "$ans" =3D "e" -o "$ans" =3D "E" ]; then=20
        exit 0
      elif [ "$ans" =3D "d" -o "$ans" =3D "D" ]; then
        USE_CLOOP=3D"no";
        break;
      else
        echo -n "USE_CLOOP is not allowed.. (e)xit or (d)isable? "
      fi
    done
  fi
fi

echo "--- Building Modifications ---" | tee -a $ERRLOG
run mkdir -p $VAR/mnt $CHANGES/proc $CHANGES/ram1 $CHANGES/ram2

# at Boottime /etc -> /ram1/etc -> /etc.ro
for i in etc tmp dev home root; do run ln -sf /$i.ro $CHANGES/ram1/$i; =
done
for i in var; do run ln -sf /$i.ro $CHANGES/ram2/$i; done
for i in etc tmp dev home root; do  run ln -sf /ram1/$i $CHANGES/$i; =
done
for i in var; do  run ln -sf /ram2/$i $CHANGES/$i; done

if [ "$CLEAN_VAR" =3D "yes" -a ! "$ONLY_FLOPPY" ]; then
  run apt-get clean # to clear some diskspace in /var=20
fi

# build etc.ro var.ro dev.ro tmp.ro home.ro root.ro
run mkdir $CHANGES/tmp.ro
run chmod 777 $CHANGES/tmp.ro
run mkdir $CHANGES/etc.ro
run chmod 755 $CHANGES/etc.ro
run mkdir $CHANGES/dev.ro
run chmod 755 $CHANGES/dev.ro

run ln -sf /proc/mounts $CHANGES/etc.ro/mtab
mkdir -p $CHANGES/etc.ro/rcS.d
run "mk_bootcdram \"$SRCDISK\" \"$NOT_TO_RAM\" =
>$CHANGES/etc.ro/rcS.d/S12bootcdram.sh"
run "chmod 755 $CHANGES/etc.ro/rcS.d/S12bootcdram.sh"
run mkdir -p $CHANGES/usr/bin $CHANGES/etc.ro/bootcd =
$CHANGES/usr/share/bootcd
run cp /usr/share/bootcd/bootcd2disk $CHANGES/usr/bin/
run cp /usr/share/bootcd/bootcdflopcp $CHANGES/usr/bin/
run "cat /usr/share/bootcd/S13bootcdflop.sh |
  sed \"s|^\(BOOT_ONLY_WITH_FLOPPY=3D\).*$|\1$BOOT_ONLY_WITH_FLOPPY|\" =
|
  sed \"s|^FLOPPY=3D.*$|FLOPPY=3D$FLOPPY_RUNTIME_DEV|\" |
  cat >$CHANGES/etc.ro/rcS.d/S13bootcdflop.sh"
run chmod 755 $CHANGES/etc.ro/rcS.d/S13bootcdflop.sh
run cp /usr/share/bootcd/bootcd2disk.conf $CHANGES/etc.ro/bootcd/
run cp /usr/share/bootcd/bootcd-run.lib $CHANGES/usr/share/bootcd/

echo "KERNEL=3D$REL_KERNEL" >$CHANGES/etc.ro/bootcd/thisbootcd.conf
echo "INITRD=3D$REL_INITRD" >>$CHANGES/etc.ro/bootcd/thisbootcd.conf

run "cat <<END > $CHANGES/etc.ro/fstab
$CDDEV1 / iso9660 defaults,ro 0 1
proc /proc proc defaults 0 0
$TO_FSTAB
END"

if [ ! "$ONLY_FLOPPY" ]; then
  if [ "$SSHHOSTKEY" =3D=3D "yes" ]; then
    # each CD gets a unique hostkey"

    # create_host_keys will only recreate keys, if they already exist.
    # So keys will be touched in new dir, if they existed in old dir.
    for i in ssh_host_key ssh_host_rsa_key ssh_host_dsa_key
    do
      if [ -f $SRCDI/etc/ssh/$i ]; then
        run mkdir -p $CHANGES/etc.ro/ssh
	touch $CHANGES/etc.ro/ssh/$i
      fi
    done

    create_host_keys $CHANGES/etc.ro/ssh

  elif [ "$SSHHOSTKEY" !=3D "no" ]; then
    warn 'SSHHOSTKEY is not defined as "yes" or "no".' \
         'It will be treated as "no".'
  fi
fi

if [ "$ARCH" !=3D "HPPA" -a "$ISOLINUX" =3D "no" ]; then
  do_syslinux
fi

# modified by Blake, Kuo-Lien Huang for cloop support
#if [ "$ISOLINUX" !=3D "no" ]; then
#  do_isolinux
#fi
if [ "$ISOLINUX" !=3D "no" -a "$USE_CLOOP" =3D "no" ]; then
  do_isolinux
fi

# only create fastboot file, if there are no additional mount points
if [ ! "$TO_FSTAB" ]; then
	run touch $CHANGES/fastboot
fi

if [ "$FASTBOOT" =3D=3D "yes" ]; then
  echo "--- Creating /ram[1|2].cpio.gz for FASTBOOT ---" | tee -a =
$ERRLOG

  run mkdir $VAR/ram1
  mkdir $VAR/ram1/tmp; chmod 777 $VAR/ram1/tmp
  FG=3D$(mk_grep $(chnglist -rel -no_mnt "$SRCDISK" "$NOT_TO_RAM =
$NOT_TO_CD"))
  echo "FG (FASTBOOT GREP) =3D <$FG>" >>$ERRLOG

  if [ "$DEVFS" =3D "yes" ]; then=20
    CPIODIR=3D"home root etc"
  else
    CPIODIR=3D"home root etc dev"
  fi
  for i in $CPIODIR; do=20
    run "cd $SRCDISK; find $i | $FG | cpio --quiet -pdum $VAR/ram1"

    if [ -d $CHANGES/$i.ro ]; then=20
      run "cd $CHANGES/$i.ro
           find . |=20
	   cut -c3- | grep -v '^$' | 		# ./file -> file
	   $FG | cpio --quiet -pdum $VAR/ram1/$i"
    fi
  done

  ignore "cpio: .*: truncating inode number"
  run "cd $VAR/ram1
       find . | cpio --quiet -o | gzip -c -9 >$CHANGES/ram1.cpio.gz"
  run "rm -r $VAR/ram1"
 =20
  run mkdir $VAR/ram2
  run "cd $SRCDISK
       find var -type d | $FG | cpio --quiet -pdum $VAR/ram2"

  ignore "cpio: .*: truncating inode number"
  run "cd $VAR/ram2
       find . | cpio --quiet -o | gzip -c -9 >$CHANGES/ram2.cpio.gz"
  run "rm -r $VAR/ram2"

elif [ "$FASTBOOT" !=3D "no" ]; then
  warn 'FASTBOOT is not defined as "yes" or "no".' \
       'It will be treated as "no".'
fi

if [ ! "$ONLY_FLOPPY" ]; then

  echo "--- Creating CD-Image ---" | tee -a $ERRLOG
 =20
  MKISO_NOT=3D""
  if [ "$NOT_TO_CD" !=3D "" ]; then
    MKISO_NOT=3D`echo "$NOT_TO_CD" | sed "s/\(^\| \)*\([^ ]*\)/-x \2 =
/g"`
    echo "NOT_TO_CD arguments for mkisofs =3D <$MKISO_NOT>" >>$ERRLOG
  fi
 =20
  # Are there Files in $SRCDI that we have in $CHANGES too
  # If so we have to exclude them
  EXCLUDE=3D""
  for i in `(cd $CHANGES; find . ! -type d)`; do
                                 # i=3D./etc.ro/mtab
    j=3D`echo $i|sed "s|^\.||"`    # j=3D/etc.ro/mtab
    k=3D`echo $j|sed "s|\.ro/|/|"` # k=3D/etc/mtab
    if [ -f $k ]; then
      EXCLUDE=3D"$EXCLUDE -x $SRCDI$k"
    fi
  done

  # since mkisofs 1.13 we have to use the option -graft-points
  GRAFTPOINTS=3D`mkisofs --version | awk '{if($2>1.12) {print =
"-graft-points"}}'`
  echo "GRAFTPOINTS=3D<$GRAFTPOINTS>" >>$ERRLOG

  if [ "$DEVFS" =3D "yes" ]; then
    MKISODEVFS=3D""
  else
    MKISODEVFS=3D"/dev.ro/=3D$SRCDI/dev"
  fi

  if [ "$COMPRESS" =3D "no" ]; then
    if [ "$ISOLINUX" =3D "yes" ]; then
      cdimage_isolinux
    elif [ "$ARCH" =3D "HPPA" ]; then
      cdimage_hppa
    else
      cdimage_normal
    fi
  else
    if [ "$ISOLINUX" =3D "yes" ]; then
      cdimage_compressed_isolinux
    elif [ "$ARCH" =3D "HPPA" ]; then
      cdimage_compressed_hppa
    else
      cdimage_compressed_normal
    fi =20
  fi
 =20
  echo "--- Testing CD-Image ---" | tee -a $ERRLOG
  run mount $VAR/cdimage $VAR/mnt -o loop -t iso9660
  ignore ".*"
  run ls -l $VAR/mnt
  run umount $VAR/mnt
  losetup -d /dev/loop0 2>/dev/null
 =20
  if [ "$ISO_ONLY" =3D=3D "no" ]; then
    if [ "$BLANKING" !=3D "no" ]; then
      if [ "$TYP" =3D=3D "DVDPLUS" ]; then
        blank_dvdplus
      else
        blank_cd
      fi
    fi
  fi
 =20
  if [ "$ISO_ONLY" =3D=3D "no" ]; then
    if [ "$TYP" =3D=3D "DVDPLUS" ]; then
      write_dvdplus
    else
      write_cd
    fi
  else
    mv $VAR/cdimage $VAR/cdimage.iso
  fi

fi

if [ "$FLOPPY_CREATE_DEV" ]; then
  echo "--- Writing Floppy ---" | tee -a $ERRLOG
  stdout "Formatting cylinder"
  ignore "^mformat"
  run superformat $FLOPPY_CREATE_DEV

  if [ "$BOOTFLOPPY" =3D "yes" ]; then
    ignore=20
    run dd if=3D/$CHANGES/cdboot.img of=3D$FLOPPY_CREATE_DEV bs=3D1024
   =20
    # it works without the next line, but it is very slow then
    run syslinux $FLOPPY_CREATE_DEV

  elif [ "$BOOTFLOPPY" !=3D "no" ]; then
    warn 'BOOTFLOPPY is not defined as "yes" or "no".' \
         'It will be treated as "no".'
  fi
fi

------_=_NextPart_000_01C38684.E2ADEC80
Content-Type: text/plain;
	name="bootcdwrite.conf"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bootcdwrite.conf"

#
# bootcdwrite.conf
#
# Requirements:
#   SRCDISK has to fit on one CD
#   RAMFS has to be big enough to hold /home, /var, /etc, /dev, /tmp, =
/root
#   VAR has to be big enough to hold ...
#   You have to change at least the following variables in this file:=20
#     SRCDISK, KERNEL, RAMDISK_SIZE, BLANKING, TYP, CDSCSI, CDSPEED and =
CDDEV

# Define the filesystem root from which to build an image.
# Example to build bootcd from copy local system:
#   SRCDISK=3D/
SRCDISK=3D/var/lib/diskless/default/root

# Define the kernel which is used
KERNEL=3D$SRCDISK/boot/vmlinuz-2.4.22

# Two Ramdisks ram1 and ram2 will be created, with the followin =
directories:=20
#   ram1: /dev /etc /home /root /tmp
#   ram2: /var
# Both Ramdisks have the same size which is defined by RAMDISK_SIZE
#
# Example: If you want to spend 16MB for RAM Filesystems:
#   RAMDISK_SIZE=3D8192
RAMDISK_SIZE=3D8192

# TYP=3DCD|DVDPLUS
# Define TYP=3DCD if you have a CD-RW drive. Define TYP=3DDVDPLUS if =
you have a
# DVD+RW drive and want to write a DVD+ media or TYP=3DCD if you want =
to
# wirte a CD media.=20
# To use TYP=3DDVDPLUS the debian package bootcd-dvdplus must be =
installed.
TYP=3DCD

# BLANKING=3Dyes|no
# If you want to rewrite a CD or DVD you have to specify BLANKING=3Dyes
BLANKING=3Dno

# CD / DVD+ Writer Informations
# If TYP=3DCD then try "cdrecord -scanbus" to get CDSCSI information. =
Example:
#   CDSCSI=3D0,2,0
# If TYP=3DDVDPLUS then use the scsi device you specify to mount a =
CD/DVD in
# your DVD+ Writer. If you have an IDE unit, use ide-scsi emulation.=20
# (See http://fy.chalmers.se/~appro/linux/DVD+RW/). Example:
#   CDSCSI=3D/dev/scd0
CDSCSI=3D0,4,0

# Needed if you specified TYP=3DCD
CDSPEED=3D2

# =
CDDEV=3D/dev/hda|/dev/hdb|/dev/hdc|/dev/hdd|/dev/scd0|/dev/scd1|/dev/scd=
2
# You can specify one or more CD devices to boot from.
# The first entry is the default. The rest will be given as boot =
options=20
# to the user. See DISPLAY.
#   CDDEV=3D"/dev/hdc /dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/scd0 =
/dev/scd1"
CDDEV=3D"/dev/hdc /dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/scd0 =
/dev/scd1"

# DISPLAY=3D<DISPLAY>|""
# Text to Display at Boottime (see syslinux doku)
# This option is not supported for HPPA
# Example: (Where you could place display.txt)
#   DISPLAY=3D"$SRCDISK/usr/lib/bootcd/display.txt"
# There is a predefined DISPLAY which offers the boot options=20
# /dev/hda, /dev/hdb, /dev/hdc, /dev/hdd, /dev/scd0 and /dev/scd1:
#   DISPLAY=3D"/usr/lib/bootcd/default.txt"
#DISPLAY=3D"/usr/lib/bootcd/default.txt"
DISPLAY=3D"bootcd/display.txt"
LOGO=3D"bootcd/logo.lss"

# If you do not have a cd burner and only want to create an iso_image
# then set ISO_ONLY=3D"yes" also set BLANKING=3D"no" later in this =
file.
ISO_ONLY=3D"yes"

# DO_CHECK=3Dyes|no
# To check for possible problems can take a long time.
# But it is recommended to do the checks=20
DO_CHECK=3Dyes

# If you need kernel options other than  "root=3D..." and =
"ramdisk_size=3D..."
# see append in lilo.conf(5)
# Example:=20
#   APPEND=3D"aha1542=3D0x230"
APPEND=3D""

# If SRCDISK does not fit on one CD you can now decide which parts of=20
# SRCDISK should not go to CD.
#
# Example to exclude /home/user1 and /home/user2
#   NOT_TO_CD=3D"$SRCDISK/home/user1 $SRCDISK/home/user2"
# Example
#   NOT_TO_CD=3D"$SRCDISK/home/bs/download $SRCDISK/home/bs/vmware"
NOT_TO_CD=3D""

# When you boot from CD parts of the CD will be copied to ram
# Here you can decide, what should not go to ram.
#
# The directories /etc /var /dev /tmp /home and /root will be
# in RAM because they have to be writable.=20
#
# On CD this dirs will get different names (/etc.ro, /var.ro, ...)
# but you do not have to use those different names in NOT_TO_RAM any =
more !!!
#
# If you exclude files in NOT_TO_RAM, they will be copied to CD and you
# will find a symbolic link instead of the file in RAM pointing to the =
file
# on CD.
#
# Example
#   If you want to exclude /home/bs/bigfile and /home/bs/bigdir/
#   NOT_TO_RAM=3D"$SRCDISK/home/bs/bigfile $SRCDISK/home/bs/bigdir"
#
NOT_TO_RAM=3D""

# SSHOSTKEY=3Dyes|no
# If you are using ssh it is helpfull to have a unique ssh hostkey for
# each CD. This will be generated at burntime with SSHHOSTKEY=3Dyes.
SSHHOSTKEY=3Dyes

# Free Space for Log and Image
ERRLOG=3D/var/log/bootcdwrite.log
VAR=3D/var/spool/bootcd=20

# FLOPPY_RUNTIME_DEV=3D<floppy device>|""
# When you boot from cd you read changes from this device.
FLOPPY_RUNTIME_DEV=3D/dev/fd0

# The floppy will be formatted when bootcdwrite is called if you define
#   FLOPPY_CREATE_DEV=3D"/dev/fd0".=20
# If you do not want to build a floppy spezify=20
#   FLOPPY_CREATE_DEV=3D""
FLOPPY_CREATE_DEV=3D""

# BOOTFLOPPY=3Dyes|no
# If you want to boot from FLOPPY specify BOOTFLOPPY=3Dyes. This =
reduces
# space on floppy used by bootcdflopcp. For this to work =
FLOPPY_CREATE_DEV
# has to be specified.
# For HPPA this option is not supported and must be set to no.
# Default:
#   BOOTFLOPPY=3Dno
BOOTFLOPPY=3Dno

# BOOT_ONLY_WITH_FLOPPY=3Dyes|no
# If you want to boot several machines from the same cdrom, you must =
have
# the individual configuartion (exp: /etc/network/interfaces) on =
floppy.
# If one can not be mounted it is a good idea to stop booting and to =
wait
# for manual interaction instead of comming up with a wrong =
configuration.
#
BOOT_ONLY_WITH_FLOPPY=3Dno

#
# If CLEAN_VAR=3Dyes then some cached files in /var will be deleted, =
before=20
# /var will be copied to bootcd. This will minimize needed space on CD.
# At this time only the following command will be executed: apt-get =
clean
# You can disable this with CLEAN_VAR=3Dno=20
# Default:
#   CLEAN_VAR=3Dyes
CLEAN_VAR=3Dyes

#
# FASTBOOT=3Dyes|no
# If FASTBOOT=3Dyes then additional images for the ramdisk will be =
created=20
# by bootcdwrite and copied to CD. This allows faster booting,
# but needs extra space on CD
# Default:
#   FASTBOOT=3Dyes
FASTBOOT=3Dyes

# ISOLINUX=3Dauto|yes|no
# See /usr/doc/syslinux/isolinux.doc.gz.=20
# If syslinux is recent enough then isolinux can be used instead of =
syslinux
# and ISOLINUX=3Dauto will be treated as ISOLINUX=3Dyes.
# If you want to use syslinux instead you have to use ISOLINUX=3Dno.
# Default:
#   ISOLINUX=3Dauto
#
ISOLINUX=3Dyes

#
# SYSLINUX_SAVE=3Dyes|no
# This option is only relevant if isolinux is not used.
# If SYSLINUX_SAVE=3Dyes then syslinux is called with -s option. The =
manpage
# of syslinux says: this installs a "save, slow and stupid" version of
# syslinux. In earlier version the -s option was always used. Now you
# can change it.
# Default:
#   SYSLINUX_SAVE=3Dyes
SYSLINUX_SAVE=3Dyes

# ARCH=3Dauto|HPPA|X86
# You can create bootcd for HP PA-RISC too. It is possible to let
# bootcdwrite detect your architecture with ARCH=3Dauto.
# To use ARCH=3DHPPA the debian package bootcd-hppa must be installed.
# Default:
#   ARCH=3Dauto
ARCH=3Dauto

# DEVFS=3Dyes|no
# With devfs you do not need devicefiles and inodes in /dev/*.
# If running diskless this will save some ram.
# See /usr/src/linux/Documentation/filesystems/devfs/README for more =
infos.
#   DEVFS=3Dno
DEVFS=3Dno

# INITRD=3D<PATH_TO_INITRD_IMAGE>|""
#
# Recent official debian kernel images (2.4.x) have started installing =
initrd
# images. If you want to use such a kernel to build a bootcd without=20
# recompiling the kernel you have to use an initrd image. The installed =

# initrd image used to boot from harddisk does not always work from =
cdrom.=20
# So you have to create your own initrd image. Or you can change the =
default=20
# INITRD_IMAGE with the tool bootcdmkinitrd.
#
# INITRD=3D"$(dirname $KERNEL)/initrd.img-$(basename $KERNEL | cut -d- =
-f2-)"
INITRD=3D""

# TO_FSTAB=3D<VALID_FSTAB_ENTRIES>|""
#
# Add additional mount point entries to the cdrom's /etc/fstab. If you =
don't
# want additional mount points, leave it as "".
#
# TO_FSTAB=3D"/dev/hdc1 /home ext3 defaults 1 1"
TO_FSTAB=3D""

# COMPRESS=3D<yes|no|auto>
# If you want to have a transparent-compression ISO 9660/Rock Ridge=20
# filesystem define COMPRESS=3Dyes. If not, set COMPRESS=3Dno.
# If you want bootcdwrite to check, if you need compression because
# running out of space say COMPRESS=3Dauto.=20
# If you define COMPRESS=3Dauto bootcdwrite tries also to check, if you =
have=20
# all the necessary software installed. Therefore you have to define=20
# DO_CHECK=3Dyes if you define COMPRESS=3Dauto.
COMPRESS=3D"no"

# cloop
USE_CLOOP=3D"yes"
CLOOP_O=3D$SRCDISK/lib/modules/2.4.22/kernel/drivers/block/cloop.o

CLOOP_DEV_1=3D""
CLOOP_SRCDISK_1=3D""

CLOOP_DEV_2=3D""
CLOOP_SRCDISK_2=3D""

CLOOP_DEV_3=3D""
CLOOP_SRCDISK_3=3D""

CLOOP_DEV_4=3D""
CLOOP_SRCDISK_4=3D""

CLOOP_DEV_5=3D""
CLOOP_SRCDISK_5=3D""

CLOOP_DEV_6=3D""
CLOOP_SRCDISK_6=3D""

CLOOP_DEV_7=3D""
CLOOP_SRCDISK_7=3D""


------_=_NextPart_000_01C38684.E2ADEC80--