Print this page
2675 EOF itutools

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/boot/scripts/root_archive.ksh
          +++ new/usr/src/cmd/boot/scripts/root_archive.ksh
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  # Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24  # Use is subject to license terms.
  25   25  #
       26 +# Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  26   27  
  27   28  # utility to pack and unpack a boot/root archive
  28   29  # both ufs and hsfs (iso9660) format archives are unpacked
  29   30  # only ufs archives are generated
  30   31  #
  31   32  # usage: pack   <archive> <root>
  32   33  #        unpack <archive> <root>
  33      -#        packmedia   <solaris_image> <root>
  34      -#        unpackmedia <solaris_image> <root>
  35   34  #
  36   35  #   Where <root> is the directory to unpack to and will be cleaned out
  37   36  #   if it exists.
  38   37  #
  39      -#   In the case of (un)packmedia, the image is packed or unpacked to/from
  40      -#   Solaris media and all the things that don't go into the ramdisk image
  41      -#   are (un)cpio'd as well
  42      -#
  43   38  
  44   39  usage()
  45   40  {
  46   41          printf "usage: root_archive pack <archive> <root>\n"
  47   42          printf "       root_archive unpack <archive> <root>\n"
  48      -        printf "       root_archive packmedia   <solaris_image> <root>\n"
  49      -        printf "       root_archive unpackmedia <solaris_image> <root>\n"
  50   43          exit 1
  51   44  }
  52   45  
  53   46  cleanup()
  54   47  {
  55   48          if [ -d $MNT ] ; then
  56   49                  umount $MNT 2> /dev/null
  57   50                  rmdir $MNT
  58   51          fi
  59   52  
  60   53          lofiadm -d "$TMR" 2>/dev/null
  61   54          if [ "$REALTHING" != true ] ; then
  62   55                  rm -f "$TMR"
  63   56          fi
  64   57          rm -f "$TMR.gz"
  65   58          rm -f /tmp/flist$$
  66   59  }
  67   60  
  68      -preload_Gnome()
  69      -{
  70      -        MEDIA="$1"
  71      -        MINIROOT="$2"
  72      -
  73      -        
  74      -        (
  75      -                # Prepopulate the gconf database. This needs to be done and
  76      -                # done first for several reasons. 1) Archiving out the gnome
  77      -                # libraries and binaries causes the gconftool-2 to not run
  78      -                # appropriately at boot time. 2) The binaries and libraries
  79      -                # needed to run this are big and thus we want to archive
  80      -                # them separately. 3) Having schemas prepopluated in the
  81      -                # miniroot means faster boot times.
  82      -                #
  83      -
  84      -                cd "$MINIROOT"
  85      -                HOME="./tmp/root"
  86      -                export HOME
  87      -                umask 0022
  88      -                mumble=.tmp_proto/root/etc/gconf/gconf.xml.defaults
  89      -                GCONF_CONFIG_SOURCE="xml:merged:$MINIROOT/$mumble"
  90      -                export GCONF_CONFIG_SOURCE
  91      -                SCHEMADIR="$MINIROOT/.tmp_proto/root/etc/gconf/schemas"
  92      -                export SCHEMADIR
  93      -                /usr/bin/gconftool-2 --makefile-install-rule \
  94      -                    $SCHEMADIR/*.schemas >/dev/null 2>&1
  95      -                echo '
  96      -                xml:readwrite:/tmp/root/.gconf
  97      -                xml:readonly:/etc/gconf/gconf.xml.defaults
  98      -                ' > /"$MINIROOT"/.tmp_proto/root/etc/gconf/2/path
  99      -        )
 100      -}
 101      -
 102      -archive_Gnome()
 103      -{
 104      -        MEDIA="$1"
 105      -        MINIROOT="$2"
 106      -
 107      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 108      -        RELEASE=`basename "$RELEASE"`
 109      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 110      -
 111      -        # Create the gnome archive
 112      -        #
 113      -        (
 114      -                # usr/share gnome stuff
 115      -                cd "$MINIROOT"
 116      -                find usr/share/GConf usr/share/application-registry \
 117      -                    usr/share/autostart usr/share/dtds \
 118      -                    usr/share/emacs usr/share/gnome usr/share/gnome-2.0 \
 119      -                    usr/share/gnome-background-properties \
 120      -                    usr/share/gtk-engines usr/share/gui-install \
 121      -                    usr/share/icon-naming-utils usr/share/control-center \
 122      -                    usr/share/icons usr/share/locale usr/share/metacity \
 123      -                    usr/share/mime usr/share/mime-info usr/share/pixmaps \
 124      -                    usr/share/scrollkeeper usr/share/sgml usr/share/themes \
 125      -                    usr/share/xml \
 126      -                    -print > /tmp/gnome_share.$$ 2>/dev/null
 127      -
 128      -                if [ ! -f /tmp/gnome_share.$$ ] ; then
 129      -                        echo "/tmp/gnome_share.$$ file list not found."
 130      -                        return
 131      -                fi
 132      -
 133      -                # usr/lib gnome stuff
 134      -
 135      -                find usr/lib/libgnome*\.so\.* \
 136      -                    usr/lib/libgst*\.so\.* usr/lib/libgconf*\.so\.* \
 137      -                    usr/lib/libgdk*\.so\.* usr/lib/libgtk*\.so\.* \
 138      -                    usr/lib/libglade*\.so\.* usr/lib/libmetacity*\.so\.* \
 139      -                    usr/lib/libfontconfig*\.so\.* usr/lib/libgmodule*\.so\.* \
 140      -                    usr/lib/libgobject*\.so\.* usr/lib/libgthread*\.so\.* \
 141      -                    usr/lib/libpopt*\.so\.* usr/lib/libstartup*\.so\.* \
 142      -                    usr/lib/libexif*\.so\.* usr/lib/libtiff*\.so\.* \
 143      -                    usr/lib/libstartup*\.so\.* \
 144      -                    usr/lib/libexif*\.so\.* usr/lib/libORBit*\.so\.* \
 145      -                    usr/lib/libmlib*\.so\.* usr/lib/libxsl*\.so\.* \
 146      -                    usr/lib/libpango*\.so\.* usr/lib/libpng*\.so\.* \
 147      -                    usr/lib/liboil*\.so\.* usr/lib/libbonobo*\.so\.* \
 148      -                    usr/lib/libart*\.so\.* usr/lib/libcairo*\.so\.* \
 149      -                    usr/lib/libjpeg*\.so\.* \
 150      -                    usr/lib/libpolkit*\.so\.* \
 151      -                        -print | egrep -v '\.so\.[0]$' > \
 152      -                       /tmp/gnome_lib.$$ 2>/dev/null
 153      -
 154      -                find usr/lib/nautilus usr/lib/pango usr/lib/iconv \
 155      -                    usr/lib/metacity-dialog usr/lib/window-manager-settings \
 156      -                    usr/lib/bonobo-2.0 usr/lib/bononbo usr/lib/gtk-2.0 \
 157      -                    usr/lib/GConf usr/lib/bonobo-activation-server \
 158      -                    usr/lib/python2.4 usr/lib/gstreamer-0.10 \
 159      -                    usr/lib/gconf-sanity-check-2 usr/lib/gconfd \
 160      -                    usr/lib/gnome-vfs-2.0 usr/lib/dbus-daemon \
 161      -                    usr/lib/gnome-vfs-daemon usr/lib/gnome-settings-daemon \
 162      -                    usr/lib/gnome_segv2 usr/lib/orbit-2.0 \
 163      -                    usr/lib/libmlib \
 164      -                    print > /tmp/gnome_libdir.$$ 2>/dev/null
 165      -
 166      -                if [ ! -f /tmp/gnome_lib.$$  -a ! -f gnome_libdir.$$ ] ; then
 167      -                        echo "/tmp/gnome_lib.$$ file list not found."
 168      -                        return
 169      -                fi
 170      -
 171      -                # /usr/sfw gnome stuff
 172      -                find usr/sfw/bin usr/sfw/include usr/sfw/share usr/sfw/src \
 173      -                    -print > /tmp/gnome_sfw.$$ 2>/dev/null
 174      -
 175      -                if [ ! -f /tmp/gnome_sfw.$$ ] ; then
 176      -                        echo "/tmp/gnome_sfw.$$ file list not found."
 177      -                        return
 178      -                fi
 179      -
 180      -                # gnome app binaries usr/bin
 181      -                find usr/bin/gnome* usr/bin/gui-install usr/bin/bonobo* \
 182      -                    usr/bin/gtk-* usr/bin/fax* usr/bin/gdk* usr/bin/gif2tiff \
 183      -                    usr/bin/install-lan \
 184      -                    usr/bin/metacity* usr/bin/gst-* usr/bin/gconftool-2 \
 185      -                    usr/bin/pango* usr/bin/desktop* usr/bin/djpeg \
 186      -                    usr/bin/notify-send usr/bin/oil-bugreport \
 187      -                    usr/bin/bmp2tiff usr/bin/thembus-theme-applier \
 188      -                    usr/bin/thumbnail usr/lib/update-* \
 189      -                    usr/bin/ras2tiff usr/bin/raw2tiff usr/bin/rdjpgcom \
 190      -                    usr/bin/thumbnail usr/bin/dbus* \
 191      -                    usr/bin/tiff* usr/bin/rgb2ycbcr \
 192      -                    usr/bin/fc-cache usr/bin/fc-list \
 193      -                        -print > /tmp/gnome_bin.$$ 2>/dev/null
 194      -
 195      -                if [ ! -f /tmp/gnome_bin.$$ ] ; then
 196      -                        echo "/tmp/gnome_bin.$$ file list not found."
 197      -                        return
 198      -                fi
 199      -
 200      -                # Cat all the files together and create the gnome archive
 201      -                #
 202      -
 203      -                cat /tmp/gnome_libdir.$$ /tmp/gnome_lib.$$ \
 204      -                     /tmp/gnome_share.$$ /tmp/gnome_sfw.$$ /tmp/gnome_bin.$$ \
 205      -                    > /tmp/gnome.$$
 206      -
 207      -                if [ ! -f /tmp/gnome.$$ ] ; then
 208      -                        echo "/tmp/gnome.$$ file not found."
 209      -                        return
 210      -                fi
 211      -                # Save off this file in the miniroot for use later
 212      -                # when unpacking. Clean up old cruft if there.
 213      -                #
 214      -
 215      -                if [ -f .tmp_proto/gnome_saved ]; then
 216      -                        rm -f .tmp_proto/gnome_saved
 217      -                fi
 218      -
 219      -                cp /tmp/gnome.$$ .tmp_proto/gnome_saved
 220      -
 221      -                # Create gnome archive
 222      -                #
 223      -
 224      -                cpio -ocmPuB < /tmp/gnome.$$ 2>/dev/null | bzip2 > \
 225      -                    "$CPIO_DIR/gnome.cpio.bz2"
 226      -
 227      -                # Remove files from miniroot that are in archive.
 228      -                # Create symlinks for files in archive
 229      -                
 230      -                rm -rf `cat /tmp/gnome_share.$$`
 231      -
 232      -                for i in `cat /tmp/gnome_share.$$`
 233      -                do
 234      -                        ln -s /tmp/root/$i $i 2>/dev/null
 235      -                done
 236      -
 237      -                rm -rf `cat /tmp/gnome_lib.$$`
 238      -                for i in `cat /tmp/gnome_lib.$$`
 239      -                do      
 240      -                        ln -s /tmp/root/$i $i 2>/dev/null
 241      -                done
 242      -
 243      -                rm -rf `cat /tmp/gnome_libdir.$$`
 244      -                for i in `cat /tmp/gnome_libdir.$$`
 245      -                do
 246      -                        ln -s /tmp/root/$i $i 2>/dev/null
 247      -                done
 248      -
 249      -                rm -rf `cat /tmp/gnome_sfw.$$`
 250      -                for i in `cat /tmp/gnome_sfw.$$`
 251      -                do
 252      -                        ln -s /tmp/root/$i $i 2>/dev/null
 253      -                done
 254      -
 255      -                rm -rf `cat /tmp/gnome_bin.$$`
 256      -                for i in `cat /tmp/gnome_bin.$$`
 257      -                do
 258      -                        ln -s /tmp/root/$i $i 2>/dev/null
 259      -                done
 260      -                rm -f /tmp/gnome_share.$$
 261      -                rm -f /tmp/gnome_lib.$$
 262      -                rm -f /tmp/gnome_libdir.$$
 263      -                rm -f /tmp/gnome_bin.$$
 264      -        )
 265      -}
 266      -
 267      -archive_JavaGUI()
 268      -{
 269      -        MEDIA="$1"
 270      -        MINIROOT="$2"
 271      -
 272      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 273      -        RELEASE=`basename "$RELEASE"`
 274      -
 275      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 276      -        
 277      -        # Archive the java wizard components that are only used in the
 278      -        # non developer express path.
 279      -        #
 280      -        (
 281      -                # path is usr/lib/install/data
 282      -                cd "$MINIROOT"
 283      -                find usr/lib/install/data/wizards \
 284      -                    -print > /tmp/java_ui.$$ 2>/dev/null
 285      -
 286      -                if [ ! -f /tmp/java_ui.$$ ] ; then
 287      -                        echo "/tmp/java_ui.$$ file list not found."
 288      -                        return
 289      -                fi
 290      -
 291      -                cpio -ocmPuB < /tmp/java_ui.$$ 2>/dev/null | bzip2 > \
 292      -                    "$CPIO_DIR/javaui.cpio.bz2"
 293      -
 294      -                rm -rf `cat /tmp/java_ui.$$`
 295      -                ln -s /tmp/root/usr/lib/install/data/wizards \
 296      -                    usr/lib/install/data/wizards 2>/dev/null
 297      -
 298      -                rm -f /tmp/java_ui.$$
 299      -        
 300      -        )
 301      -}
 302      -
 303      -archive_Misc()
 304      -{
 305      -        MEDIA="$1"
 306      -        MINIROOT="$2"
 307      -
 308      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 309      -        RELEASE=`basename "$RELEASE"`
 310      -
 311      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 312      -
 313      -        # Archive misc stuff that is needed by non devex installer
 314      -        #
 315      -        (
 316      -                # usr/lib stuff
 317      -                cd "$MINIROOT"
 318      -                find usr/lib/lp -print > /tmp/lp.$$ 2>/dev/null
 319      -                if [ ! -f /tmp/lp.$$ ] ; then
 320      -                        echo "/tmp/lp.$$ file list not found."
 321      -                        return
 322      -                fi
 323      -
 324      -                cpio -ocmPuB < /tmp/lp.$$ 2>/dev/null | bzip2 > \
 325      -                    "$CPIO_DIR/lpmisc.cpio.bz2"
 326      -
 327      -                rm -rf `cat /tmp/lp.$$`
 328      -                ln -s /tmp/root/usr/lib/lp usr/lib/lp 2>/dev/null
 329      -                
 330      -                rm -f /tmp/lp.$$
 331      -        )
 332      -
 333      -}
 334      -
 335      -archive_Perl()
 336      -{
 337      -        MEDIA="$1"
 338      -        MINIROOT="$2"
 339      -
 340      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 341      -        RELEASE=`basename "$RELEASE"`
 342      -
 343      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 344      -
 345      -        # Archive perl, it is only needed by gnome gui.
 346      -        #
 347      -        (
 348      -                # in usr
 349      -                cd "$MINIROOT"
 350      -                find usr/perl5 -print > /tmp/perl.$$ 2>/dev/null
 351      -
 352      -                if [ ! -f /tmp/perl.$$ ] ; then
 353      -                        echo "/tmp/perl.$$ file list not found."
 354      -                        return
 355      -                fi
 356      -                cpio -ocmPuB < /tmp/perl.$$ 2>/dev/null | bzip2 > \
 357      -                    "$CPIO_DIR/perl.cpio.bz2"
 358      -
 359      -                rm -rf `cat /tmp/perl.$$` 2>/dev/null
 360      -                ln -s /tmp/root/usr/perl5 usr/perl5 2>/dev/null
 361      -
 362      -                rm -f /tmp/perl.$$
 363      -        )
 364      -}
 365      -archive_X()
 366      -{
 367      -        MEDIA="$1"
 368      -        MINIROOT="$2"
 369      -
 370      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 371      -        RELEASE=`basename "$RELEASE"`
 372      -
 373      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 374      -
 375      -        # create the graphics and non-graphics X archive
 376      -        #
 377      -        (
 378      -                cd "$MINIROOT"
 379      -                find usr/openwin usr/dt usr/X11 -print 2> /dev/null |\
 380      -                    cpio -ocmPuB 2> /dev/null | bzip2 > "$CPIO_DIR/X.cpio.bz2"
 381      -
 382      -                find usr/openwin/bin/mkfontdir \
 383      -                     usr/openwin/lib/installalias \
 384      -                     usr/openwin/server/lib/libfont.so.1 \
 385      -                     usr/openwin/server/lib/libtypesclr.so.0 \
 386      -                         -print | cpio -ocmPuB 2> /dev/null | bzip2 > \
 387      -                         "$CPIO_DIR/X_small.cpio.bz2"
 388      -
 389      -                rm -rf usr/dt usr/openwin usr/X11
 390      -                ln -s /tmp/root/usr/dt usr/dt
 391      -                ln -s /tmp/root/usr/openwin usr/openwin
 392      -                ln -s /tmp/root/usr/X11 usr/X11
 393      -        )
 394      -}
 395      -
 396      -archive_lu()
 397      -{
 398      -        MEDIA="$1"
 399      -        MINIROOT="$2"
 400      -
 401      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 402      -        RELEASE=`basename "$RELEASE"`
 403      -
 404      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 405      -
 406      -        (
 407      -                cd "$MINIROOT"
 408      -                find usr/lib/install usr/snadm usr/sbin usr/lib/locale \
 409      -                    boot/grub boot/solaris/bootenv.rc \
 410      -                    tmp/root/boot/grub tmp/root/boot/solaris/bootenv.rc \
 411      -                    2> /dev/null | cpio -ocmPuB 2> /dev/null | bzip2 \
 412      -                    > "$CPIO_DIR"/lu.cpio.bz2
 413      -                ls platform > "$CPIO_DIR/lu.platforms"
 414      -        )
 415      -}
 416      -
 417      -cleanout_pkgdata()
 418      -{
 419      -        rm -Rf tmp/root/var/sadm/install tmp/root/var/sadm/pkg
 420      -}
 421      -
 422      -packmedia()
 423      -{
 424      -        MEDIA="$1"
 425      -        MINIROOT="$2"
 426      -
 427      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 428      -        RELEASE=`basename "$RELEASE"`
 429      -        ARCHIVES="X X_small perl lpmisc javaui gnome"
 430      -
 431      -        mkdir -p "$MEDIA/$RELEASE/Tools/Boot"
 432      -
 433      -        if [ -d "$MINIROOT/platform/i86pc" ] ; then
 434      -                mkdir -p "$MEDIA/boot/amd64"
 435      -                mkdir -p "$MEDIA/boot/platform/i86pc/kernel"
 436      -                mkdir -p "$MEDIA/boot/platform/i86pc/kernel/amd64"
 437      -                mkdir -p "$MEDIA/boot/platform/i86xpv/kernel"
 438      -                mkdir -p "$MEDIA/boot/platform/i86xpv/kernel/amd64"
 439      -                cp "$MINIROOT/platform/i86pc/multiboot" "$MEDIA/boot"
 440      -                cp "$MINIROOT/platform/i86pc/kernel/unix" \
 441      -                    "$MEDIA/boot/platform/i86pc/kernel/unix"
 442      -                cp "$MINIROOT/platform/i86pc/kernel/amd64/unix" \
 443      -                    "$MEDIA/boot/platform/i86pc/kernel/amd64/unix"
 444      -                cp "$MINIROOT/platform/i86xpv/kernel/unix" \
 445      -                    "$MEDIA/boot/platform/i86xpv/kernel/unix"
 446      -                cp "$MINIROOT/platform/i86xpv/kernel/amd64/unix" \
 447      -                    "$MEDIA/boot/platform/i86xpv/kernel/amd64/unix"
 448      -                (
 449      -                        cd "$MEDIA/$RELEASE/Tools/Boot"
 450      -                        ln -sf ../../../boot/x86.miniroot
 451      -                        ln -sf ../../../boot/multiboot
 452      -                        ln -sf ../../../boot/platform/i86pc/kernel/unix
 453      -                        ln -sf ../../../boot/platform/i86pc/kernel/amd64/unix
 454      -                        ln -sf ../../../boot/platform/i86xpv/kernel/unix
 455      -                        ln -sf ../../../boot/platform/i86xpv/kernel/amd64/unix
 456      -                        ln -sf ../../../boot/grub/pxegrub
 457      -                )
 458      -        fi
 459      -
 460      -        if [ -d "$MINIROOT/platform/sun4u" ] ; then
 461      -                mkdir -p "$MEDIA/boot"
 462      -                dd if="$MINIROOT/platform/sun4u/lib/fs/hsfs/bootblk" \
 463      -                    of="$MEDIA/boot/hsfs.bootblock" \
 464      -                    bs=1b oseek=1 count=15 conv=sync 2> /dev/null
 465      -        fi
 466      -
 467      -        for arch in sun4u sun4v ; do
 468      -                if [ -d "$MINIROOT/platform/$arch" ] ; then
 469      -                        archdir="$MEDIA/$RELEASE/Tools/Boot/platform/$arch"
 470      -                        mkdir -p $archdir
 471      -                        ln -sf ../../../../../boot/sparc.miniroot \
 472      -                            "$archdir/boot_archive"
 473      -                        cp "$MINIROOT/usr/platform/$arch/lib/fs/nfs/inetboot" \
 474      -                            "$archdir"
 475      -                        cp "$MINIROOT/platform/$arch/wanboot" \
 476      -                            "$archdir"
 477      -                        mkdir -p "$MEDIA/platform/$arch"
 478      -                        ln -sf ../../boot/sparc.miniroot \
 479      -                            "$MEDIA/platform/$arch/boot_archive"
 480      -                        ln -sf ../../$RELEASE/Tools/Boot/platform/$arch/wanboot \
 481      -                            "$MEDIA/platform/$arch/wanboot"
 482      -                fi
 483      -        done
 484      -
 485      -        # archive package databases to conserve memory
 486      -        #
 487      -        (
 488      -                cd "$MINIROOT"
 489      -                find tmp/root/var/sadm/install tmp/root/var/sadm/pkg -print | \
 490      -                    cpio -ocmPuB 2> /dev/null | bzip2 > \
 491      -                    "$MEDIA/$RELEASE/Tools/Boot/pkg_db.cpio.bz2"
 492      -
 493      -                cleanout_pkgdata
 494      -        )
 495      -
 496      -        archive_lu "$MEDIA" "$MINIROOT"
 497      -
 498      -        archive_X "$MEDIA" "$MINIROOT"
 499      -
 500      -        # Take out the gnome and java parts of the installer from
 501      -        # the miniroot. These are not required to boot the system
 502      -        # and start the installers.
 503      -
 504      -        if [ -d "$MINIROOT/platform/i86pc" ] ; then
 505      -                preload_Gnome "$MEDIA" "$MINIROOT"
 506      -                archive_Gnome "$MEDIA" "$MINIROOT"
 507      -                archive_JavaGUI "$MEDIA" "$MINIROOT"
 508      -                archive_Misc "$MEDIA" "$MINIROOT"
 509      -                archive_Perl "$MEDIA" "$MINIROOT"
 510      -                pack "$MEDIA/boot/amd64/x86.miniroot"
 511      -
 512      -                # Now that the 64-bit archives & miniroot have been created,
 513      -                # restore the files from archives and save the 64-bit
 514      -                # archives. Strip the 64-bit objects and create the
 515      -                # 32-bit archives and miniroot
 516      -
 517      -                unpackmedia "$MEDIA" "$MINIROOT"
 518      -                cleanout_pkgdata
 519      -                mkdir -p "$MEDIA/$RELEASE/Tools/Boot/amd64"
 520      -                for i in $ARCHIVES; do
 521      -                        mv "$MEDIA/$RELEASE/Tools/Boot/${i}.cpio.bz2" \
 522      -                                "$MEDIA/$RELEASE/Tools/Boot/amd64"
 523      -                done
 524      -                if [ -z "$STRIP_AMD64" ]; then
 525      -                        strip_amd64
 526      -                fi
 527      -
 528      -                archive_X "$MEDIA" "$MINIROOT"
 529      -                archive_Gnome "$MEDIA" "$MINIROOT"
 530      -                archive_JavaGUI "$MEDIA" "$MINIROOT"
 531      -                archive_Perl "$MEDIA" "$MINIROOT"
 532      -                archive_Misc "$MEDIA" "$MINIROOT"
 533      -        fi
 534      -
 535      -        # copy the install menu to menu.lst so we have a menu
 536      -        # on the install media
 537      -        #
 538      -        if [ -f "$MINIROOT/boot/grub/install_menu" ] ; then
 539      -                cp $MINIROOT/boot/grub/install_menu \
 540      -                    $MEDIA/boot/grub/menu.lst
 541      -        fi
 542      -
 543      -        #
 544      -        # jumpstart utilities in usr/sbin/install.d
 545      -        #
 546      -        if [ -d "$MINIROOT/usr/sbin/install.d" ] ; then
 547      -                (
 548      -                cd ${MINIROOT}
 549      -                find usr/sbin/install.d/chkprobe \
 550      -                    -print | cpio -ocmPuB 2> /dev/null | bzip2 > \
 551      -                    ${MEDIA}/${RELEASE}/Tools/Boot/usr_sbin_install_d.cpio.bz2
 552      -                )
 553      -        fi
 554      -}
 555      -
 556      -unarchive_X()
 557      -{
 558      -        MEDIA="$1"
 559      -        UNPACKED_ROOT="$2"
 560      -
 561      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 562      -        RELEASE=`basename "$RELEASE"`
 563      -
 564      -        CPIO_DIR="$MEDIA/$RELEASE/Tools/Boot"
 565      -
 566      -        # unpack X
 567      -        #
 568      -        (
 569      -                cd "$UNPACKED_ROOT"
 570      -                rm -rf usr/dt usr/openwin usr/X11
 571      -                bzcat "$CPIO_DIR/X.cpio.bz2" | cpio -icdmu 2> /dev/null
 572      -        )
 573      -}
 574      -
 575      -unpackmedia()
 576      -{
 577      -        MEDIA="$1"
 578      -        UNPACKED_ROOT="$2"
 579      -
 580      -        RELEASE=`/bin/ls -d "$MEDIA/Solaris_"*`
 581      -        RELEASE=`basename "$RELEASE"`
 582      -
 583      -        unarchive_X "$MEDIA" "$UNPACKED_ROOT"
 584      -
 585      -        # unpack package databases
 586      -        #
 587      -        (
 588      -                cd "$UNPACKED_ROOT"
 589      -                bzcat "$MEDIA/$RELEASE/Tools/Boot/pkg_db.cpio.bz2" |
 590      -                    cpio -icdmu 2> /dev/null
 591      -
 592      -                if [ -d "$MINIROOT/platform/i86pc" ] ; then
 593      -
 594      -                        # unpack gnome, perl, java and misc
 595      -                        # Remove symlinks left from unpacking x86.miniroot
 596      -                        # so that unpacking subsequent archives will populate
 597      -                        # appropriately.
 598      -                        #
 599      -                        rm -rf usr/perl5
 600      -                        rm -rf usr/lib/install/data/wizards
 601      -                        rm -rf usr/lib/lp
 602      -
 603      -                        # Gnome list saved off from packmedia
 604      -                        for i in `cat .tmp_proto/gnome_saved`
 605      -                        do
 606      -                                rm -rf $i
 607      -                        done
 608      -                        
 609      -                        bzcat "$MEDIA/$RELEASE/Tools/Boot/gnome.cpio.bz2" |
 610      -                            cpio -icdmu 2>/dev/null
 611      -                        bzcat "$MEDIA/$RELEASE/Tools/Boot/javaui.cpio.bz2" |
 612      -                            cpio -icdmu 2>/dev/null
 613      -                        bzcat "$MEDIA/$RELEASE/Tools/Boot/lpmisc.cpio.bz2" |
 614      -                            cpio -icdmu 2>/dev/null
 615      -                        bzcat "$MEDIA/$RELEASE/Tools/Boot/perl.cpio.bz2" |
 616      -                            cpio -icdmu 2>/dev/null
 617      -                fi
 618      -        )
 619      -}
 620      -
 621   61  do_unpack()
 622   62  {
 623   63          (
 624   64                  cd $MNT
 625   65                  find . -print | cpio -pdum "$UNPACKED_ROOT" 2> /dev/null
 626   66          )
 627   67          # increase the chances the unmount will succeed
 628   68          umount -f $MNT
 629   69  }
 630   70  
↓ open down ↓ 245 lines elided ↑ open up ↑
 876  316  # sanity check
 877  317  [ "$UNPACKED_ROOT" != "/" ] || usage
 878  318  
 879  319  if [ "`dirname $MR`" = . ] ; then
 880  320          MR="$BASE/$MR"
 881  321  fi
 882  322  if [ "`dirname $UNPACKED_ROOT`" = . ] ; then
 883  323          UNPACKED_ROOT="$BASE/$UNPACKED_ROOT"
 884  324  fi
 885  325  
 886      -
 887      -MEDIA="$MR"
 888      -
 889  326  trap cleanup EXIT
 890  327  
 891  328  # always unpack into a fresh root
 892  329  case $1 in
 893      -        unpack|unpackmedia)
      330 +        unpack)
 894  331                  rm -rf "$UNPACKED_ROOT"
 895  332                  mkdir -p "$UNPACKED_ROOT"
 896  333                  ;;
 897  334  esac
 898  335  [ -d "$UNPACKED_ROOT" ] || usage
 899  336  
 900  337  case $1 in
 901      -        packmedia)
 902      -                packmedia "$MEDIA" "$UNPACKED_ROOT"
 903      -                if [ -d "$UNPACKED_ROOT/kernel/drv/sparcv9" ] ; then
 904      -                        pack "$MEDIA/boot/sparc.miniroot"
 905      -                else
 906      -                        pack "$MEDIA/boot/x86.miniroot"
 907      -                fi
 908      -
 909      -                ;;
 910      -        unpackmedia)
 911      -                if [ -f "$MEDIA/boot/sparc.miniroot" ] ; then
 912      -                        unpack "$MEDIA/boot/sparc.miniroot"
 913      -                else
 914      -                        unpack "$MEDIA/boot/x86.miniroot"
 915      -                        unpack "$MEDIA/boot/amd64/x86.miniroot"
 916      -                fi
 917      -                unpackmedia "$MEDIA" "$UNPACKED_ROOT"
 918      -                ;;
 919  338          pack)   pack "$MR"
 920  339                  ;;
 921  340          unpack) unpack "$MR"
 922  341                  ;;
 923  342          *)      usage
 924  343                  ;;
 925  344  esac
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX