Hi All,
This code is based Jan experiments and my attempt to make SPARC SUN4V AI
Client based Live-CD for scripted OpenSolaris 200906 JeOS installations.
Nice day
Rudolf Kutina (VirtualGuru)
------------------------------------
#!/bin/ksh
#
#
=============================================================================
#
=============================================================================
# create_iso - Create an ISO image from a prepared package image area
#
=============================================================================
#
=============================================================================
#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Main
#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Create an ISO image from a prepared package image area
#
# Args:
# MFEST_SOCKET: Socket needed to get manifest data via ManifestRead object
#
# PKG_IMG_PATH: Package image area
#
# TMP_DIR: Temporary directory to contain the bootroot file (not used)
#
# BR_BUILD: Area where bootroot is put together (not used)
#
# MEDIA_DIR: Area where the media is put
#
# Note: This assumes a completely prepared package image area and bootroot
#
#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$#" != "5" ] ; then
print -u2 "$0: Requires 5 args:"
print -u2 " Reader socket, pkg_image area, tmp dir,"
print -u2 " bootroot build area, media area."
exit 1
fi
MFEST_SOCKET=$1
PKG_IMG_PATH=$2
if [ ! -d $PKG_IMG_PATH ] ; then
print -u2 "$0: Unable to access pkg_image area $PKG_IMG_PATH"
exit 1
fi
TMP_DIR=$3
if [ ! -d $TMP_DIR ] ; then
print -u2 "$0: Unable to access TMP_DIR area $TMP_DIR"
exit 1
fi
BR_BUILD=$4
if [ ! -d $BR_BUILD ] ; then
print -u2 "$0: Unable to access BR_BUILD area $BR_BUILD"
exit 1
fi
MEDIA_DIR=$5
if [ ! -d $MEDIA_DIR ] ; then
print -u2 "$0: Unable to access media directory $MEDIA_DIR"
exit 1
fi
# Define a few commands.
MKISOFS=/usr/bin/mkisofs
RM=/usr/bin/rm
DD=/usr/bin/dd
# Non core-OS commands.
MANIFEST_READ=/usr/bin/ManifestRead
DISTRO_NAME=`$MANIFEST_READ $MFEST_SOCKET "name"`
DIST_ISO=${MEDIA_DIR}/${DISTRO_NAME}.iso
print "Making final ISO image"
$RM -f "$DIST_ISO"
if [ `uname -m` == "i86pc" ] ; then
$MKISOFS -o "$DIST_ISO" -b boot/grub/stage2_eltorito -c .catalog \
-no-emul-boot -boot-load-size 4 -boot-info-table -N -l -R -U \
-allow-multidot -no-iso-translate -cache-inodes -d -D -V \
"$DISTRO_NAME" "$PKG_IMG_PATH"
else
# Before SPARC rootdisk is created, we need to make in DC pre_...
step right links !!!
## Links SPARC bootarchives, workaround for current DC Live-CD process
### cd ${PKG_IMG_PATH}/platform
### ln -s ../../boot/boot_archive sun4u/
### ln -s ../../boot/boot_archive sun4v/
# We support primary sun4v, so we hardcode all paths for it:
# Hmm, GNU dd in OpenSolaris don't support oseek parameter ???
${DD} if="$BR_BUILD/platform/sun4v/lib/fs/hsfs/bootblk" \
of=$TMP_DIR/hsfs.bootblock bs=1b oseek=1 count=15 conv=sync 2>&1
> /dev/null
$MKISOFS -o "$DIST_ISO" -N -l -R -d -D \
-G $TMP_DIR/hsfs.bootblock -B ... \
-graft-points -relaxed-filenames \
-V "$DISTRO_NAME" "$PKG_IMG_PATH"
fi
if [ "$?" != "0" ] ; then
print -u2 "$0: mkisofs of $DIST_ISO failed"
exit 1
fi
exit 0