| Charles Curley - Software Engineer, Writer
| << | < | > | >>
+ Larger Font | - Smaller Font
Charles Curley

Valid XHTML 1.0! Valid CSS!


buildiso

A wrapper script for mkisofs. You will either have to customize this or get a copy of Tom's Root Boot for CD-ROM burning.

#! /bin/sh

# Time-stamp: <2003-09-17 13:17:07 root buildiso>

# Copyright 2003 through the last date of modification, Charles Curley.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# You can also contact the Free Software Foundation at http://www.fsf.org/

# To use: cd to the directory which will form the root of the CD
# image, exclusive of boot images, etc. Run this script with
# arguments.

# Warning: builds a "table of contents" file, ls.lrF, in the current
# directory.

# N.B.: Change the name of the boot catalog, boot.catalog, if it
# conflicts with a file name in the root directory of the image!

# A suitable command line to burn the results:

# /usr/lib/xcdroast-0.98/bin/xcdrwrap CDRECORD dev= "0,0,0" fs=4096k \
# driveropts=burnproof -v -useinfo speed=32 -dao -dummy -eject -pad \
# -data "/var/spool/cdimages/image.name.test.iso"

# defaults in case the user doesn't provide values:

# The volume name we'll give the CD-ROM
volname="http://charlescurley.com"

# The boot image. The default is a good general purpose single floppy
# Linux disty. N.B: mkisofs mungs the image file so don't use the
# original of a file that's hard to rebuild. Use a copy. That's why we
# copy in from outside the tree.
image="/var/diskettes/tomsrtbt-2.0.103.ElTorito.288.img"

# Where we keep the CD images so xcdroast can find them.
outputdir="/var/spool/cdimages"
outputfile="image.iso"

# Explain usage and exit on error.
function errorout {
  echo "Usage: `basename $0` options (-V string -b filename -o filename)"
  echo "Arguments: -V:volume name, -b:boot image, -o:output ISO image"
  echo "default volume name is: $volname."
  echo "default image is 2.88 MB tomsrtbt 2.0.103."
  echo "default output is $outputdir/$outputfile."
  exit $E_OPTERROR
}

NO_ARGS=0
E_OPTERROR=65

if [ $# -eq "$NO_ARGS" ]  # Was the script invoked with no command-line args?
then
  errorout;
fi

while getopts "V:b:o:" Option
do
  case $Option in

# Why these options letters? Because they are the same ones mskisof
# uses.

    V     ) volname=$OPTARG;;
    b     ) image=$OPTARG;;
    o     ) outputfile=$OPTARG;;
    *     ) errorout ;;   # Default.
  esac
done


# Create a "table of contents" file. From "Advanced Bash-Scripting
# Guide", by Mendel Cooper

# The "l" option gives a "long" file listing.
# The "R" option makes the listing recursive.
# The "F" option marks the file types (directories get a trailing /).
echo "Creating table of contents."

ls -lRF . > ls.lrF

img=${image##/*/}

# copy in the boot image, but only if it isn't already there.

if [ ! -e $img ]; then
  echo "Copying in boot image $image."
  cp -rp $image .
fi

# Here are the options we provide to mkisofs:

# -r Add Rock Ridge extensions with useful values for the permission
# bits.

# -J Add Joliet extensions to use the cd with some different operating
# systems.

# -T Generate a TRANS.TBL file in each directory to map correctly the
# file names even on systems which do not support the Rock Ridge
# extensions.

# -v be verbose.

# -V <volid> Specifies the volume ID (volume name or label) to be
# written into the master block. Some operating systems display or
# otherwise use this, so make it something descriptive.

# -c <boot catalog> Specifies the path and filename of the boot
# catalog mkisofs will generate. It is used when making an "El Torito"
# bootable CD. The pathname must be relative to the source path
# specified to mkisofs.

# -b <eltorito boot image> Specifies the path and filename of the boot
# image to be used when making an "El Torito" bootable CD. The
# pathname must be relative to the source path specified to mkisofs
# and specify a floppy image. We default to a 2.88 MB tomsrtbt
# image. For mkisofs, the pathname must be relative to the source path
# specified to mkisofs. For this script, it can be any path, as the
# script will copy it in.

# -o <filename> Name of the file containing the generated iso
# image.

# Finally, the root directory for our generated iso image (we are
# working from the root directory of the CD, so a dot is enough).


echo "Executing mkisofs -r -J -T -v -V \"$volname\" -c boot.catalog -b \"$img\" -o \"$outputdir/$outputfile\" ."

mkisofs -r -J -T -v -V "$volname" -c boot.catalog -b "$img" -o "$outputdir/$outputfile" .


Copyright © 1996 through 2008 by Charles Curley
Last Modified: 30 Nov, 2008
100% Microsoft-free web site.