Home | History | Annotate | Download | only in livemedia
      1   0    dave #!/usr/bin/bash
      2   0    dave #
      3   0    dave # CDDL HEADER START
      4   0    dave #
      5   0    dave # The contents of this file are subject to the terms of the
      6   0    dave # Common Development and Distribution License (the "License").
      7   0    dave # You may not use this file except in compliance with the License.
      8   0    dave #
      9   0    dave # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10   0    dave # or http://www.opensolaris.org/os/licensing.
     11   0    dave # See the License for the specific language governing permissions
     12   0    dave # and limitations under the License.
     13   0    dave #
     14   0    dave # When distributing Covered Code, include this CDDL HEADER in each
     15   0    dave # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16   0    dave # If applicable, add the following below this CDDL HEADER, with the
     17   0    dave # fields enclosed by brackets "[]" replaced with your own identifying
     18   0    dave # information: Portions Copyright [yyyy] [name of copyright owner]
     19   0    dave #
     20   0    dave # CDDL HEADER END
     21   0    dave #
     22   2    dave # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     23   0    dave # Use is subject to license terms.
     24   0    dave #
     25   0    dave # This script pulls in binaries from various locations and builds
     26   0    dave # a complete bootable CD and memory based filesystem image of
     27   0    dave # OpenSolaris. Finally it generates an iso image that can be burned
     28   0    dave # onto the CDROM to get a bootable OpenSolaris Live DVD.
     29   0    dave #
     30   0    dave # This script performs the following steps:
     31   0    dave #
     32   0    dave # 1) Load the configuration file build_live_dvd.conf
     33   0    dave #
     34   0    dave # 2) Remove the proto directory if it exists. This directory will
     35   0    dave #    contain the complete OpenSolaris filesystem image
     36   0    dave #
     37   0    dave # 3) Install the complete set of packages from a Solaris Express image
     38   0    dave #    to the proto area.
     39   0    dave #
     40   0    dave # 4) Copy lists of files/binaries/directories defined in various
     41   0    dave #    packages under the packages directory.
     42   0    dave #
     43   0    dave # 5) Copy skeleton scripts and configuration files contained in the
     44   0    dave #    bootcd_skel directory. These files contain the essential customizations
     45   0    dave #    necessary to make our OpenSolaris Live DVD work.
     46   0    dave #
     47   0    dave # 6) Create our minimal root filesystem image that will be mounted as
     48   0    dave #    the ramdisk. This is essentially a file that contains a ufs
     49   0    dave #    filesystem image. This file is loaded into memory by grub and is
     50   0    dave #    ultimately mounted by the kernel via the ramdisk driver.
     51   0    dave #
     52   0    dave # 7) Copy a predefined list of files onto our minimal root. The files in
     53   0    dave #    copied into this minimal root (ramdisk) are carefully chosen to
     54   0    dave #    minimize the size of the miniroot and reduce memory usage. This
     55   0    dave #    miniroot contains files that are absolutely necessary to boot till
     56   0    dave #    the point where /usr is mounted from the DVD. This split mount
     57   0    dave #    is the essential character of a Live DVD.
     58   0    dave #
     59   0    dave # 8) Create some essential symbolic links in /dev in the miniroot. These
     60   0    dave #    are used much before devfsadm can run. In the normal case where Solaris
     61   0    dave #    is installed onto a hard disk, the installer executes devfsadm to
     62   0    dave #    pre-populate /dev on the hard disk before the newly installed OS boots
     63   0    dave #    for the first time. Since this cannot happen with a Live DVD, we need
     64   0    dave #    to forcibly create the symlinks here even though /devices is empty. The
     65   0    dave #    symlinks will point to valid /devices entries when our Live DVD boots.
     66   0    dave #
     67   0    dave # 9) Create other necessary symlinks in the miniroot. These include some
     68   0    dave #    SMF links that indicate the default inetd service profile.
     69   0    dave #
     70   0    dave # 10) Gzip the file containing the miniroot. Grub will unzip it when it loads
     71   0    dave #     the file into memory. The file is then copied into the default location
     72   0    dave #     proto/boot/solaris.
     73   0    dave #
     74  33    dave # 11) mkisofs is invoked to build a bootable iso image containing the
     75   0    dave #     entire contents of our proto directory. Grub's eltorito stage2 bootloader
     76   2    dave #     is used, that enables booting directly off a DVD. We violate the ISO9660
     77   0    dave #     specs somewhat to accomodate file properties essential for a proper Unix
     78   0    dave #     file/directory layout.
     79   0    dave #
     80  33    dave # 12) If requested, transform the ISO image into a UFS filesystem suitable for
     81  11  dminer #     copying to a USB storage device, typically flash memory.  This allows
     82  11  dminer #     creating copies of the USB image to take 10 minutes or so.  The usbcopy
     83  11  dminer #     script included with this kit is used to copy the image to the USB stick.
     84   0    dave 
     85   0    dave # 
     86   0    dave # Load our configuration
     87   0    dave #
     88   0    dave 
     89   0    dave source build_live_dvd.conf
     90   0    dave source build_live_dvd.lib
     91   0    dave 
     92  11  dminer # Set up root of build area
     93  11  dminer if [ -n $PREFIX_DATASET ]; then
     94  11  dminer 	zfs list $PREFIX_DATASET >/dev/null 2>&1 || zfs create $PREFIX_DATASET
     95  11  dminer 	if [ $? != 0 ] ; then
     96  11  dminer 		echo "Unable to create dataset $PREFIX_DATASET"
     97  11  dminer 		exit 1
     98  11  dminer 	fi
     99  11  dminer fi	
    100   4    dave [ -d $PREFIX ] || mkdir $PREFIX
    101   4    dave 
    102   2    dave (
    103   2    dave echo "=== $0 started at `date`"
    104   2    dave 
    105  11  dminer #
    106  31    dave # Initial sanity check
    107  11  dminer #
    108  11  dminer if [ -z "$BOOTCD_PROTO" -o "$BOOTCD_PROTO" = "/" ]; then
    109  11  dminer 	echo "You must specify either PROTO_DATASET or BOOTCD_PROTO in the"
    110  11  dminer 	echo "configuration file.  Aborting."
    111  11  dminer 	exit 1
    112  11  dminer fi
    113  11  dminer 
    114  11  dminer soldprodlofi=""
    115   2    dave # Config specified an ISO image, mount it up
    116   2    dave if [ -n "$SOLPRODUCTISO" ]; then
    117  11  dminer 	solprodlofi=`lofiadm -a $SOLPRODUCTISO`
    118  11  dminer 	if [ $? != 0 ]; then
    119  11  dminer 		echo "Unable to create loopback device for $SOLPRODUCTISO"
    120  11  dminer 		exit 1
    121  11  dminer 	fi
    122  25  dminer 	[ -d $SOLPRODUCT ] || mkdir -p $SOLPRODUCT
    123  11  dminer 	mount -F hsfs $solprodlofi $SOLPRODUCT
    124   2    dave fi
    125   2    dave 
    126   2    dave if [ ! -d "$PKGREPOS" ]; then
    127   2    dave     echo "$SOLPRODUCT is not a Solaris Nevada image!"
    128  11  dminer     umount $SOLPRODUCT
    129  11  dminer     lofiadm -d $solprodlofi
    130   0    dave     exit 1
    131   0    dave fi
    132   0    dave 
    133   0    dave [ -d $TMPDIR ] || mkdir $TMPDIR
    134   0    dave 
    135   0    dave TARGET=/
    136   0    dave 
    137   0    dave cd $PREFIX
    138   0    dave 
    139   0    dave MNT=$PREFIX/bootcd_rootfs
    140   0    dave 
    141   2    dave # If we're configured to use a ZFS dataset, then set it up if necessary
    142   2    dave # or figure out which snapshots already exist
    143   2    dave NEED_PKGS=true
    144   2    dave NEED_POSTRUN=true
    145  40    dave NEED_SKELETON=true
    146   2    dave if [ -n "$PROTO_DATASET" ]; then
    147  11  dminer 	zfs list $PROTO_DATASET >/dev/null 2>&1 || zfs create $PROTO_DATASET
    148  35    dave 	zfs set snapdir=hidden $PROTO_DATASET
    149   2    dave 	PKG_SNAPSHOT=$PROTO_DATASET@pkg
    150   2    dave 	POSTRUN_SNAPSHOT=$PROTO_DATASET@postrun
    151  40    dave 	SKELETON_SNAPSHOT=$PROTO_DATASET@skeleton
    152  40    dave 	zfs list $SKELETON_SNAPSHOT >/dev/null 2>&1 && NEED_SKELETON=false
    153  11  dminer 	zfs list $POSTRUN_SNAPSHOT >/dev/null 2>&1 && NEED_POSTRUN=false
    154  11  dminer 	zfs list $PKG_SNAPSHOT >/dev/null 2>&1 && NEED_PKGS=false
    155   2    dave else
    156   2    dave 	echo "Cleaning up $BOOTCD_PROTO"
    157   2    dave 	rm -rf $BOOTCD_PROTO
    158   2    dave 	mkdir $BOOTCD_PROTO
    159   2    dave fi
    160   0    dave 
    161   0    dave #
    162   0    dave # Minimal directory structure
    163   0    dave #
    164   0    dave echo "Creating basic directory structure"
    165   2    dave mkdirs $BOOTCD_PROTO $LIVEKIT/mkbootcd.files.minimal
    166   0    dave 
    167   2    dave # If we already have the snapshot of this stage, skip
    168   2    dave if [ $NEED_PKGS = true ]; then
    169   0    dave 
    170   2    dave 	#
    171   2    dave 	# Generate package list from media
    172   2    dave 	#
    173   2    dave 
    174   2    dave 	# Create admin file for non-interactive pkgadd's
    175   2    dave 	ADMIN_FILE=$TMPDIR/admin
    176   2    dave 	cat << \ADMIN_EOF > $ADMIN_FILE
    177   0    dave mail=
    178   0    dave instance=unique
    179   0    dave partial=nocheck
    180   2    dave runlevel=nocheck
    181   0    dave idepend=nocheck
    182   2    dave rdepend=nocheck
    183   2    dave space=nocheck
    184   0    dave setuid=nocheck
    185   0    dave conflict=nocheck
    186   0    dave action=nocheck
    187   0    dave networktimeout=60
    188   0    dave networkretries=3
    189   0    dave authentication=quit
    190   0    dave keystore=/var/sadm/security
    191   0    dave proxy=
    192   0    dave basedir=default
    193   0    dave ADMIN_EOF
    194   0    dave 
    195   2    dave 	echo "Generating ordered package list from $PKGREPOS and installing to $BOOTCD_PROTO"
    196   0    dave 
    197  46    dave 	/usr/bin/perl $LIVEKIT/proc_toc.pl SUNWCXall $SOLPRODUCT | /usr/ccs/bin/tsort | grep -v "INFORM: cycle" | grep -v "SUNWdummy" > $TMPDIR/ordered
    198   2    dave 	perl $LIVEKIT/rev_file.pl $TMPDIR/ordered | while read pkg
    199   2    dave 	do
    200  46    dave 		if [ -d $PKGREPOS/$pkg ]
    201  46    dave 		then
    202   2    dave 			pkgadd -n -a $ADMIN_FILE -d $PKGREPOS -R $BOOTCD_PROTO $pkg
    203   2    dave 		else
    204   2    dave 			pkgi="${pkg}.i"
    205   2    dave 			if [ -d $PKGREPOS/$pkgi ]
    206   2    dave 			then
    207   2    dave 				pkgadd -n -a $ADMIN_FILE -d $PKGREPOS -R $BOOTCD_PROTO $pkgi
    208   2    dave 			fi
    209   0    dave 		fi
    210   2    dave 		if [[ $? -ne 0 ]]
    211   2    dave 		then
    212   2    dave 			echo "******* Install of $pkg failed *******"
    213   2    dave 		fi
    214   2    dave 	done
    215   2    dave 
    216  11  dminer         # Install Developer Tools if present and requested
    217  11  dminer         if [ "$INSTALL_DEVTOOLS" = true -a  -x $SOLPRODUCT/DeveloperTools/install_devtools.sh ]
    218  11  dminer         then
    219  11  dminer                 $SOLPRODUCT/DeveloperTools/install_devtools.sh -R $BOOTCD_PROTO
    220  11  dminer         fi
    221  11  dminer 
    222   2    dave 	# Save snapshot if possible to skip this on next build
    223   2    dave 	[ -n "$PKG_SNAPSHOT" ] && zfs snapshot $PKG_SNAPSHOT
    224  11  dminer fi
    225  11  dminer 
    226  11  dminer # Unmount the ISO if specified
    227  11  dminer if [ -n "$SOLPRODUCTISO" ]; then
    228  11  dminer 	umount $SOLPRODUCT
    229  11  dminer 	lofiadm -d $solprodlofi
    230   2    dave fi
    231   0    dave 
    232  40    dave if [ $NEED_SKELETON = true ]; then
    233  40    dave 	[ -n "$PKG_SNAPSHOT" ] && zfs rollback $PKG_SNAPSHOT
    234  40    dave 	#
    235  40    dave 	# Copy extra binaries from various packages including
    236  40    dave 	# Free and Open Source software packages
    237  40    dave 	#
    238  40    dave 	# This loop goes through all the subdirectories of PACKAGEDIR
    239  40    dave 	# if the subdirectory is mentioned in PACKAGEDIR/buildpkg.list
    240  40    dave 	# then that package has been installed in TARGET
    241  40    dave 	# and the binaries should be transferred from TARGET to BOOTCD_PROTO/TARGET.
    242  40    dave 	# Otherwise the package binaries are in the same subdirectory
    243  40    dave 	# of TARGET/<package> and should be transferred to BOOTCD_PROTO.
    244  40    dave 	#
    245  40    dave 	echo "Copying Package files"
    246  40    dave 	
    247  40    dave 	#
    248  40    dave 	# Minimal package registry
    249  40    dave 	#
    250  40    dave 	mkdir -p $BOOTCD_PROTO/pkgs
    251  40    dave 	
    252  40    dave 	for d in `cat $PACKAGEDIR/cdpkg.list`
    253  40    dave 	do
    254  40    dave 	    # If package includes an installation script, use it
    255  40    dave 	    if [[ -x $PACKAGEDIR/$d/install.live ]]; then
    256  40    dave 		echo $d
    257  40    dave 		$PACKAGEDIR/$d/install.live $PACKAGEDIR/$d $BOOTCD_PROTO
    258  40    dave 		continue
    259  40    dave 	    fi
    260  40    dave 	    # Install using file list
    261  40    dave 	    flist=""
    262  40    dave 	    if [[ -f "$PACKAGEDIR/$d/${d}.files.livecd" ]]
    263  40    dave 	    then
    264  40    dave 		flist="$PACKAGEDIR/$d/${d}.files.livecd"
    265  40    dave 	
    266  40    dave 	    elif [[ -f "$PACKAGEDIR/$d/${d}.files" ]]
    267  40    dave 	    then
    268  40    dave 		flist="$PACKAGEDIR/$d/${d}.files"
    269  40    dave 	    fi
    270  40    dave 	
    271  40    dave 	    if [[ "x$flist" != "x"  ]]
    272  40    dave 	    then
    273  40    dave 		echo $d
    274  40    dave 		grep "^$d/" $PACKAGEDIR/buildpkg.list > /dev/null
    275  40    dave 		if [ $? -ne 0 ]
    276  40    dave 		then
    277  40    dave 		    mkdir -p "$BOOTCD_PROTO/pkgs/$d"
    278  40    dave 		    cp "$flist" "$BOOTCD_PROTO/pkgs/$d"
    279  40    dave 	
    280  40    dave 		    if [ -f "$PACKAGEDIR/$d/installprefix" ]
    281  40    dave 		    then
    282  40    dave 			pref=`cat "$PACKAGEDIR/$d/installprefix"`
    283  40    dave 			copyfiles "$PACKAGEDIR/$d" "$BOOTCD_PROTO/$pref" "$flist"
    284  40    dave 		    else
    285  40    dave 			copyfiles "$PACKAGEDIR/$d" "$BOOTCD_PROTO" "$flist"
    286  40    dave 		    fi
    287  40    dave 		else
    288  40    dave 		    mkdir -p "$BOOTCD_PROTO/pkgs/$d"
    289  40    dave 		    cp "$flist" "$BOOTCD_PROTO/pkgs/$d"
    290  40    dave 	
    291  40    dave 		    if [ -f "$PACKAGEDIR/$d/installprefix" ]
    292  40    dave 		    then
    293  40    dave 			pref=`cat "$PACKAGEDIR/$d/installprefix"`
    294  40    dave 			copyfiles "$TARGET" "$BOOTCD_PROTO/$pref" "$flist"
    295  40    dave 		    else
    296  40    dave 			copyfiles "$TARGET" "$BOOTCD_PROTO/$TARGET" "$flist"
    297  40    dave 		    fi
    298  40    dave 		fi
    299  40    dave 	    fi
    300  40    dave 	done
    301  40    dave 	
    302  40    dave 	#
    303  40    dave 	# Copy all the basic customizations required for the Live DVD to
    304  40    dave 	# work. These are called the skeleton customisation files.
    305  40    dave 	#
    306  40    dave 	cd $LIVEKIT
    307  40    dave 	echo "Copying skeleton files"
    308  40    dave 	# First save the originals for use in installation
    309  40    dave 	while read t m p f; do
    310  40    dave 		[ -f $BOOTCD_PROTO/$f ] && echo $f
    311  40    dave 	done <$BOOTCD_SKEL/bootcd_skel.files | (cd $BOOTCD_PROTO; cpio -o -O skeleton.cpio)
    312  40    dave 	# Now copy skeleton into place
    313  40    dave 	copyfiles "$BOOTCD_SKEL" "$BOOTCD_PROTO" $BOOTCD_SKEL/bootcd_skel.files
    314  40    dave 	
    315  40    dave 	#
    316  40    dave 	# Remove basic registration files from GNOME login session
    317  40    dave 	# Does not make much sense in a LiveDVD and is a perf hog
    318  40    dave 	#
    319  40    dave 	rm ${BOOTCD_PROTO}/usr/dt/config/Xsession.d/1001.swupnot
    320  40    dave 	rm ${BOOTCD_PROTO}/usr/dt/config/Xsession.d/1099.br
    321  40    dave 	
    322  40    dave 	# Copy installer into place
    323  40    dave 	pkgadd -n -R $BOOTCD_PROTO -d $LIVEKIT/SUNWgui-install.pkg SUNWgui-install
    324  40    dave 	cd $BOOTCD_PROTO/usr/share/gui-install
    325  40    dave 	bzip2 -dc $LIVEKIT/gui-install-dummy-txt.tar.bz2 | tar xf -
    326  40    dave 	cd $LIVEKIT
    327  40    dave 	cp $LIVEKIT/dummy_install $BOOTCD_PROTO/usr/bin
    328  40    dave 
    329  40    dave 	[ -n "$SKELETON_SNAPSHOT" ] && zfs snapshot $SKELETON_SNAPSHOT
    330  40    dave fi
    331  40    dave 
    332   0    dave #
    333   2    dave # Pre-configure Gnome databases and SMF repository
    334   0    dave # 
    335   2    dave if [ $NEED_POSTRUN = false ]; then
    336  40    dave 	zfs rollback -r $POSTRUN_SNAPSHOT
    337   2    dave else
    338  40    dave 	[ -n "$SKELETON_SNAPSHOT" ] && zfs rollback -r $SKELETON_SNAPSHOT
    339   2    dave 
    340   2    dave 	echo "Configuring Gnome"
    341   2    dave 	[ -x $BOOTCD_PROTO/var/lib/postrun/postrun-runq ] && chroot $BOOTCD_PROTO /var/lib/postrun/postrun-runq
    342   2    dave 
    343   2    dave 	echo "Creating font cache"
    344   2    dave 	[ -x $BOOTCD_PROTO/usr/bin/fc-cache ] && chroot $BOOTCD_PROTO /usr/bin/fc-cache --force
    345   2    dave 
    346   2    dave 	echo "Preloading SMF repository"
    347   2    dave 	export LIVEKIT
    348   2    dave 	$LIVEKIT/mkrepo $BOOTCD_PROTO
    349   2    dave 
    350   2    dave 	[ -n "$POSTRUN_SNAPSHOT" ] && zfs snapshot $POSTRUN_SNAPSHOT
    351   2    dave fi
    352   0    dave 
    353   0    dave #
    354   0    dave # Create the boot archive. This is a UFS filesystem image in a file
    355   0    dave # that is loaded into RAM by Grub. A file is created using mkfile
    356   0    dave # and is added as a block device using lofiadm. newfs is then used
    357   0    dave # to create a UFS filesystem on the lofi device and then it is
    358   0    dave # mounted and all the files required for a minimal root fs are
    359   0    dave # copied.
    360   0    dave #
    361   0    dave echo "Initializing Boot Archive"
    362   0    dave 
    363   0    dave rm -f ${BOOT_ARCHIVE}
    364   0    dave /usr/sbin/mkfile ${RAMDISK_SIZE}k $BOOT_ARCHIVE
    365   0    dave 
    366   0    dave lofidev=`/usr/sbin/lofiadm -a $BOOT_ARCHIVE`
    367   0    dave if [ $? != 0 ] ; then
    368  11  dminer     echo "Unable to create loopback device for $BOOT_SARCHIVE"
    369   0    dave     exit 2
    370   0    dave fi
    371   0    dave           
    372   0    dave rlofidev=`echo $lofidev | sed s/lofi/rlofi/`
    373   0    dave newfs -m 0 $rlofidev < /dev/null 2> /dev/null
    374   2    dave [ -d $MNT ] || mkdir $MNT
    375   0    dave mount -o nologging $lofidev $MNT
    376   0    dave rmdir ${MNT}/lost+found
    377   0    dave 
    378   0    dave echo "Copying files to Boot Archive"
    379  40    dave cd $LIVEKIT
    380   0    dave copyfiles "$BOOTCD_PROTO" "$MNT" `pwd`/mkbootcd.files.minimal
    381   0    dave 
    382   0    dave #
    383  46    dave # Additional /var /etc setup. Putting these in the ramdisk will
    384  46    dave # increase ramdisk size substantially, so these are left on the
    385  46    dave # cd with symlinks from the ramdisk.
    386  46    dave #
    387  46    dave # Ideally these should be in another compressed file mounted via
    388  46    dave # lofi to conserve space and get a big performance increase. 
    389  46    dave #
    390  46    dave cd ${MNT}/etc
    391  46    dave ln -sf /.cdrom/etc/gtk
    392  46    dave ln -sf /.cdrom/etc/gtk-2.0
    393  46    dave ln -sf /.cdrom/etc/cacao
    394  46    dave ln -sf /.cdrom/etc/lu
    395  46    dave ln -sf /.cdrom/etc/usb
    396  46    dave ln -sf /.cdrom/etc/orbitrc
    397  46    dave ln -sf /.cdrom/etc/gconf
    398  46    dave ln -sf /.cdrom/etc/gnome-vfs-2.0
    399  46    dave ln -sf /.cdrom/etc/gnome-vfs-mime-magic
    400  46    dave ln -sf /.cdrom/etc/gnopernicus-1.0
    401  46    dave ln -sf /.cdrom/etc/gimp
    402  46    dave ln -sf /.cdrom/etc/wgetrc
    403  46    dave ln -sf /.cdrom/etc/sfw
    404  46    dave ln -sf /.cdrom/etc/scrollkeeper.conf
    405  46    dave ln -sf /.cdrom/etc/sound
    406  46    dave ln -sf /.cdrom/etc/esd.conf
    407  46    dave ln -sf /.cdrom/etc/xml
    408  46    dave ln -sf /.cdrom/etc/xpdfrc
    409  46    dave ln -sf /.cdrom/etc/xdg
    410  43    dave 
    411  46    dave cd ${MNT}/var/sadm
    412  46    dave ln -s /.cdrom/var/sadm/install
    413  46    dave ln -s /.cdrom/var/sadm/install_data
    414  46    dave ln -s /.cdrom/var/sadm/wbem
    415  46    dave ln -s /.cdrom/var/sadm/system
    416  46    dave ln -s /.cdrom/var/sadm/spool
    417  46    dave ln -s /.cdrom/var/sadm/softinfo
    418  43    dave 
    419  46    dave cd ${MNT}/var
    420  46    dave ln -s /.cdrom/var/cc-ccr
    421  43    dave 
    422   0    dave echo "$VOLUMEID" > $MNT/.volumeid
    423   0    dave chmod 0444 $MNT/.volumeid
    424   0    dave chown root:root $MNT/.volumeid
    425   0    dave 
    426   0    dave #
    427   0    dave # Unmount the lofi device and remove it. Then gzip the file
    428   0    dave # containing the root fs image. Grub will decompress it while
    429   0    dave # loading.
    430   0    dave #
    431   0    dave echo "Archiving Boot Archive"
    432   0    dave 
    433   0    dave cd $PREFIX
    434   0    dave lockfs -f $MNT
    435   0    dave umount $MNT
    436   0    dave rmdir $MNT
    437   0    dave lofiadm -d $BOOT_ARCHIVE
    438   0    dave  
    439   0    dave cd $PREFIX
    440   0    dave 
    441   0    dave rm -f ${BOOT_ARCHIVE}.gz
    442   0    dave gzip -f $BOOT_ARCHIVE
    443   0    dave mv ${BOOT_ARCHIVE}.gz $BOOT_ARCHIVE
    444   0    dave chmod a+r $BOOT_ARCHIVE
    445   0    dave 
    446   0    dave if [[ "x$1" = "x-nocd" ]]
    447   0    dave then
    448   0    dave     exit 0
    449   0    dave fi
    450   0    dave 
    451   0    dave cd "$BOOTCD_PROTO"
    452   0    dave 
    453   7    dave echo "Generating usr filesystem image"
    454  33    dave if [ -f $LIVEKIT/iso.sort ]; then
    455  33    dave         mkisofs -o solaris -sort $LIVEKIT/iso.sort -N -l -R -U -allow-multidot -no-iso-translate -cache-inodes -d -D -V "compress" usr
    456  33    dave else
    457  33    dave         mkisofs -o solaris -N -l -R -U -allow-multidot -no-iso-translate -cache-inodes -d -D -V "compress" usr
    458  33    dave fi
    459   0    dave rm -rf usr
    460   0    dave 
    461   7    dave echo "Compressing usr filesystem image"
    462  46    dave time $LIVEKIT/packages/clofi/lcompress solaris 65536 2048
    463   0    dave rm solaris
    464   7    dave 
    465  46    dave echo "Generating opt filesystem image"
    466  46    dave mkisofs -o solarisopt -N -l -R -U -allow-multidot -no-iso-translate -cache-inodes -d -D -V "compress" opt
    467  46    dave rm -rf opt
    468   7    dave 
    469  46    dave echo "Compressing opt filesystem image"
    470  46    dave time $LIVEKIT/packages/clofi/lcompress solarisopt 65536 2048
    471  46    dave rm solarisopt
    472   0    dave 
    473  46    dave echo "Generating var/sadm/pkg filesystem image"
    474  46    dave mkisofs -o solarispkg -N -l -R -U -allow-multidot -no-iso-translate -cache-inodes -d -D -V "compress" var/sadm/pkg
    475  46    dave rm -rf var/sadm/pkg/*
    476  46    dave 
    477  46    dave echo "Compressing var/sadm/pkg filesystem image"
    478  46    dave time $LIVEKIT/packages/clofi/lcompress solarispkg 65536 2048
    479  46    dave rm solarispkg
    480  25  dminer 
    481   0    dave cd $PREFIX
    482  11  dminer echo "Making final ISO image"
    483   0    dave rm -f $ISO_FILE
    484   0    dave 
    485   0    dave mkisofs -o $ISO_FILE -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 "$VOLUMEID" "$BOOTCD_PROTO"
    486   0    dave 
    487  11  dminer echo "ISO creation completed at `date`"
    488  11  dminer 
    489  33    dave cd $LIVEKIT
    490  11  dminer 
    491  33    dave # Generate USB image if requested
    492  33    dave [ "$GEN_USB_IMG" = "true" ] && $LIVEKIT/usbgen
    493  11  dminer 
    494   0    dave echo "=== $0 completed at `date`"
    495  33    dave exit 0
    496   0    dave 
    497   2    dave ) 2>&1 | tee $PREFIX/$0.log
    498