./iso.sh -l sol10_1106 -o /export/home/iso/sol10_1106.iso
#!/bin/sh
#
# =head1 NAME
#
# mkiso - construct an ISO9660 CD image for burning a data CD
#
# =head1 SYNOPSIS
#
# mkiso [-l label] [-o image.iso] directory
#
# =head1 DESCRIPTION
#
# I
embodies my usual incantation
# for constructing an ISO9660 image for a CDROM.
# It is partner to mkcd(1cs), a program to burn data CDs.
# I makes plain vanilla data CDs, not bootable or audio CDs.
#
# =head1 OPTIONS
#
# =over 4
#
# =item B<-l> I
#
# The default Volume identifier for the image
# is normally taken from the file B in the top of the I.
# (This is because I like my data sets self describing,
# an having such a file is the simplest method not needing any metadata).
# Alternatively you may supply the Volume Identifier
# on the command line with this option.
#
# =item B<-o> B.iso>
#
# Specify the location of the resulting ISO9660 image.
# By default this is a file in the current directory
# called B.iso>, where I is the basename
# of the I named on the command line.
#
# =back
#
# =head1 FILES
#
# The B (publisher) and B (preparer) values
# come from the B<$HOME/.mkisofsrc> file.
# See mkisofs(1) for more information.
#
# =head1 SEE ALSO
#
# mkcd(1cs), mkisofs(1), cdrecord(1)
#
# =head1 CREDITS
#
# I is really just a wrapper for the mkisofs(1) command
# by Joerg Schilling.
#
# =head1 AUTHOR
#
# Cameron Simpson 12jul2000
#
cmd=`basename "$0"`
usage="Usage: $cmd [-l label] [-o image.iso] directory
-l label Label string (VOLI field, up to 32 bytes).
Default: the contents of the top level
LABEL file, or the directory
basename plus ISO date.
-o image.iso Specify output file.
Default: directory.iso"
out=
volid=
label=
iso=
badopts=
while :
do case $1 in
-l) label=$2; shift ;;
-o) out=$2; shift ;;
--) shift; break ;;
-?*) echo "$cmd: unrecognised option: $1" >&2
badopts=1
;;
*) break ;;
esac
shift
done
if [ $# = 0 ]
then
echo "$cmd: missing directory" >&2
badopts=1
else
dir=$1; shift
[ $# = 0 ] || { echo "$cmd: extra arguments: $*" >&2
badopts=1
}
fi
[ $badopts ] && { echo "$usage" >&2; exit 2; }
ok=1
if [ ! -d "$dir/." ]
then
echo "$cmd: not a directory: $dir" >&2
ok=
fi
if [ -z "$out" ]
then
out=`basename "$dir"`.iso
echo "iso=$out"
fi
if [ -z "$label" ]
then
lfile=$dir/LABEL
if [ ! -s "$lfile" ]
then
label=`basename "$dir"`" - "`date '+%Y-%m-%d'`
echo "$cmd: no label file: $lfile" >&2
echo " using \"$label\""
else
label=`cat <"$lfile"`
if [ $? != 0 ]
then
echo "$cmd: problems reading label file $lfile" >&2
ok=
else
if [ -z "$label" ]
then
echo "$cmd: empty label from $lfile" >&2
ok=
else
echo "VOLI=$label"
fi
fi
fi
fi
if [ -s "$iso" ]
then
echo "$cmd: existing file: $iso" >&2
ok=
fi
[ $ok ] || exit 1
set -x
exec mkisofs -D -J -allow-leading-dots -N -r -T -v -V "$label" -o "$out" "$dir"
## old mkisofs ## exec mkisofs -D -J -L -N -r -T -v -V "$label" -o "$out" "$dir"
No comments:
Post a Comment