mkbootmedia.ksh revision 4f10d6de4eaf8568195df6a921d12810040e03d9
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# mkbootmedia - create bootable Solaris ISO image
#
readonly PROG=$0
# for gettext
export TEXTDOMAIN
function usage
{
gettext "Usage:\n${PROG##*/} [-v] [-l <label>] <media-root> <iso>\n"
gettext " -v\n Verbose. Multiple -v options increase verbosity.\n"
echo;
}
#
# Main
#
while getopts ':l:v' opt
do
;;
;;
exit 1
;;
exit 2
;;
esac
done
shift 'OPTIND - 1'
if (( $# != 2 ))
then
exit 1
fi
MEDIA_ROOT=$1
ISOIMAGE=$2
gettext "ISO images will not be created on /tmp.\nPlease choose a different output location.\n"
exit 3
fi
# Verify $MEDIA_ROOT is a Solaris install media (Solaris 10 Update 1 or later)
gettext "$MEDIA_ROOT is not Solaris install media.\n"
exit 1
fi
# If no label specified use the Solaris_* version under $MEDIA_ROOT
if [[ -z "$LABEL" ]]; then
fi
# If $ISOIMAGE exists, verify it's writable.
exit 1
fi
# We will have the El Torito file modified with some boot information
# (-boot-info-table option) so it needs to be writable.
if [[ ! -w "$MEDIA_ROOT/$ELTORITO" ]]
then
gettext "$MEDIA_ROOT/$ELTORITO is not writable.\n"
exit 1
fi
# Check that we've got mkisofs installed
gettext "Cannot find $f\n"
exit 1
fi
# Determine mkisofs' verbose flag depending on $VERBOSITY.
case $VERBOSITY in
;;
;;
*) VERBOSE_FLAG=
while ((i > 0))
do
(( i -= 1 ))
done
;;
esac
# Since mkisofs below will modify the file $ELTORITO in-place, save a copy
# of it first. Use trap to restore it when this script exits (including
# when user hits control-C).
"$RM" -f "$ELTORITO_SAVE"' EXIT
# Call mkisofs to do the actual work.
# to filter out mkisofs's warning message about being non-conforming
# to ISO-9660.
-b "$ELTORITO" \
-c .catalog \
-N -l -d -D -r \
-R -J \
-V "$LABEL" \