bfu.sh revision 9dd0f810214fdc8e1af881a9a5c4b6927629ff9e
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# CDDL HEADER START
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# The contents of this file are subject to the terms of the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Common Development and Distribution License (the "License").
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You may not use this file except in compliance with the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# See the License for the specific language governing permissions
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# and limitations under the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# When distributing Covered Code, include this CDDL HEADER in each
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# If applicable, add the following below this CDDL HEADER, with the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# fields enclosed by brackets "[]" replaced with your own identifying
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# information: Portions Copyright [yyyy] [name of copyright owner]
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# CDDL HEADER END
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Use is subject to license terms.
272ac8a1a482b3baeff7293aac5de828cfd1ee69Mark de Reeper# ident "%Z%%M% %I% %E% SMI"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Upgrade a machine from a cpio archive area in about 5 minutes.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# By Roger Faulkner and Jeff Bonwick, April 1993.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# (bfu == Bonwick/Faulkner Upgrade, a.k.a. Blindingly Fast Upgrade)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Usage: bfu [-f] <archive_dir> [root-dir] # for normal machines
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# bfu -c [-f] <archive_dir> <exec-dir> # for diskless clients
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# The -f flag is to override the built-in safety check which requires
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# that the starting-point OS be a least a certain revision.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You have to be super-user. It's safest to run this from the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# system console, although I've run it under OW and even via
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# remote login with no problems.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You will have to reboot the system when the upgrade is complete.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You should add any administrative files you care about to this list.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Warning: there had better be no leading '/' on any of these filenames.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# under certain circumstances, which can really screw things up; unset it.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterif [ -z "$GATEPATH" ]; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster test -d $GATEPATH || GATEPATH=/net/onnv.eng/export/gate
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterif [ -z "$ARCHIVEPATH" ]; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster test -d $ARCHIVEPATH || ARCHIVEPATH=/net/onnv.eng/export
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# NOTE: Entries in *_files must expand to either the exact files required,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# or to directories that will be scoured for files. Any directories
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# (and subdirectories) resulting from a wildcard expansion will be
272ac8a1a482b3baeff7293aac5de828cfd1ee69Mark de Reeper# fully recursed by BFU's searching for files. (E.g. /etc/inet/* will
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# include all files in any of its directories, as well as any files in
91cb2bef1c88e70b5d433c2a34bca110a35786ceMark Craig# These lists should really be generated automatically from the
91cb2bef1c88e70b5d433c2a34bca110a35786ceMark Craig# pkgmap(4) metadata.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# First list: files to be saved in global and non-global zones.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Second list: files to be saved in the global zone only.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Third list: files extracted from generic.root but which belong in the global
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# zone only: they are superfluous (and some even harmful) in local zones.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# (note: as /etc/init.d scripts are converted to smf(5) "Greenline" services,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# they (and their /etc/rc?.d hardlinks) should be removed from this list when
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# they are added to smf_obsolete_rc_files, below)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster platform/*/kernel
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster usr/platform/SUNW,SPARC-Enterprise/lib/dscp.ppp.options
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster usr/platform/SUNW,SPARC-Enterprise/lib/libdscp.so
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster usr/platform/SUNW,SPARC-Enterprise/lib/libdscp.so.1
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster usr/platform/SUNW,SPARC-Enterprise/lib/llib-ldscp.ln
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster usr/platform/SUNW,SPARC-Enterprise/sbin/prtdscp
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster var/svc/manifest/system/filesystem/rmvolmgr.xml
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Fourth list: files to be preserved, ie unconditionally restored to
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# "child" versions
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster find $files -depth -type f ! -name core -print 2>/dev/null | sort -u || {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # Force cpio to return non-zero by printing an error message
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster find $realmode_files -depth -type f ! -name core -print 2>/dev/null | sort
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if [ -x /tmp/bfubin/svccfg ]; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster [ $? = 0 ] || echo "warning: unable to temporarily disable $1"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster [ $? = 0 ] || echo "warning: unable to enable $1 for next boot"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster done)" $inetconf > $inettmp && ! cmp -s $inettmp $inetconf &&
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster sed 's/^#SMFbfu# //' $inetconf > $inettmp && cp $inettmp $inetconf
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if grep '^#SMFbfu# tftp' $inetconf >/dev/null ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # BFU previously commented out, put it back in place
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster sed 's/^#SMFbfu# tftp/tftp/' $inetconf > $inettmp &&
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster elif ! grep '^[# ]*tftp' $inetconf >/dev/null; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# TFTPD - tftp server (primarily used for booting)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster#tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # Since inetd.conf is updated by SUNWmdr's postinstall script,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # we will update the actual inetd.conf here to reflect the postinstall
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # only change inetd.conf if the rpc.metad entry is out of date
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if ! grep "^[# ]*100229/1-2" $inetconf > /dev/null ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # and convert spaces to tabs within the rpc entry, as well as
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if grep "^[# ]*100229/1" $inetconf > /dev/null ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster grep "^# METAD - SLVM metadb" $inetconf > $inettmp
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo "100229/1-2\ttli\trpc/tcp\twait\troot\t/usr/sbin/rpc.metad\trpc.metad" >> $inettmp
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if ! diff $inetnew $inetconf > /dev/null ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # only change inetd.conf if the rpc.mdcommd entry is out of date
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if ! grep "^[# ]*100422/1" $inetconf > /dev/null ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # and convert spaces to tabs within the rpc entry,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if grep "^[# ]*100422/1" $inetconf > /dev/null ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster grep "^# MDMN_COMMD - SVM Multi node" $inetconf > $inettmp
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo '# MDMN_COMMD - SVM Multi node communication daemon' >$inettmp
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo '100422/1\ttli\trpc/tcp\twait\troot\t/usr/sbin/rpc.mdcommd\trpc.mdcommd' >> $inettmp
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster grep -v '^# MDMN_COMMD - SVM Multi node' $inetconf | \
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if ! diff $inetnew $inetconf > /dev/null ; then
272ac8a1a482b3baeff7293aac5de828cfd1ee69Mark de Reeper print "Updating inetd.conf rpc.mdcommd entry ... \c"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # update /etc/security/policy.conf with the default
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if [ $? = 1 ] ; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster print "Updating entries for crypt(3c), see policy.conf(4)"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# crypt(3c) Algorithms Configuration
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# CRYPT_ALGORITHMS_ALLOW specifies the algorithms that are allowed to
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# be used for new passwords. This is enforced only in crypt_gensalt(3c).
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan FosterCRYPT_ALGORITHMS_ALLOW=1,2a,md5
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# To deprecate use of the traditional unix algorithm, uncomment below
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# and change CRYPT_DEFAULT= to another algorithm. For example,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# CRYPT_DEFAULT=1 for BSD/Linux MD5.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster#CRYPT_ALGORITHMS_DEPRECATE=__unix__
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# The Solaris default is the traditional UNIX algorithm. This is not
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# listed in crypt.conf(4) since it is internal to libc. The reserved
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# name __unix__ is used to refer to it.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan FosterCRYPT_DEFAULT=__unix__
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if [ $? = 1 ]; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# These settings determine the default privileges users have. If not set,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# the default privileges are taken from the inherited set.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# There are two different settings; PRIV_DEFAULT determines the default
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# set on login; PRIV_LIMIT defines the Limit set on login.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Individual users can have privileges assigned or taken away through
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# user_attr. Privileges can also be assigned to profiles in which case
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# the users with those profiles can use those privileges through pfexec(1m).
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# For maximum future compatibility, the specifications should
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# always include "basic" or "all"; privileges should then be removed using
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# the negation. E.g., PRIV_LIMIT=all,!sys_linkdir takes away only the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# sys_linkdir privilege, regardless of future additional privileges.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Similarly, PRIV_DEFAULT=basic,!file_link_any takes away only the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# file_link_any privilege from the basic privilege set; only that notation
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# is immune from a future addition of currently unprivileged operations to
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# the basic privilege set.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# NOTE: removing privileges from the the Limit set requires EXTREME care
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# as any set-uid root program may suddenly fail because it lacks certain
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# privilege(s).
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster#PRIV_DEFAULT=basic
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster#PRIV_LIMIT=all
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Cleanup nfsmapid configuration before extracting
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# root bits. Remove if they exist:
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# nfsmapid entry in inetd.conf
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# nfsmapid entry in /etc/net/ti*/services
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Going forward neither should exist, but no harm if services entry exists
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Going way backwards (pre-04/28/2004), inetd.conf must exist but will
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# be a conflict that should be merged in
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster services=$rootprefix/etc/net/ticotsord/services
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Define global variables
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# List of SDS commands that must be deleted.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# List of SDS configuration files that must be deleted.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# List of rc scripts that must be deleted.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# List of flashprom-related files that must be deleted.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterusr/platform/SUNW,Ultra-Enterprise/lib/flash-update.sh
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterusr/platform/sun4u/lib/prom/SUNW,Ultra-Enterprise
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# delete the entries associated with bootlist from /etc/system
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster sed -e /"Begin MDD database info"/,/"End MDD database info"/d \
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo "copy error: /tmp/system.$$ to ${SYSTEM_FILE}"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Add entries in md.conf for bootlist
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo "# Begin MDD database info (do not edit)" >> /tmp/md.conf.$$
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster sed -e 's/^set md://' -e 's/$/;/' ${SYSTEM_FILE} | \
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo "# End MDD database info (do not edit)" >> /tmp/md.conf.$$
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo "copy error: /tmp/md.conf.$$ to ${mdconf}"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# add_devid_destroy(filename)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# returns contents in filename
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# md_devid_destroy property is required when upgrading
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# from pre SVM to SVM releases or when the device ID returned from
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# the driver changes.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# It is specifically placed between
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# # Begin MDD database info and # End MDD database info because
# metadevadm is run in rc2.d.
# smf(5) "Greenline" doesn't install the init.d or rc*.d scripts for
cd $root;
none \
svccfg -f - <<EOF
! -f $rootprefix/var/svc/manifest/system/scheduler.xml ]]; then
! -f $rootprefix/var/svc/manifest/system/filesystem/rmvolmgr.xml ]]; then
if [[ ! -f $mymfs ]] || ! cmp -s $manifest_src/$1 $mymfs ; then
cp $manifest_src/$1 $mymfs ||
cp $manifest_src/$1 $rootprefix/lib/svc/method ||
rm -f $rootprefix/etc/rc?.d/[SK]??$1
mfst=$1
cd $root
[ -f $mfst ] || return;
if [ -r /etc/svc/volatile/repository_door ]; then
cd $root;
cd $root;
for f in $smf_gldv3_manifests; do
cd $root;
[[ -f $rootprefix/$repository ]] || return
if [[ ! -x $sqlite ]]; then
rm -f /tmp/bfurepo.db;
if [[ $? -eq 0 ]]; then
if [[ $force_override = no ]]; then
cat >&2 <<EOF
if [[ -f $rootprefix/var/svc/manifest/milestone/sysconfig.xml ]] &&
! smf_is_sysconfig ; then
if [[ -n $rootprefix ]]; then
if [[ -z $rootprefix ]]; then
[[ -n $rootprefix ]] && unset SVCCFG_REPOSITORY
if [ -d $rootprefix/$old_mfst_dir ]; then
if [ ! -f $new ]; then
if [ -f $rootprefix/etc/init.d/inetd ]; then
if [ ! -f $repository ]; then
chmod 0600 $repository
for f in $smf_obsolete_manifests; do
if [ $need_datalink = no ]; then
grep ldap $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
is_ldap=$?
grep nisplus $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
is_nisplus=$?
grep nis $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
is_nis=$?
if [ $is_ldap = 0 ]; then
elif [ $is_nisplus = 0 ]; then
elif [ $is_nis = 0 ]; then
[ -f $rootprefix/etc/resolv.conf ] && smf_enable network/dns/client
[ -f $rootprefix/etc/rcap.conf ] && smf_enable system/rcap
[ -f $rootprefix/etc/inet/dhcpsvc.conf ] && \
if [ -f $rootprefix/etc/dfs/dfstab ] &&
[ -f $rootprefix/etc/inet/ntp.conf ] && smf_enable network/ntp
if [ -f /var/yp/NISLDAPmapping ]; then
master=`/usr/sbin/makedbm -u /var/yp/\$domain/LDAP_passwd.byname | grep YP_MASTER_NAME | nawk '{ print $2 }'`
master=`/usr/sbin/makedbm -u /var/yp/\$domain/passwd.byname | grep YP_MASTER_NAME | nawk '{ print $2 }'`
if [ ! -f /var/yp/NISLDAPmapping ]; then
if [ -f $rootprefix/kernel/drv/md.conf ]; then
MDDB_STATUS=$?
if [ $MDDB_STATUS -ne 0 ]; then
[[ -d $manifest_src ]] ||
[[ -d $manifest_src ]] || manifest_src=/net/greenline.eng/meta0/smf
if smf_bkbfu_past_sysconfig ; then
if smf_is_sysconfig ; then
if [[ ! -f $sysidmfst ]]; then
if [[ ! -f $kdmmfst ]]; then
if [[ ! -f $sysidmfst ]]; then
if [[ -f $rootprefix/var/svc/manifest/application/dtlogin.xml &&
if [[ -n $rootprefix ]]; then
-f $rootprefix/var/svc/manifest/network/datalink.xml ]]; then
if [[ -n $rootprefix ]]; then
/var/svc/manifest/network/aggregation.xml | \
/var/svc/manifest/network/datalink.xml | \
if grep svc-kdc.slave $kpmani > /dev/null 2>&1; then
if [ -d $rootprefix/tftpboot ] || [ -d $rootprefix/rplboot ]; then
echo error $* >> $EXTRACT_LOG
print "Copying $abspath to $localpath"
print "Executing $localpath $*\n"
exec $localpath $*
cd $cpiodir
# Make sure we extract the sun4u-us3 libc_psr.so.1
cd $cpiodir
*sparc*)
*i386*)
cd $cpiodir
print "Loading $cpiodir root archives on:"
print "\t$root"
echo "$nss_lib is not valid but -f is set; continuing."
echo "$nss_lib is not valid."
echo "$nss_lib64 does not exist."
# later used to determine if aggregation.conf needs to be moved.
set $bfucmd
cd $dir
set $bfuoptcmd
cd $dir
if [ -f $cmd ]; then
if [ ! -d $MULTIBOOT_BIN_DIR ]; then
echo "$MULTIBOOT_BIN_DIR: not found"
echo "$MULTIBOOT_BIN_DIR/$file: not found"
echo "installing files from $MULTIBOOT_BIN_DIR"
# add libc_psr.so.1, if available and not empty
if [ -f $cmd ]; then
if [ ! -d $MULTIBOOT_BIN_DIR ]; then
echo "$MULTIBOOT_BIN_DIR: not found"
echo "$MULTIBOOT_BIN_DIR/$file: not found"
echo "copying $file from $MULTIBOOT_BIN_DIR"
if [ ! -f $conf ]; then
while read ifname
if [ $? -ne 0 ]; then
printf \
>> $conf
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
for pkg in $perl_pkgs
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
for pkg in $aset_pkgs
for pkg in $aset_pkgs
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
for pkg in $bind8_pkgs
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
rm -f $usr/sbin/named-xfer
rm -f $usr/lib/nslookup.help
rm -f $usr/sbin/named-bootconf
mkdir -p $usr/perl5/vendor_perl/5.8.4
cp -rp $usr/perl5/vendor_perl/5.8.3/* \
$usr/perl5/vendor_perl/5.8.4
typeset script
sed -e \
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
for pkg in $perl_pkgs
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
rm -rf $usr/perl5/vendor_perl/5.8.3
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
rm -rf $rootprefix/etc/fn
rm -rf $rootprefix/var/fn
rm -f $rootprefix/etc/fn.conf
rm -f $usr/sbin/fncreate_fs
rm -f $usr/lib/libfn_p.so
rm -f $usr/lib/libfn_p.so.1
rm -f $usr/lib/libfn_spf.so
rm -f $usr/lib/libfn_spf.so.1
rm -f $usr/lib/libxfn.so.1
rm -f $usr/lib/libxfn.so.2
rm -f $usr/lib/sparcv9/libfn_p.so
rm -f $usr/lib/sparcv9/libfn_p.so.1
rm -f $usr/lib/sparcv9/libfn_spf.so
rm -f $usr/lib/sparcv9/libxfn.so.1
rm -f $usr/lib/sparcv9/libxfn.so.2
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
for pkg in $face_pkgs
for pkg in $face_pkgs
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
typeset -r pkgroot=${rootprefix:+-R $rootprefix}
typeset pkg
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
rm -f $usr/lib/libdmici.so
rm -f $usr/lib/libdmimi.so
rm -f $usr/lib/libdmi.so.1
rm -f $usr/lib/libdmici.so.1
rm -f $usr/lib/libdmimi.so.1
rm -f $usr/lib/sparcv9/libdmici.so
rm -f $usr/lib/sparcv9/libdmimi.so
rm -f $usr/lib/sparcv9/libdmi.so.1
rm -f $usr/lib/amd64/libdmici.so
rm -f $usr/lib/amd64/libdmimi.so
rm -f $usr/lib/amd64/libdmi.so.1
rm -f $usr/lib/amd64/libdmici.so.1
rm -f $usr/lib/amd64/libdmimi.so.1
rm -f $rootprefix/etc/rc0.d/K07dmi
rm -f $rootprefix/etc/rc1.d/K07dmi
rm -f $rootprefix/etc/rc2.d/K07dmi
rm -f $rootprefix/etc/rcS.d/K07dmi
rm -f $rootprefix/etc/rc3.d/S77dmi
res=$?
if [ -f $srcbootenvrc -a $res -eq 0 ]; then
rm -f $tmpbootenvrc
cp $ipsecalgs ${ipsecalgs}.tmp
$ipsecalgs > ${ipsecalgs}.tmp
mv -f ${ipsecalgs}.tmp $ipsecalgs
$pkcs11conf > ${pkcs11conf}.tmp
mv -f ${pkcs11conf}.tmp $pkcs11conf
# Add metaslot configuration to pkcs11.conf if it doesn't already exist
export metaslot_config=\
mv -f ${pkcs11conf}.tmp $pkcs11conf
if [ -f $usr/lib/gss/mech_krb5.so.1 ]; then
if [ -f $usr/lib/sparcv9/gss/mech_krb5.so.1 ]; then
if [ -f $rootprefix/$kerneldir/kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir/gl_kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir/do_kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir_sparc/kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir_sparc/gl_kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir_sparc/do_kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir_sparc/kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir_sparc/gl_kmech_krb5 ]; then
if [ -f $rootprefix/$kerneldir_sparc/do_kmech_krb5 ]; then
$gssmechconf > ${gssmechconf}.tmp
if [ $? -eq 0 ]; then
mv -f ${gssmechconf}.tmp $gssmechconf
chmod 644 $root/etc/security/audit_user
# disable mpxio on fp(7D) ports using fp.conf
test -f $conffile || return
> $tmpfile
tmpfile=/tmp/scsi_vhci.conf.$$
> $tmpfile
test -f $conffile || return
if [ -f $ancestorconffile ]; then
if [ $mpxio_child -eq 1 ]; then
$rootprefix/kernel/drv/fp.conf || \
[ $mpxio_child -eq 0 ] && disable_mpxio_using_fpconf
ROOT=$1
cat << BOOTMOUNTERR
PBOOT=$1
BOOTBLK=$2
DEVICE=$3
if [ ! -f $PBOOT ]; then
if [ ! -f $BOOTBLK ]; then
if [ ! -c $DEVICE ]; then
if [ ! -w $DEVICE ]; then
ROOT=$1
cd $TMPDIR
cd $OLD_PWD
if [ $? -eq 0 ] ; then
if [ ! -f ${TMPDIR}/$f ]; then
TMP_FDFILE1=${TMPDIR}/fdfile1.$$
num=1
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
${SOURCE_BOOT_DEV})
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
cd ${SOURCE_BOOT_DEV}
if [ $? -ne 0 ] ; then
cd ${OLD_PWD}
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
rm -rf ${SOURCE_BOOT_DEV}
done < ${TMP_FDFILE1}
rm ${TMP_FDFILE1} ${LOGFILE} ${DDCOPY}
if [ ! -f ${TMPDIR}/$f ]; then
if [ $? -ne 0 ] ; then
if [ -f $prologue ]; then
print "Executing $prologue"
# Stop init(1M) so extraction/manipulation of inittab is safe.
# umount /platform/$PLAT/lib/libc_psr.so.1 if necessary
print "Unmounting /platform/$PLAT/lib/libc_psr.so.1 ..."
# umount /platform/$ARCH/lib/libc_psr.so.1 if necessary
print "Unmounting /platform/$ARCH/lib/libc_psr.so.1 ..."
# umount /platform/$PLAT/lib/sparcv9/libc_psr.so.1 if necessary
print "Unmounting /platform/$PLAT/lib/sparcv9/libc_psr.so.1 ..."
# umount /platform/$ARCH/lib/sparcv9/libc_psr.so.1 if necessary
print "/platform/$ARCH/lib/sparcv9/libc_psr.so.1 ..."
# umount /platform/sun4u-us3/lib/libc_psr.so.1 if necessary
print "Unmounting /platform/sun4u-us3/lib/libc_psr.so.1 ..."
# umount /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1 if necessary
print "Unmounting /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1 ..."
unset SMF_FMRI
# the zone configuration to become unreadable (e.g., via a
$ZCAT $compressed_archive | cpio -idmucB $* 2>&1 \
egrep -s -v blocks $PCFS_BOOT_LOG
if [ $? -eq 0 ]; then
rm -f $PCFS_BOOT_LOG
base=$1
| tee -a $EXTRACT_LOG
[ -f etc/svc/repository.db ] &&
[ -e etc/repository_door ] &&
tee -a $EXTRACT_LOG
| tee -a $EXTRACT_LOG
cd $root
base=$1
cd $root
| tee -a $EXTRACT_LOG
if [ $boot_is_pcfs = yes ]; then
tee -a $EXTRACT_LOG
cd $root
if [ -f $NEWBOOTBLK -a ! -f $BOOTBLK ]; then
if [ -f $NEWBOOTBLK -a -f $BOOTBLK ]; then
install_boot_i386 ./pboot ./bootblk ${rootslice%??}s2 )
if [ ! -h ${OLDBOOTDIR} -a -f ${OLDBOOTBIN} ] ;
rm -rf ${OLDBOOTBIN}
if [ $is_pcfs_boot = yes ]; then
if [ $? -eq 0 ]; then
for file in $saved_boot_files
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
if [ ! -f $rootprefix/boot/mdboot ]; then
rm -f $rootprefix/boot/mdboot
for rootdev in $rootdevlist
if [[ -n $bootdev ]] ; then
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
mkdir -p $rootprefix/boot
cp -r $rootprefix/stubboot/* $rootprefix/boot
sed <$rootprefix/etc/vfstab \
if [ $is_pcfs_boot = no ]; then
get_rootdev_list | while read rootdev
rootdev=$1
grubhd=$1
if [ -f ${rootprefix}/boot/multiboot ] &&
[ -f ${rootprefix}/boot/x86.miniroot-safe ] ; then
${rootprefix}/boot/solaris/bootenv.rc | cut -f 2 -d \'`
${rootprefix}/boot/solaris/bootenv.rc | \
cut -f 2 -d \'`
>> $MENU
if [ ! -f /boot/multiboot -o ! -f /boot/x86.miniroot-safe ] && \
[ -x ${GATEPATH}/public/bin/update_failsafe ] ; then
get_rootdev_list | while read rootdev
part=0
if [ -f $MENU ]; then
if [ $? -eq 1 ]; then
cr_args=${rootprefix:+ -R $rootprefix}
cat >$rootprefix/etc/rc2.d/S99postbfu <<EOF
cat >$rootprefix/lib/svc/method/boot-archive <<EOF
dir=$1
typeset pkgroot
typeset pkg
root=$1
zone=$2
rootprefix=${root%/}
if boot_is_upgradeable $root && \
[ -f $cpiodir/i86pc.boot$ZFIX ] && \
if [ $multiboot_archives = yes ]; then
if [ $is_pcfs_boot = yes ]; then
cd $root
if [ -f var/sadm/system/admin/INST_RELEASE ] ; then
if [[ -f $rootprefix/etc/inet/ipnodes && \
! -h $rootprefix/etc/inet/ipnodes ]]; then
cp -p $rootprefix/etc/inet/ipnodes \
if [ $target_isa = sparc ]; then
if [ $target_isa = sparc ]; then
rm -f $usr/lib/fm/SUN4U.dict
rm -f $usr/lib/fm/SUNOS.dict
rm -f $root/etc/init.d/buildmnttab
rm -f $root/etc/rc0.d/K42inetsvc
rm -f $root/etc/rc1.d/K42inetsvc
rm -f $root/etc/rcS.d/K42inetsvc
rm -f $root/etc/rcS.d/S29network.sh
rm -f $root/etc/init.d/domainname
rm -f $root/etc/rc2.d/S69domainname
rm -f $root/etc/rcS.d/S28network.sh
rm -f $root/kernel/drv/zpool.conf
rm -f $root/kernel/drv/zpool.cache
rm -f $usr/lib/drv/config_md.so.1
rm -f $usr/include/config_md.h
rm -f $usr/lib/libssd.so.1
rm -f $usr/lib/libap_dmd.a
rm -f $usr/lib/libap_dmd.so.1
rm -f $usr/lib/libintpos.a
rm -f $usr/lib/libintpos.so.1
rm -f \
$usr/lib/abi/spec2trace \
rm -f \
$usr/ccs/lib/libpanel.a \
rm -f \
rm -f $usr/platform/*/lib/libc_psr.so.1
rm -f $usr/platform/*/lib/libmd5_psr.so.1
STARFIRE_PLAT=platform/SUNW,Ultra-Enterprise-10000
rm -f \
if [[ -h $usr/platform/SUNW,Netra-CP2300/sbin ]] ; then
if [[ -h $usr/platform/SUNW,Netra-CP2300/include ]] ; then
DAKTARI_PLAT=platform/SUNW,Sun-Fire-880
rm -f \
if [ $target_isa = sparc ]; then
rm -f $usr/include/sys/openprom.h
[[ -h $platdir ]] && continue
rm -f $usr/lib/security/pam_unix.so
rm -f $usr/lib/libldap.so.3
rm -f $usr/lib/sparcv9/libldap.so.3
$rootprefix/bfu.child/etc/nsswitch.conf > /tmp/nssw.$$
rm -f $usr/lib/nss_xfn.so.1
rm -f $usr/lib/sparcv9/nss_xfn.so.1
if [ -d $rootprefix/etc/fn -o \
-d $rootprefix/var/fn ]; then
-d $rootprefix/etc/dmi -o \
-d $rootprefix/var/dmi ]; then
pkgroot=${rootprefix:+-R $rootprefix}
if [ $target_isa = i386 ]; then
if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
if [ $target_isa = sparc ]; then
if [ $target_isa = sparc ]; then
for x in $FLASHPROMLIST
if [ $RM_32BIT_KERNEL -eq 1 -a $zone = global ];
$usr/lib/mdb/kvm/genunix.so \
$usr/lib/mdb/kvm/ufs_log.so \
rm -f $root/kernel/misc/seg_mapdev
if [ $target_isa = sparc -a $zone = global ]; then
rm -f $usr/lib/adb/mdi_client
rm -f $usr/lib/adb/mdi_pathinfo
rm -f $usr/lib/adb/scsi_vhci_pkt
rm -f $root/lib/mpxio/stmsboot_util
rm -f \
if [ $target_isa = i386 ]; then
rm -f $usr/include/sys/cpc_event.h
rm -f $usr/include/sys/nexusintr.h
rm -f $root/kernel/drv/cpqncr.conf
rm -f $root/kernel/drv/pcscsi.conf
rm -f $root/kernel/drv/objmgr.conf
rm -f $usr/lib/gss/mech_krb5.so
rm -f $usr/lib/gss/mech_krb5.so.1
rm -f $rootprefix/usr/lib/mdb/kvm/ufs_log.so
rm -f $rootprefix/usr/lib/mdb/kvm/amd64/ufs_log.so
if [ $target_isa = i386 ]; then
rm -f $root/etc/init.d/cachefs.root
rm -f $root/etc/rcS.d/S35cacheos.sh
dir_is_inherited usr 2>/dev/null;
rm -f ${rootprefix}/usr/include/rpcsvc/nfsauth_prot.x
rm -f ${rootprefix}/usr/include/rpcsvc/nfsauth_prot.h
[ -d $root/$new_mfst_dir ] && mv $root/$new_mfst_dir $root/$old_mfst_dir
if [ $target_isa = i386 ]; then
rm -f $usr/lib/llib-lrac.ln
rm -f $usr/lib/amd64/llib-lrac.ln
rm -f $usr/lib/sparcv9/llib-lrac.ln
rm -f $usr/lib/librac.so.1
rm -f $usr/lib/amd64/librac.so.1
rm -f $usr/lib/sparcv9/librac.so.1
rm -f $root/lib/libcmd.so.1
rm -f $root/lib/amd64/libcmd.so.1
rm -f $root/lib/sparcv9/libcmd.so.1
rm -f $root/lib/llib-lcmd.ln
rm -f $root/lib/amd64/llib-lcmd.ln
tee -a $EXTRACT_LOG
tee -a $EXTRACT_LOG
case $target_isa in
i386)
if [ $target_isa = i386 ]; then
if [ $target_isa = i386 ]; then
for plat in $archlist $rootarchs $usrarchs; do
if [[ $f = $time_ref ]] then
echo $age $f
echo rm $x
rm $x
if [ -f $rootprefix/etc/crypto/kcf.conf -a \
-f $rootprefix/etc/crypto/pkcs11.conf ]; then
if [ -f $rootprefix/etc/crypto/pkcs11.conf ] ; then
if [ $zone = global -a $need_datalink = yes ]; then
cd $root
test -d bfu.parent && mv bfu.parent bfu.ancestor
filelist $zone | cpio -pdmu bfu.parent 2>>$EXTRACT_LOG || \
if [ $multiboot_archives = no ]; then
if [ $have_realmode = yes ]; then
if [ -d bfu.realmode ]; then
cpio -pdmu ../bfu.ancestor 2>/dev/null )
cpio -pdmu ../bfu.realmode 2>/dev/null )
for file in $realmode_files
cd bfu.child
[ -f $actual ] || continue
[ -f $parent ] || continue
if [ -f $ancestor ] ; then
print $file >>$rootprefix/bfu.conflicts/NEW
if [ -f $pmperm ]
if [ $target_isa = i386 ] && [[ $rootslice = /dev/rdsk/* || \
$rootslice = /dev/md/rdsk/* ]]; then
if [ $multiboot_archives = yes ]; then
if [ $dca_to_multi = yes ]; then
if [ -f $rzi ]; then
if [ $new_dladm = yes ]; then
if [ -f $aggr_old ]; then
if [ -f $aggr_new ]; then
if [ $multiboot_archives = yes ]; then
if [ -f $rootprefix/etc/aggregation.conf -a \
! -d $rootprefix/kernel/mac -a \
$from_new_aggrconf = 1 ]; then
cd $root
if [ -f $epilogue ]; then
if [ -s "$local_zone_info_file" ]; then
print "\nNow for zone $zone..."
print "See $EXTRACT_LOG for details.\n"