12851Sjongkis#!/bin/ksh -p 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 61777Ssetje# Common Development and Distribution License (the "License"). 71777Ssetje# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 220Sstevel@tonic-gate 235822Sjhd# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate# Use is subject to license terms. 250Sstevel@tonic-gate# 261777Ssetje# ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate# utility to pack and unpack a boot/root archive 290Sstevel@tonic-gate# both ufs and hsfs (iso9660) format archives are unpacked 300Sstevel@tonic-gate# only ufs archives are generated 310Sstevel@tonic-gate# 320Sstevel@tonic-gate# usage: pack <archive> <root> 330Sstevel@tonic-gate# unpack <archive> <root> 340Sstevel@tonic-gate# packmedia <solaris_image> <root> 350Sstevel@tonic-gate# unpackmedia <solaris_image> <root> 360Sstevel@tonic-gate# 370Sstevel@tonic-gate# Where <root> is the directory to unpack to and will be cleaned out 380Sstevel@tonic-gate# if it exists. 390Sstevel@tonic-gate# 400Sstevel@tonic-gate# In the case of (un)packmedia, the image is packed or unpacked to/from 410Sstevel@tonic-gate# Solaris media and all the things that don't go into the ramdisk image 420Sstevel@tonic-gate# are (un)cpio'd as well 430Sstevel@tonic-gate# 445648Ssetje# This utility is also used to pack parts (in essence the window system, 455648Ssetje# usr/dt and usr/openwin) of the non ramdisk SPARC 465648Ssetje# miniroot. (un)packmedia will recognize that they are being run a SPARC 475648Ssetje# miniroot and do the appropriate work. 481777Ssetje# 490Sstevel@tonic-gate 500Sstevel@tonic-gateusage() 510Sstevel@tonic-gate{ 520Sstevel@tonic-gate printf "usage: root_archive pack <archive> <root>\n" 530Sstevel@tonic-gate printf " root_archive unpack <archive> <root>\n" 540Sstevel@tonic-gate printf " root_archive packmedia <solaris_image> <root>\n" 550Sstevel@tonic-gate printf " root_archive unpackmedia <solaris_image> <root>\n" 560Sstevel@tonic-gate} 570Sstevel@tonic-gate 582334Ssetjecleanup() 592334Ssetje{ 602334Ssetje if [ -d $MNT ] ; then 612334Ssetje umount $MNT 2> /dev/null 622334Ssetje rmdir $MNT 632334Ssetje fi 642334Ssetje 652851Sjongkis lofiadm -d "$TMR" 2>/dev/null 665648Ssetje if [ "$REALTHING" != true ] ; then 675648Ssetje rm -f "$TMR" 685648Ssetje fi 695648Ssetje rm -f "$TMR.gz" 702334Ssetje} 712334Ssetje 725822Sjhdpreload_Gnome() 734889Ssjelinek{ 744889Ssjelinek MEDIA="$1" 754889Ssjelinek MINIROOT="$2" 764889Ssjelinek 774889Ssjelinek 784889Ssjelinek ( 794889Ssjelinek # Prepopulate the gconf database. This needs to be done and 804889Ssjelinek # done first for several reasons. 1) Archiving out the gnome 814889Ssjelinek # libraries and binaries causes the gconftool-2 to not run 824889Ssjelinek # appropriately at boot time. 2) The binaries and libraries 834889Ssjelinek # needed to run this are big and thus we want to archive 844889Ssjelinek # them separately. 3) Having schemas prepopluated in the 854889Ssjelinek # miniroot means faster boot times. 864889Ssjelinek # 874889Ssjelinek 884889Ssjelinek cd "$MINIROOT" 894889Ssjelinek HOME="./tmp/root" 904889Ssjelinek export HOME 914889Ssjelinek umask 0022 925648Ssetje mumble=.tmp_proto/root/etc/gconf/gconf.xml.defaults 935648Ssetje GCONF_CONFIG_SOURCE="xml:merged:$MINIROOT/$mumble" 944889Ssjelinek export GCONF_CONFIG_SOURCE 954889Ssjelinek SCHEMADIR="$MINIROOT/.tmp_proto/root/etc/gconf/schemas" 964889Ssjelinek export SCHEMADIR 975648Ssetje /usr/bin/gconftool-2 --makefile-install-rule \ 985648Ssetje $SCHEMADIR/*.schemas >/dev/null 2>&1 995571Ssjelinek echo ' 1005571Ssjelinek xml:readwrite:/tmp/root/.gconf 1015571Ssjelinek xml:readonly:/etc/gconf/gconf.xml.defaults 1025571Ssjelinek ' > /"$MINIROOT"/.tmp_proto/root/etc/gconf/2/path 1035822Sjhd ) 1045822Sjhd} 1055571Ssjelinek 1065822Sjhdarchive_Gnome() 1075822Sjhd{ 1085822Sjhd MEDIA="$1" 1095822Sjhd MINIROOT="$2" 1105822Sjhd 1115822Sjhd RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 1125822Sjhd RELEASE=`basename "$RELEASE"` 1135822Sjhd CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 1145822Sjhd 1155822Sjhd # Create the gnome archive 1165822Sjhd # 1175822Sjhd ( 1184889Ssjelinek # usr/share gnome stuff 1194889Ssjelinek cd "$MINIROOT" 1204889Ssjelinek find usr/share/GConf usr/share/application-registry \ 1214889Ssjelinek usr/share/autostart usr/share/dbus-1 usr/share/dtds \ 1224889Ssjelinek usr/share/emacs usr/share/gnome usr/share/gnome-2.0 \ 1234889Ssjelinek usr/share/gnome-background-properties \ 1244889Ssjelinek usr/share/gtk-engines usr/share/gui-install \ 1254889Ssjelinek usr/share/icon-naming-utils usr/share/control-center \ 1264889Ssjelinek usr/share/icons usr/share/locale usr/share/metacity \ 1274889Ssjelinek usr/share/mime usr/share/mime-info usr/share/pixmaps \ 1284889Ssjelinek usr/share/scrollkeeper usr/share/sgml usr/share/themes \ 1294889Ssjelinek usr/share/xml \ 1304889Ssjelinek -print > /tmp/gnome_share.$$ 2>/dev/null 1314889Ssjelinek 1324889Ssjelinek if [ ! -f /tmp/gnome_share.$$ ] ; then 1334889Ssjelinek echo "/tmp/gnome_share.$$ file list not found." 1345648Ssetje return 1354889Ssjelinek fi 1364889Ssjelinek 1374889Ssjelinek # usr/lib gnome stuff 1384889Ssjelinek 1394889Ssjelinek find usr/lib/libgnome*\.so\.* \ 1404889Ssjelinek usr/lib/libgst*\.so\.* usr/lib/libgconf*\.so\.* \ 1414889Ssjelinek usr/lib/libgdk*\.so\.* usr/lib/libgtk*\.so\.* \ 1424889Ssjelinek usr/lib/libglade*\.so\.* usr/lib/libmetacity*\.so\.* \ 1434889Ssjelinek usr/lib/libfontconfig*\.so\.* usr/lib/libgmodule*\.so\.* \ 1444889Ssjelinek usr/lib/libgobject*\.so\.* usr/lib/libgthread*\.so\.* \ 1454889Ssjelinek usr/lib/libpopt*\.so\.* usr/lib/libstartup*\.so\.* \ 1464889Ssjelinek usr/lib/libexif*\.so\.* usr/lib/libtiff*\.so\.* \ 1474889Ssjelinek usr/lib/libdbus*\.so\.* usr/lib/libstartup*\.so\.* \ 1484889Ssjelinek usr/lib/libexif*\.so\.* usr/lib/libORBit*\.so\.* \ 1494889Ssjelinek usr/lib/libmlib*\.so\.* usr/lib/libxsl*\.so\.* \ 1504889Ssjelinek usr/lib/libpango*\.so\.* usr/lib/libpng*\.so\.* \ 1514889Ssjelinek usr/lib/liboil*\.so\.* usr/lib/libbonobo*\.so\.* \ 1524889Ssjelinek usr/lib/libart*\.so\.* usr/lib/libcairo*\.so\.* \ 1534889Ssjelinek usr/lib/libjpeg*\.so\.* \ 1544889Ssjelinek usr/lib/libpolkit*\.so\.* \ 1554889Ssjelinek -print | egrep -v '\.so\.[0]$' > \ 1564889Ssjelinek /tmp/gnome_lib.$$ 2>/dev/null 1574889Ssjelinek 1584889Ssjelinek find usr/lib/nautilus usr/lib/pango usr/lib/iconv \ 1594889Ssjelinek usr/lib/metacity-dialog usr/lib/window-manager-settings \ 1604889Ssjelinek usr/lib/bonobo-2.0 usr/lib/bononbo usr/lib/gtk-2.0 \ 1614889Ssjelinek usr/lib/GConf usr/lib/bonobo-activation-server \ 1624889Ssjelinek usr/lib/python2.4 usr/lib/gstreamer-0.10 \ 1634889Ssjelinek usr/lib/gconf-sanity-check-2 usr/lib/gconfd \ 1644889Ssjelinek usr/lib/gnome-vfs-2.0 usr/lib/dbus-daemon \ 1654889Ssjelinek usr/lib/gnome-vfs-daemon usr/lib/gnome-settings-daemon \ 1664889Ssjelinek usr/lib/gnome_segv2 usr/lib/orbit-2.0 \ 1674889Ssjelinek usr/lib/libmlib \ 1684889Ssjelinek print > /tmp/gnome_libdir.$$ 2>/dev/null 1694889Ssjelinek 1704889Ssjelinek if [ ! -f /tmp/gnome_lib.$$ -a ! -f gnome_libdir.$$ ] ; then 1714889Ssjelinek echo "/tmp/gnome_lib.$$ file list not found." 1724889Ssjelinek return 1734889Ssjelinek fi 1744889Ssjelinek 1754889Ssjelinek # /usr/sfw gnome stuff 1764889Ssjelinek find usr/sfw/bin usr/sfw/include usr/sfw/share usr/sfw/src \ 1774889Ssjelinek -print > /tmp/gnome_sfw.$$ 2>/dev/null 1784889Ssjelinek 1794889Ssjelinek if [ ! -f /tmp/gnome_sfw.$$ ] ; then 1804889Ssjelinek echo "/tmp/gnome_sfw.$$ file list not found." 1814889Ssjelinek return 1824889Ssjelinek fi 1834889Ssjelinek 1844889Ssjelinek # gnome app binaries usr/bin 1854889Ssjelinek find usr/bin/gnome* usr/bin/gui-install usr/bin/bonobo* \ 1864889Ssjelinek usr/bin/gtk-* usr/bin/fax* usr/bin/gdk* usr/bin/gif2tiff \ 1874889Ssjelinek usr/bin/install-lan \ 1884889Ssjelinek usr/bin/metacity* usr/bin/gst-* usr/bin/gconftool-2 \ 1894889Ssjelinek usr/bin/pango* usr/bin/desktop* usr/bin/djpeg \ 1904889Ssjelinek usr/bin/notify-send usr/bin/oil-bugreport \ 1914889Ssjelinek usr/bin/bmp2tiff usr/bin/thembus-theme-applier \ 1924889Ssjelinek usr/bin/thumbnail usr/lib/update-* \ 1934889Ssjelinek usr/bin/ras2tiff usr/bin/raw2tiff usr/bin/rdjpgcom \ 1944889Ssjelinek usr/bin/thumbnail usr/bin/dbus* \ 1954889Ssjelinek usr/bin/tiff* usr/bin/rgb2ycbcr \ 1964889Ssjelinek usr/bin/fc-cache usr/bin/fc-list \ 1974889Ssjelinek -print > /tmp/gnome_bin.$$ 2>/dev/null 1984889Ssjelinek 1994889Ssjelinek if [ ! -f /tmp/gnome_bin.$$ ] ; then 2004889Ssjelinek echo "/tmp/gnome_bin.$$ file list not found." 2015648Ssetje return 2024889Ssjelinek fi 2034889Ssjelinek 2044889Ssjelinek # Cat all the files together and create the gnome archive 2054889Ssjelinek # 2064889Ssjelinek 2074889Ssjelinek cat /tmp/gnome_libdir.$$ /tmp/gnome_lib.$$ \ 2084889Ssjelinek /tmp/gnome_share.$$ /tmp/gnome_sfw.$$ /tmp/gnome_bin.$$ \ 2094889Ssjelinek > /tmp/gnome.$$ 2104889Ssjelinek 2114889Ssjelinek if [ ! -f /tmp/gnome.$$ ] ; then 2124889Ssjelinek echo "/tmp/gnome.$$ file not found." 2134889Ssjelinek return 2144889Ssjelinek fi 2154889Ssjelinek # Save off this file in the miniroot for use later 2164889Ssjelinek # when unpacking. Clean up old cruft if there. 2174889Ssjelinek # 2184889Ssjelinek 2194889Ssjelinek if [ -f .tmp_proto/gnome_saved ]; then 2204889Ssjelinek rm -f .tmp_proto/gnome_saved 2214889Ssjelinek fi 2224889Ssjelinek 2234889Ssjelinek cp /tmp/gnome.$$ .tmp_proto/gnome_saved 2244889Ssjelinek 2254889Ssjelinek # Create gnome archive 2264889Ssjelinek # 2274889Ssjelinek 2284889Ssjelinek cpio -ocmPuB < /tmp/gnome.$$ 2>/dev/null | bzip2 > \ 2294889Ssjelinek "$CPIO_DIR/gnome.cpio.bz2" 2304889Ssjelinek 2315648Ssetje # Remove files from miniroot that are in archive. 2324889Ssjelinek # Create symlinks for files in archive 2334889Ssjelinek 2344889Ssjelinek rm -rf `cat /tmp/gnome_share.$$` 2354889Ssjelinek 2364889Ssjelinek for i in `cat /tmp/gnome_share.$$` 2375648Ssetje do 2384889Ssjelinek ln -s /tmp/root/$i $i 2>/dev/null 2394889Ssjelinek done 2404889Ssjelinek 2414889Ssjelinek rm -rf `cat /tmp/gnome_lib.$$` 2424889Ssjelinek for i in `cat /tmp/gnome_lib.$$` 2434889Ssjelinek do 2444889Ssjelinek ln -s /tmp/root/$i $i 2>/dev/null 2454889Ssjelinek done 2464889Ssjelinek 2474889Ssjelinek rm -rf `cat /tmp/gnome_libdir.$$` 2484889Ssjelinek for i in `cat /tmp/gnome_libdir.$$` 2495648Ssetje do 2504889Ssjelinek ln -s /tmp/root/$i $i 2>/dev/null 2514889Ssjelinek done 2524889Ssjelinek 2534889Ssjelinek rm -rf `cat /tmp/gnome_sfw.$$` 2544889Ssjelinek for i in `cat /tmp/gnome_sfw.$$` 2555648Ssetje do 2564889Ssjelinek ln -s /tmp/root/$i $i 2>/dev/null 2574889Ssjelinek done 2584889Ssjelinek 2594889Ssjelinek rm -rf `cat /tmp/gnome_bin.$$` 2604889Ssjelinek for i in `cat /tmp/gnome_bin.$$` 2615648Ssetje do 2624889Ssjelinek ln -s /tmp/root/$i $i 2>/dev/null 2634889Ssjelinek done 2644889Ssjelinek rm -f /tmp/gnome_share.$$ 2654889Ssjelinek rm -f /tmp/gnome_lib.$$ 2664889Ssjelinek rm -f /tmp/gnome_libdir.$$ 2674889Ssjelinek rm -f /tmp/gnome_bin.$$ 2684889Ssjelinek ) 2694889Ssjelinek} 2704889Ssjelinek 2714889Ssjelinekarchive_JavaGUI() 2724889Ssjelinek{ 2734889Ssjelinek MEDIA="$1" 2744889Ssjelinek MINIROOT="$2" 2754889Ssjelinek 2764889Ssjelinek RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 2774889Ssjelinek RELEASE=`basename "$RELEASE"` 2784889Ssjelinek 2795648Ssetje CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 2804889Ssjelinek 2814889Ssjelinek # Archive the java wizard components that are only used in the 2824889Ssjelinek # non developer express path. 2834889Ssjelinek # 2844889Ssjelinek ( 2854889Ssjelinek # path is usr/lib/install/data 2864889Ssjelinek cd "$MINIROOT" 2874889Ssjelinek find usr/lib/install/data/wizards \ 2884889Ssjelinek -print > /tmp/java_ui.$$ 2>/dev/null 2894889Ssjelinek 2904889Ssjelinek if [ ! -f /tmp/java_ui.$$ ] ; then 2914889Ssjelinek echo "/tmp/java_ui.$$ file list not found." 2925648Ssetje return 2934889Ssjelinek fi 2944889Ssjelinek 2954889Ssjelinek cpio -ocmPuB < /tmp/java_ui.$$ 2>/dev/null | bzip2 > \ 2964889Ssjelinek "$CPIO_DIR/javaui.cpio.bz2" 2974889Ssjelinek 2984889Ssjelinek rm -rf `cat /tmp/java_ui.$$` 2995648Ssetje ln -s /tmp/root/usr/lib/install/data/wizards \ 3005648Ssetje usr/lib/install/data/wizards 2>/dev/null 3014889Ssjelinek 3024889Ssjelinek rm -f /tmp/java_ui.$$ 3034889Ssjelinek 3044889Ssjelinek ) 3054889Ssjelinek} 3064889Ssjelinek 3074889Ssjelinekarchive_Misc() 3084889Ssjelinek{ 3094889Ssjelinek MEDIA="$1" 3104889Ssjelinek MINIROOT="$2" 3114889Ssjelinek 3124889Ssjelinek RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 3134889Ssjelinek RELEASE=`basename "$RELEASE"` 3144889Ssjelinek 3155648Ssetje CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 3164889Ssjelinek 3174889Ssjelinek # Archive misc stuff that is needed by non devex installer 3184889Ssjelinek # 3194889Ssjelinek ( 3204889Ssjelinek # usr/lib stuff 3214889Ssjelinek cd "$MINIROOT" 3224889Ssjelinek find usr/lib/lp -print > /tmp/lp.$$ 2>/dev/null 3234889Ssjelinek if [ ! -f /tmp/lp.$$ ] ; then 3244889Ssjelinek echo "/tmp/lp.$$ file list not found." 3255648Ssetje return 3264889Ssjelinek fi 3274889Ssjelinek 3284889Ssjelinek cpio -ocmPuB < /tmp/lp.$$ 2>/dev/null | bzip2 > \ 3294889Ssjelinek "$CPIO_DIR/lpmisc.cpio.bz2" 3304889Ssjelinek 3314889Ssjelinek rm -rf `cat /tmp/lp.$$` 3324889Ssjelinek ln -s /tmp/root/usr/lib/lp usr/lib/lp 2>/dev/null 3334889Ssjelinek 3344889Ssjelinek rm -f /tmp/lp.$$ 3354889Ssjelinek ) 3364889Ssjelinek 3374889Ssjelinek} 3384889Ssjelinek 3394889Ssjelinekarchive_Perl() 3404889Ssjelinek{ 3414889Ssjelinek MEDIA="$1" 3424889Ssjelinek MINIROOT="$2" 3434889Ssjelinek 3444889Ssjelinek RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 3454889Ssjelinek RELEASE=`basename "$RELEASE"` 3464889Ssjelinek 3475648Ssetje CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 3484889Ssjelinek 3494889Ssjelinek # Archive perl, it is only needed by gnome gui. 3504889Ssjelinek # 3514889Ssjelinek ( 3524889Ssjelinek # in usr 3534889Ssjelinek cd "$MINIROOT" 3544889Ssjelinek find usr/perl5 -print > /tmp/perl.$$ 2>/dev/null 3554889Ssjelinek 3564889Ssjelinek if [ ! -f /tmp/perl.$$ ] ; then 3574889Ssjelinek echo "/tmp/perl.$$ file list not found." 3585648Ssetje return 3594889Ssjelinek fi 3604889Ssjelinek cpio -ocmPuB < /tmp/perl.$$ 2>/dev/null | bzip2 > \ 3614889Ssjelinek "$CPIO_DIR/perl.cpio.bz2" 3624889Ssjelinek 3634889Ssjelinek rm -rf `cat /tmp/perl.$$` 2>/dev/null 3645571Ssjelinek ln -s /tmp/root/usr/perl5 usr/perl5 2>/dev/null 3654889Ssjelinek 3664889Ssjelinek rm -f /tmp/perl.$$ 3674889Ssjelinek ) 3684889Ssjelinek} 3691777Ssetjearchive_X() 3700Sstevel@tonic-gate{ 3711777Ssetje MEDIA="$1" 3721777Ssetje MINIROOT="$2" 3730Sstevel@tonic-gate 3741777Ssetje RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 3751777Ssetje RELEASE=`basename "$RELEASE"` 3760Sstevel@tonic-gate 3775648Ssetje CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 3780Sstevel@tonic-gate 3790Sstevel@tonic-gate # create the graphics and non-graphics X archive 3800Sstevel@tonic-gate # 3812851Sjongkis ( 3824889Ssjelinek cd "$MINIROOT" 3834889Ssjelinek find usr/openwin usr/dt usr/X11 -print 2> /dev/null |\ 3842851Sjongkis cpio -ocmPuB 2> /dev/null | bzip2 > "$CPIO_DIR/X.cpio.bz2" 3850Sstevel@tonic-gate 3864889Ssjelinek find usr/openwin/bin/mkfontdir \ 3874889Ssjelinek usr/openwin/lib/installalias \ 3884889Ssjelinek usr/openwin/server/lib/libfont.so.1 \ 3894889Ssjelinek usr/openwin/server/lib/libtypesclr.so.0 \ 3902851Sjongkis -print | cpio -ocmPuB 2> /dev/null | bzip2 > \ 3912851Sjongkis "$CPIO_DIR/X_small.cpio.bz2" 3920Sstevel@tonic-gate 3934889Ssjelinek rm -rf usr/dt usr/openwin usr/X11 3944889Ssjelinek ln -s /tmp/root/usr/dt usr/dt 3954889Ssjelinek ln -s /tmp/root/usr/openwin usr/openwin 3964889Ssjelinek ln -s /tmp/root/usr/X11 usr/X11 3972851Sjongkis ) 3981777Ssetje} 3991777Ssetje 4005648Ssetjearchive_lu() 4015648Ssetje{ 4025648Ssetje MEDIA="$1" 4035648Ssetje MINIROOT="$2" 4045648Ssetje 4055648Ssetje RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 4065648Ssetje RELEASE=`basename "$RELEASE"` 4075648Ssetje 4085648Ssetje CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 4095648Ssetje 4105648Ssetje ( 4115648Ssetje cd "$MINIROOT" 4125648Ssetje find usr/lib/install usr/snadm usr/sbin | \ 4135648Ssetje cpio -ocmPuB 2> /dev/null | bzip2 > "$CPIO_DIR"/lu.cpio.bz2 4145648Ssetje ls platform > "$CPIO_DIR/lu.platforms" 4155648Ssetje ) 4165648Ssetje} 4175648Ssetje 4181777Ssetjepackmedia() 4191777Ssetje{ 4201777Ssetje MEDIA="$1" 4211777Ssetje MINIROOT="$2" 4221777Ssetje 4231777Ssetje RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 4241777Ssetje RELEASE=`basename "$RELEASE"` 4255822Sjhd ARCHIVES="X X_small perl lpmisc javaui gnome" 4261777Ssetje 4271777Ssetje mkdir -p "$MEDIA/$RELEASE/Tools/Boot" 4285648Ssetje 4295648Ssetje if [ -d "$MINIROOT/platform/i86pc" ] ; then 4305648Ssetje mkdir -p "$MEDIA/boot/amd64" 4315648Ssetje mkdir -p "$MEDIA/boot/platform/i86pc/kernel" 4325648Ssetje mkdir -p "$MEDIA/boot/platform/i86pc/kernel/amd64" 4335648Ssetje mkdir -p "$MEDIA/boot/platform/i86xpv/kernel" 4345648Ssetje mkdir -p "$MEDIA/boot/platform/i86xpv/kernel/amd64" 4355648Ssetje cp "$MINIROOT/platform/i86pc/multiboot" "$MEDIA/boot" 4365648Ssetje cp "$MINIROOT/platform/i86pc/kernel/unix" \ 4375648Ssetje "$MEDIA/boot/platform/i86pc/kernel/unix" 4385648Ssetje cp "$MINIROOT/platform/i86pc/kernel/amd64/unix" \ 4395648Ssetje "$MEDIA/boot/platform/i86pc/kernel/amd64/unix" 4405648Ssetje cp "$MINIROOT/platform/i86xpv/kernel/unix" \ 4415648Ssetje "$MEDIA/boot/platform/i86xpv/kernel/unix" 4425648Ssetje cp "$MINIROOT/platform/i86xpv/kernel/amd64/unix" \ 4435648Ssetje "$MEDIA/boot/platform/i86xpv/kernel/amd64/unix" 4445648Ssetje ( 4455648Ssetje cd "$MEDIA/$RELEASE/Tools/Boot" 4465648Ssetje ln -sf ../../../boot/x86.miniroot 4475648Ssetje ln -sf ../../../boot/multiboot 4485648Ssetje ln -sf ../../../boot/platform/i86pc/kernel/unix 4495648Ssetje ln -sf ../../../boot/platform/i86pc/kernel/amd64/unix 4505648Ssetje ln -sf ../../../boot/platform/i86xpv/kernel/unix 4515648Ssetje ln -sf ../../../boot/platform/i86xpv/kernel/amd64/unix 4525648Ssetje ln -sf ../../../boot/grub/pxegrub 4535648Ssetje ) 4545648Ssetje fi 4555648Ssetje 4565648Ssetje if [ -d "$MINIROOT/platform/sun4u" ] ; then 4575648Ssetje mkdir -p "$MEDIA/boot" 4586319Sjg dd if="$MINIROOT/platform/sun4u/lib/fs/hsfs/bootblk" \ 4595648Ssetje of="$MEDIA/boot/hsfs.bootblock" \ 4605648Ssetje bs=1b oseek=1 count=15 conv=sync 2> /dev/null 4615648Ssetje fi 4625648Ssetje 4635648Ssetje for arch in sun4u sun4v ; do 4645648Ssetje if [ -d "$MINIROOT/platform/$arch" ] ; then 4655648Ssetje archdir="$MEDIA/$RELEASE/Tools/Boot/platform/$arch" 4665648Ssetje mkdir -p $archdir 4675648Ssetje ln -sf ../../../../../boot/sparc.miniroot \ 4685648Ssetje "$archdir/boot_archive" 4695648Ssetje cp "$MINIROOT/usr/platform/$arch/lib/fs/nfs/inetboot" \ 4705648Ssetje "$archdir" 4715648Ssetje cp "$MINIROOT/platform/$arch/wanboot" \ 4725648Ssetje "$archdir" 4735648Ssetje mkdir -p "$MEDIA/platform/$arch" 4745648Ssetje ln -sf ../../boot/sparc.miniroot \ 4755648Ssetje "$MEDIA/platform/$arch/boot_archive" 4765648Ssetje fi 4775648Ssetje done 4781777Ssetje 4791777Ssetje # archive package databases to conserve memory 4801777Ssetje # 4812851Sjongkis ( 4822851Sjongkis cd "$MINIROOT" 4832851Sjongkis find tmp/root/var/sadm/install tmp/root/var/sadm/pkg -print | \ 4842851Sjongkis cpio -ocmPuB 2> /dev/null | bzip2 > \ 4852851Sjongkis "$MEDIA/$RELEASE/Tools/Boot/pkg_db.cpio.bz2" 4862851Sjongkis ) 4871777Ssetje rm -rf "$MINIROOT/tmp/root/var/sadm/install" 4881777Ssetje rm -rf "$MINIROOT/tmp/root/var/sadm/pkg" 4891777Ssetje 4905648Ssetje if [ -d "$MINIROOT/kernel/drv/sparcv9" ] ; then 4915648Ssetje archive_lu "$MEDIA" "$MINIROOT" 4925648Ssetje fi 4935648Ssetje 4942595Ssetje archive_X "$MEDIA" "$MINIROOT" 4952595Ssetje 4964889Ssjelinek # Take out the gnome and java parts of the installer from 4974889Ssjelinek # the miniroot. These are not required to boot the system 4984889Ssjelinek # and start the installers. 4994889Ssjelinek 5005648Ssetje if [ -d "$MINIROOT/platform/i86pc" ] ; then 5015822Sjhd preload_Gnome "$MEDIA" "$MINIROOT" 5025648Ssetje archive_Gnome "$MEDIA" "$MINIROOT" 5035648Ssetje archive_JavaGUI "$MEDIA" "$MINIROOT" 5045648Ssetje archive_Misc "$MEDIA" "$MINIROOT" 5055648Ssetje archive_Perl "$MEDIA" "$MINIROOT" 5065822Sjhd MR="$MEDIA/boot/amd64/x86.miniroot" 5075822Sjhd pack 5085822Sjhd 5095822Sjhd # Now that the 64-bit archives & miniroot have been created, 5105822Sjhd # restore the files from archives and save the 64-bit 5115822Sjhd # archives. Strip the 64-bit objects and create the 5125822Sjhd # 32-bit archives and miniroot 5135822Sjhd 5145822Sjhd unpackmedia "$MEDIA" "$MINIROOT" 5155822Sjhd mkdir -p "$MEDIA/$RELEASE/Tools/Boot/amd64" 5165822Sjhd for i in $ARCHIVES; do 5175822Sjhd mv "$MEDIA/$RELEASE/Tools/Boot/${i}.cpio.bz2" \ 5185822Sjhd "$MEDIA/$RELEASE/Tools/Boot/amd64" 5195822Sjhd done 5205822Sjhd if [ -z "$STRIP_AMD64" ]; then 5215822Sjhd strip_amd64 5225822Sjhd fi 5235822Sjhd 5245822Sjhd archive_X "$MEDIA" "$MINIROOT" 5255822Sjhd archive_Gnome "$MEDIA" "$MINIROOT" 5265822Sjhd archive_JavaGUI "$MEDIA" "$MINIROOT" 5275822Sjhd archive_Perl "$MEDIA" "$MINIROOT" 5285822Sjhd archive_Misc "$MEDIA" "$MINIROOT" 5295822Sjhd MR="$MEDIA/boot/x86.miniroot" 5305648Ssetje fi 5310Sstevel@tonic-gate 5321821Ssetje # copy the install menu to menu.lst so we have a menu 5331821Ssetje # on the install media 5341821Ssetje # 5355648Ssetje if [ -f "$MINIROOT/boot/grub/install_menu" ] ; then 5365648Ssetje cp $MINIROOT/boot/grub/install_menu \ 5375648Ssetje $MEDIA/boot/grub/menu.lst 5381821Ssetje fi 539*7204Sjg 540*7204Sjg # 541*7204Sjg # jumpstart utilities in usr/sbin/install.d 542*7204Sjg # 543*7204Sjg if [ -d "$MINIROOT/usr/sbin/install.d" ] ; then 544*7204Sjg ( 545*7204Sjg cd ${MINIROOT} 546*7204Sjg find usr/sbin/install.d/chkprobe \ 547*7204Sjg -print | cpio -ocmPuB 2> /dev/null | bzip2 > \ 548*7204Sjg ${MEDIA}/${RELEASE}/Tools/Boot/usr_sbin_install_d.cpio.bz2 549*7204Sjg ) 550*7204Sjg fi 5511777Ssetje} 5520Sstevel@tonic-gate 5531777Ssetjeunarchive_X() 5541777Ssetje{ 5551777Ssetje MEDIA="$1" 5561777Ssetje UNPACKED_ROOT="$2" 5571777Ssetje 5581777Ssetje RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 5591777Ssetje RELEASE=`basename "$RELEASE"` 5601777Ssetje 5615648Ssetje CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot" 5621777Ssetje 5631777Ssetje # unpack X 5641777Ssetje # 5652851Sjongkis ( 5664889Ssjelinek cd "$UNPACKED_ROOT" 5674889Ssjelinek rm -rf usr/dt usr/openwin usr/X11 5682851Sjongkis bzcat "$CPIO_DIR/X.cpio.bz2" | cpio -icdmu 2> /dev/null 5692851Sjongkis ) 5700Sstevel@tonic-gate} 5710Sstevel@tonic-gate 5720Sstevel@tonic-gateunpackmedia() 5731777Ssetje{ 5741777Ssetje MEDIA="$1" 5751777Ssetje UNPACKED_ROOT="$2" 5760Sstevel@tonic-gate 5771777Ssetje RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*` 5781777Ssetje RELEASE=`basename "$RELEASE"` 5791777Ssetje 5801777Ssetje unarchive_X "$MEDIA" "$UNPACKED_ROOT" 5810Sstevel@tonic-gate 5820Sstevel@tonic-gate # unpack package databases 5830Sstevel@tonic-gate # 5842851Sjongkis ( 5852851Sjongkis cd "$UNPACKED_ROOT" 5862851Sjongkis bzcat "$MEDIA/$RELEASE/Tools/Boot/pkg_db.cpio.bz2" | 5872851Sjongkis cpio -icdmu 2> /dev/null 5884889Ssjelinek 5894889Ssjelinek # unpack gnome, perl, java and misc 5904889Ssjelinek # Remove symlinks left from unpacking x86.miniroot so that 5914889Ssjelinek # unpacking subsequent archives will populate appropriately. 5924889Ssjelinek # 5934889Ssjelinek rm -rf usr/perl5 5944889Ssjelinek rm -rf usr/lib/install/data/wizards 5954889Ssjelinek rm -rf usr/lib/lp 5964889Ssjelinek 5974889Ssjelinek # Gnome list saved off from packmedia 5984889Ssjelinek for i in `cat .tmp_proto/gnome_saved` 5995648Ssetje do 6004889Ssjelinek rm -rf $i 6014889Ssjelinek done 6024889Ssjelinek 6034889Ssjelinek bzcat "$MEDIA/$RELEASE/Tools/Boot/gnome.cpio.bz2" | 6044889Ssjelinek cpio -icdmu 2>/dev/null 6054889Ssjelinek bzcat "$MEDIA/$RELEASE/Tools/Boot/javaui.cpio.bz2" | 6064889Ssjelinek cpio -icdmu 2>/dev/null 6074889Ssjelinek bzcat "$MEDIA/$RELEASE/Tools/Boot/lpmisc.cpio.bz2" | 6084889Ssjelinek cpio -icdmu 2>/dev/null 6094889Ssjelinek bzcat "$MEDIA/$RELEASE/Tools/Boot/perl.cpio.bz2" | 6104889Ssjelinek cpio -icdmu 2>/dev/null 6112851Sjongkis ) 6120Sstevel@tonic-gate} 6130Sstevel@tonic-gate 6140Sstevel@tonic-gatedo_unpack() 6150Sstevel@tonic-gate{ 6161777Ssetje rm -rf "$UNPACKED_ROOT" 6171777Ssetje mkdir -p "$UNPACKED_ROOT" 6182851Sjongkis ( 6192851Sjongkis cd $MNT 6202851Sjongkis find . -print | cpio -pdum "$UNPACKED_ROOT" 2> /dev/null 6212851Sjongkis ) 6220Sstevel@tonic-gate umount $MNT 6230Sstevel@tonic-gate} 6240Sstevel@tonic-gate 6250Sstevel@tonic-gateunpack() 6260Sstevel@tonic-gate{ 6270Sstevel@tonic-gate 6281777Ssetje if [ ! -f "$MR" ] ; then 6290Sstevel@tonic-gate usage 6300Sstevel@tonic-gate exit 1 6310Sstevel@tonic-gate fi 6320Sstevel@tonic-gate 6335648Ssetje if [ `basename $MR` = x86.miniroot ] ; then 6345648Ssetje gzcat "$MR" > $TMR 6355648Ssetje else 6365648Ssetje REALTHING=true ; export REALTHING 6375648Ssetje TMR="$MR" 6385648Ssetje fi 6390Sstevel@tonic-gate 6402334Ssetje LOFIDEV=`/usr/sbin/lofiadm -a $TMR` 6410Sstevel@tonic-gate if [ $? != 0 ] ; then 6420Sstevel@tonic-gate echo lofi plumb failed 6430Sstevel@tonic-gate exit 2 6440Sstevel@tonic-gate fi 6450Sstevel@tonic-gate 6461777Ssetje mkdir -p $MNT 6470Sstevel@tonic-gate 6482334Ssetje FSTYP=`fstyp $LOFIDEV` 6490Sstevel@tonic-gate 6501777Ssetje if [ "$FSTYP" = ufs ] ; then 6512334Ssetje /usr/sbin/mount -o ro,nologging $LOFIDEV $MNT 6520Sstevel@tonic-gate do_unpack 6531777Ssetje elif [ "$FSTYP" = hsfs ] ; then 6542334Ssetje /usr/sbin/mount -F hsfs -o ro $LOFIDEV $MNT 6550Sstevel@tonic-gate do_unpack 6560Sstevel@tonic-gate else 6570Sstevel@tonic-gate printf "invalid root archive\n" 6580Sstevel@tonic-gate fi 6590Sstevel@tonic-gate 6605648Ssetje 6610Sstevel@tonic-gate rmdir $MNT 6622851Sjongkis lofiadm -d $TMR ; LOFIDEV= 6635648Ssetje if [ "$REALTHING" != true ] ; then 6645648Ssetje rm $TMR 6655648Ssetje fi 6665648Ssetje} 6675648Ssetje 6685648Ssetjecompress() 6695648Ssetje{ 6705648Ssetje SRC=$1 6715648Ssetje DST=$2 6725648Ssetje 6735648Ssetje ( 6745648Ssetje cd $SRC 6755648Ssetje filelist=`find .` 6765648Ssetje 6775648Ssetje for file in $filelist ; do 6785648Ssetje 6795648Ssetje file=`echo $file | sed s#^./##` 6805648Ssetje 6815648Ssetje # copy all files over to preserve hard links 6825648Ssetje # 6835648Ssetje echo $file | cpio -pdum $DST 2> /dev/null 6845648Ssetje 6855648Ssetje if [ -f $file ] && [ -s $file ] && [ ! -h $file ] ; then 6865648Ssetje fiocompress -mc $file $DST/$file & 6875648Ssetje fi 6885648Ssetje 6895648Ssetje done 6905648Ssetje 6915648Ssetje # now re-copy a couple of uncompressed files 6925648Ssetje # 6935648Ssetje 6945648Ssetje find kernel platform -name unix | cpio -pdum $DST 2> /dev/null 6955648Ssetje find kernel platform -name genunix | cpio -pdum $DST \ 6965648Ssetje 2> /dev/null 6975648Ssetje find kernel platform -name platmod | cpio -pdum $DST \ 6985648Ssetje 2> /dev/null 6995648Ssetje find `find kernel platform -name cpu` | cpio -pdum $DST \ 7005648Ssetje 2> /dev/null 7015648Ssetje find `find kernel platform -name kmdb\*` | cpio -pdum $DST \ 7025648Ssetje 2> /dev/null 7035648Ssetje find kernel/misc/sparcv9/ctf kernel/fs/sparcv9/dcfs \ 7045648Ssetje etc/system etc/name_to_major etc/path_to_inst \ 7055648Ssetje etc/name_to_sysnum | cpio -pdum $DST 2> /dev/null 7065648Ssetje ) 7075648Ssetje} 7085648Ssetje 7095648Ssetjeroot_is_ramdisk() 7105648Ssetje{ 7115648Ssetje grep -v "set root_is_ramdisk=" "$UNPACKED_ROOT"/etc/system | \ 7125648Ssetje grep -v "set ramdisk_size=" > /tmp/system.$$ 7135648Ssetje cat /tmp/system.$$ > "$UNPACKED_ROOT"/etc/system 7145648Ssetje rm /tmp/system.$$ 7155648Ssetje 7165648Ssetje echo set root_is_ramdisk=1 >> "$UNPACKED_ROOT"/etc/system 7175648Ssetje echo set ramdisk_size=$1 >> "$UNPACKED_ROOT"/etc/system 7180Sstevel@tonic-gate} 7190Sstevel@tonic-gate 7200Sstevel@tonic-gatepack() 7210Sstevel@tonic-gate{ 7221777Ssetje if [ ! -d "$UNPACKED_ROOT" -o -z "$MR" ] ; then 7230Sstevel@tonic-gate usage 7240Sstevel@tonic-gate exit 1 7250Sstevel@tonic-gate fi 7260Sstevel@tonic-gate 7275648Ssetje # always compress on sparc if fiocompress exists 7285648Ssetje # 7295648Ssetje if [ -d "$UNPACKED_ROOT/kernel/drv/sparcv9" ] && \ 7305648Ssetje [ -x /usr/sbin/fiocompress ] ; then 7315648Ssetje COMPRESS=true 7325648Ssetje fi 7335648Ssetje 7342511Sjongkis # Estimate image size and add %10 overhead for ufs stuff. 7352511Sjongkis # Note, we can't use du here in case $UNPACKED_ROOT is on a filesystem, 7362511Sjongkis # e.g. zfs, in which the disk usage is less than the sum of the file 7375648Ssetje # sizes. The nawk code 7382511Sjongkis # 7392511Sjongkis # {t += ($7 % 1024) ? (int($7 / 1024) + 1) * 1024 : $7} 7402511Sjongkis # 7412511Sjongkis # below rounds up the size of a file/directory, in bytes, to the 7422511Sjongkis # next multiple of 1024. This mimics the behavior of ufs especially 7432511Sjongkis # with directories. This results in a total size that's slightly 7442511Sjongkis # bigger than if du was called on a ufs directory. 7455648Ssetje # 7465648Ssetje # if the operation in turn is compressing the files the amount 7475648Ssetje # of typical shrinkage is used to come up with a useful archive 7485648Ssetje # size 7492511Sjongkis size=$(find "$UNPACKED_ROOT" -ls | nawk ' 7502511Sjongkis {t += ($7 % 1024) ? (int($7 / 1024) + 1) * 1024 : $7} 7512511Sjongkis END {print int(t * 1.10 / 1024)}') 7525648Ssetje if [ "$COMPRESS" = true ] ; then 7535648Ssetje size=`echo $size | nawk '{s = $1} END {print int(s * .53)}'` 7545648Ssetje fi 7550Sstevel@tonic-gate 7562334Ssetje /usr/sbin/mkfile ${size}k "$TMR" 7572334Ssetje 7582334Ssetje LOFIDEV=`/usr/sbin/lofiadm -a "$TMR"` 7590Sstevel@tonic-gate if [ $? != 0 ] ; then 7600Sstevel@tonic-gate echo lofi plumb failed 7610Sstevel@tonic-gate exit 2 7620Sstevel@tonic-gate fi 7630Sstevel@tonic-gate 7642334Ssetje RLOFIDEV=`echo $LOFIDEV | sed s/lofi/rlofi/` 7655648Ssetje newfs $RLOFIDEV < /dev/null 2> /dev/null 7661777Ssetje mkdir -p $MNT 7675648Ssetje mount -o nologging $LOFIDEV $MNT 7681777Ssetje rmdir $MNT/lost+found 7695648Ssetje 7705648Ssetje if [ -d "$UNPACKED_ROOT/kernel/drv/sparcv9" ] ; then 7715648Ssetje root_is_ramdisk $size 7725648Ssetje fi 7735648Ssetje 7742851Sjongkis ( 7752851Sjongkis cd "$UNPACKED_ROOT" 7765648Ssetje if [ "$COMPRESS" = true ] ; then 7775648Ssetje compress . $MNT 7785648Ssetje else 7795648Ssetje find . -print | cpio -pdum $MNT 2> /dev/null 7805648Ssetje fi 7812851Sjongkis ) 7820Sstevel@tonic-gate lockfs -f $MNT 7830Sstevel@tonic-gate umount $MNT 7840Sstevel@tonic-gate rmdir $MNT 7855648Ssetje 7865648Ssetje if [ -d "$UNPACKED_ROOT/kernel/drv/sparcv9" ] ; then 7875648Ssetje "$UNPACKED_ROOT/usr/sbin/installboot" \ 7886319Sjg "$UNPACKED_ROOT/platform/sun4u/lib/fs/ufs/bootblk" \ 7895648Ssetje $RLOFIDEV 7905648Ssetje fi 7915648Ssetje 7922334Ssetje lofiadm -d $LOFIDEV 7932851Sjongkis LOFIDEV= 7940Sstevel@tonic-gate 7952334Ssetje rm -f "$TMR.gz" 7965648Ssetje 7975648Ssetje if [ -d "$UNPACKED_ROOT/kernel/drv/sparcv9" ] ; then 7985648Ssetje mv "$TMR" "$MR" 7995648Ssetje else 8005648Ssetje gzip -f "$TMR" 8015648Ssetje mv "$TMR.gz" "$MR" 8025648Ssetje fi 8035648Ssetje 8041777Ssetje chmod a+r "$MR" 8050Sstevel@tonic-gate} 8060Sstevel@tonic-gate 8075716Ssetjestrip_amd64() 8085716Ssetje{ 8095716Ssetje find "$UNPACKED_ROOT" -name amd64 -type directory | xargs rm -rf 8105716Ssetje} 8115716Ssetje 8120Sstevel@tonic-gate# main 8130Sstevel@tonic-gate# 8140Sstevel@tonic-gate 8152334SsetjeEXTRA_SPACE=0 8162851SjongkisSTRIP_AMD64= 8175648SsetjeCOMPRESS= 8182334Ssetje 8195648SsetjePATH=/usr/sbin:/usr/bin:/opt/sfw/bin ; export PATH 8205648Ssetje 8215648Ssetjewhile getopts s:6c opt ; do 8222334Ssetje case $opt in 8232334Ssetje s) EXTRA_SPACE="$OPTARG" 8242334Ssetje ;; 8252334Ssetje 6) STRIP_AMD64=false 8262334Ssetje ;; 8275648Ssetje c) COMPRESS=true 8285648Ssetje ;; 8292334Ssetje *) usage 8302334Ssetje exit 1 8312334Ssetje ;; 8322334Ssetje esac 8332334Ssetjedone 8342334Ssetjeshift `expr $OPTIND - 1` 8352334Ssetje 8360Sstevel@tonic-gateif [ $# != 3 ] ; then 8370Sstevel@tonic-gate usage 8380Sstevel@tonic-gate exit 1 8390Sstevel@tonic-gatefi 8400Sstevel@tonic-gate 8411777SsetjeUNPACKED_ROOT="$3" 8421777SsetjeBASE="`pwd`" 8430Sstevel@tonic-gateMNT=/tmp/mnt$$ 8442334SsetjeTMR=/tmp/mr$$ 8452334SsetjeLOFIDEV= 8461777SsetjeMR="$2" 8470Sstevel@tonic-gate 8480Sstevel@tonic-gateif [ "`dirname $MR`" = . ] ; then 8491777Ssetje MR="$BASE/$MR" 8500Sstevel@tonic-gatefi 8510Sstevel@tonic-gateif [ "`dirname $UNPACKED_ROOT`" = . ] ; then 8521777Ssetje UNPACKED_ROOT="$BASE/$UNPACKED_ROOT" 8530Sstevel@tonic-gatefi 8540Sstevel@tonic-gate 8555648Ssetje 8565648SsetjeMEDIA="$MR" 8575648Ssetje 8582334Ssetjetrap cleanup EXIT 8592334Ssetje 8600Sstevel@tonic-gatecase $1 in 8610Sstevel@tonic-gate packmedia) 8621777Ssetje if [ -d "$UNPACKED_ROOT/kernel/drv/sparcv9" ] ; then 8635648Ssetje ARCHIVE=sparc.miniroot 8645648Ssetje else 8655822Sjhd ARCHIVE=x86.miniroot 8665648Ssetje fi 8675716Ssetje MR="$MEDIA/boot/$ARCHIVE" 8685716Ssetje 8695648Ssetje packmedia "$MEDIA" "$UNPACKED_ROOT" 8705648Ssetje pack 8715716Ssetje 8725648Ssetje ;; 8735648Ssetje unpackmedia) 8745648Ssetje if [ -f "$MEDIA/boot/sparc.miniroot" ] ; then 8755648Ssetje ARCHIVE=sparc.miniroot 8761777Ssetje else 8775648Ssetje ARCHIVE=x86.miniroot 8785648Ssetje fi 8795716Ssetje MR="$MEDIA/boot/$ARCHIVE" 8805648Ssetje unpack 8815648Ssetje unpackmedia "$MEDIA" "$UNPACKED_ROOT" 8825648Ssetje ;; 8835648Ssetje pack) pack 8845648Ssetje ;; 8855648Ssetje unpack) unpack 8865648Ssetje ;; 8875648Ssetje *) usage 8885648Ssetje ;; 8890Sstevel@tonic-gateesac 890