bfu.sh revision a83cadce5d3331b64803bfc641036cec23602c74
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CDDL HEADER START
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock# The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock# Common Development and Distribution License (the "License").
fa9e4066f08beec538e775443c5be79dd423fcabahrens# You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens# See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens# and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens# information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CDDL HEADER END
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Use is subject to license terms.
55da60b91d96984f12de050ce428373ea25c7f35Mark J Musante# ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Upgrade a machine from a cpio archive area in about 5 minutes.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# By Roger Faulkner and Jeff Bonwick, April 1993.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# (bfu == Bonwick/Faulkner Upgrade, a.k.a. Blindingly Fast Upgrade)
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Usage: bfu [-f] <archive_dir> [root-dir] # for normal machines
fa9e4066f08beec538e775443c5be79dd423fcabahrens# bfu -c [-f] <archive_dir> <exec-dir> # for diskless clients
fa9e4066f08beec538e775443c5be79dd423fcabahrens# The -f flag is to override the built-in safety check which requires
fa9e4066f08beec538e775443c5be79dd423fcabahrens# that the starting-point OS be a least a certain revision.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# You have to be super-user. It's safest to run this from the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# system console, although I've run it under OW and even via
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens# remote login with no problems.
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens# You will have to reboot the system when the upgrade is complete.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# You should add any administrative files you care about to this list.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Warning: there had better be no leading '/' on any of these filenames.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
fa9e4066f08beec538e775443c5be79dd423fcabahrens# under certain circumstances, which can really screw things up; unset it.
feef89cf5f5fee792c1a396bb0e48070935cf65aVictor Latushkinif [ -z "$GATEPATH" ]; then
feef89cf5f5fee792c1a396bb0e48070935cf65aVictor Latushkin test -d $GATEPATH || GATEPATH=/net/onnv.eng/export/gate
fa9e4066f08beec538e775443c5be79dd423fcabahrensif [ -z "$ARCHIVEPATH" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens test -d $ARCHIVEPATH || ARCHIVEPATH=/net/onnv.eng/export
fa9e4066f08beec538e775443c5be79dd423fcabahrens# NOTE: Entries in *_files must expand to either the exact files required,
fa9e4066f08beec538e775443c5be79dd423fcabahrens# or to directories that will be scoured for files. Any directories
fa9e4066f08beec538e775443c5be79dd423fcabahrens# (and subdirectories) resulting from a wildcard expansion will be
fa9e4066f08beec538e775443c5be79dd423fcabahrens# fully recursed by BFU's searching for files. (E.g. /etc/inet/* will
fa9e4066f08beec538e775443c5be79dd423fcabahrens# include all files in any of its directories, as well as any files in
fa9e4066f08beec538e775443c5be79dd423fcabahrens# These lists should really be generated automatically from the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# pkgmap(4) metadata.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# First list: files to be saved in global and non-global zones.
fa9e4066f08beec538e775443c5be79dd423fcabahrens etc/net/*/services
fa9e4066f08beec538e775443c5be79dd423fcabahrens etc/saf/_sysconfig
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Second list: files to be saved in the global zone only.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Third list: files extracted from generic.root but which belong in the global
fa9e4066f08beec538e775443c5be79dd423fcabahrens# zone only: they are superfluous (and some even harmful) in nonglobal zones.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# (note: as /etc/init.d scripts are converted to smf(5) "Greenline" services,
fa9e4066f08beec538e775443c5be79dd423fcabahrens# they (and their /etc/rc?.d hardlinks) should be removed from this list when
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# they are added to smf_obsolete_rc_files, below)
614409b5be5411058e7e9b6cc93dddaff9fb13f7ahrens platform/*/kernel
fa9e4066f08beec538e775443c5be79dd423fcabahrens usr/platform/SUNW,SPARC-Enterprise/lib/dscp.ppp.options
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick usr/platform/SUNW,SPARC-Enterprise/lib/libdscp.so
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens var/svc/manifest/system/filesystem/rmvolmgr.xml
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Fourth list: files to be preserved, ie unconditionally restored to
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# "child" versions
fa9e4066f08beec538e775443c5be79dd423fcabahrens find $files -depth -type f ! -name core -print 2>/dev/null | sort -u || {
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Force cpio to return non-zero by printing an error message
fa9e4066f08beec538e775443c5be79dd423fcabahrens find $realmode_files -depth -type f ! -name core -print 2>/dev/null | sort
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -x /tmp/bfubin/svccfg ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens [ $? = 0 ] || echo "warning: unable to temporarily disable $1"
fa9e4066f08beec538e775443c5be79dd423fcabahrens [ $? = 0 ] || echo "warning: unable to enable $1 for next boot"
fa9e4066f08beec538e775443c5be79dd423fcabahrens done)" $inetconf > $inettmp && ! cmp -s $inettmp $inetconf &&
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens sed 's/^#SMFbfu# //' $inetconf > $inettmp && cp $inettmp $inetconf
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if grep '^#SMFbfu# tftp' $inetconf >/dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # BFU previously commented out, put it back in place
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens sed 's/^#SMFbfu# tftp/tftp/' $inetconf > $inettmp &&
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens elif ! grep '^[# ]*tftp' $inetconf >/dev/null; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens# TFTPD - tftp server (primarily used for booting)
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens#tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # Since inetd.conf is updated by SUNWmdr's postinstall script,
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # we will update the actual inetd.conf here to reflect the postinstall
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # only change inetd.conf if the rpc.metad entry is out of date
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if ! grep "^[# ]*100229/1-2" $inetconf > /dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # and convert spaces to tabs within the rpc entry, as well as
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if grep "^[# ]*100229/1" $inetconf > /dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens grep "^# METAD - SLVM metadb" $inetconf > $inettmp
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens echo '# METAD - SVM metadb Daemon' > $inettmp
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens echo "100229/1-2\ttli\trpc/tcp\twait\troot\t/usr/sbin/rpc.metad\trpc.metad" >> $inettmp
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens grep -v '^# METAD - SLVM metadb' $inetconf | \
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if ! diff $inetnew $inetconf > /dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens print "Updating inet.conf metad entry ... \c"
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # only change inetd.conf if the rpc.mdcommd entry is out of date
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if ! grep "^[# ]*100422/1" $inetconf > /dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # and convert spaces to tabs within the rpc entry,
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if grep "^[# ]*100422/1" $inetconf > /dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens grep "^# MDMN_COMMD - SVM Multi node" $inetconf > $inettmp
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens echo '# MDMN_COMMD - SVM Multi node communication daemon' >$inettmp
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens echo '100422/1\ttli\trpc/tcp\twait\troot\t/usr/sbin/rpc.mdcommd\trpc.mdcommd' >> $inettmp
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens grep -v '^# MDMN_COMMD - SVM Multi node' $inetconf | \
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if ! diff $inetnew $inetconf > /dev/null ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens print "Updating inetd.conf rpc.mdcommd entry ... \c"
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens# update x86 version mpt.conf for property tape
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens test -f $conffile || return
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens if [ $? -ne 0 ] ; then
3f1f80124f2b2b91c4c06303305e5badae5228e8Matthew Ahrens # update /etc/security/policy.conf with the default
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ $? = 1 ] ; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens print "Updating entries for crypt(3c), see policy.conf(4)"
fa9e4066f08beec538e775443c5be79dd423fcabahrens# crypt(3c) Algorithms Configuration
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CRYPT_ALGORITHMS_ALLOW specifies the algorithms that are allowed to
fa9e4066f08beec538e775443c5be79dd423fcabahrens# be used for new passwords. This is enforced only in crypt_gensalt(3c).
fa9e4066f08beec538e775443c5be79dd423fcabahrensCRYPT_ALGORITHMS_ALLOW=1,2a,md5
fa9e4066f08beec538e775443c5be79dd423fcabahrens# To deprecate use of the traditional unix algorithm, uncomment below
fa9e4066f08beec538e775443c5be79dd423fcabahrens# and change CRYPT_DEFAULT= to another algorithm. For example,
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CRYPT_DEFAULT=1 for BSD/Linux MD5.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#CRYPT_ALGORITHMS_DEPRECATE=__unix__
fa9e4066f08beec538e775443c5be79dd423fcabahrens# The Solaris default is the traditional UNIX algorithm. This is not
fa9e4066f08beec538e775443c5be79dd423fcabahrens# listed in crypt.conf(4) since it is internal to libc. The reserved
fa9e4066f08beec538e775443c5be79dd423fcabahrens# name __unix__ is used to refer to it.
fa9e4066f08beec538e775443c5be79dd423fcabahrensCRYPT_DEFAULT=__unix__
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ $? = 1 ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens# These settings determine the default privileges users have. If not set,
fa9e4066f08beec538e775443c5be79dd423fcabahrens# the default privileges are taken from the inherited set.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# There are two different settings; PRIV_DEFAULT determines the default
fa9e4066f08beec538e775443c5be79dd423fcabahrens# set on login; PRIV_LIMIT defines the Limit set on login.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Individual users can have privileges assigned or taken away through
fa9e4066f08beec538e775443c5be79dd423fcabahrens# user_attr. Privileges can also be assigned to profiles in which case
fa9e4066f08beec538e775443c5be79dd423fcabahrens# the users with those profiles can use those privileges through pfexec(1m).
fa9e4066f08beec538e775443c5be79dd423fcabahrens# For maximum future compatibility, the specifications should
fa9e4066f08beec538e775443c5be79dd423fcabahrens# always include "basic" or "all"; privileges should then be removed using
fa9e4066f08beec538e775443c5be79dd423fcabahrens# the negation. E.g., PRIV_LIMIT=all,!sys_linkdir takes away only the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# sys_linkdir privilege, regardless of future additional privileges.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Similarly, PRIV_DEFAULT=basic,!file_link_any takes away only the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# file_link_any privilege from the basic privilege set; only that notation
fa9e4066f08beec538e775443c5be79dd423fcabahrens# is immune from a future addition of currently unprivileged operations to
fa9e4066f08beec538e775443c5be79dd423fcabahrens# the basic privilege set.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# NOTE: removing privileges from the the Limit set requires EXTREME care
fa9e4066f08beec538e775443c5be79dd423fcabahrens# as any set-uid root program may suddenly fail because it lacks certain
fa9e4066f08beec538e775443c5be79dd423fcabahrens# privilege(s).
fa9e4066f08beec538e775443c5be79dd423fcabahrens#PRIV_DEFAULT=basic
fa9e4066f08beec538e775443c5be79dd423fcabahrens#PRIV_LIMIT=all
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Cleanup nfsmapid configuration before extracting
fa9e4066f08beec538e775443c5be79dd423fcabahrens# root bits. Remove if they exist:
fa9e4066f08beec538e775443c5be79dd423fcabahrens# nfsmapid entry in inetd.conf
fa9e4066f08beec538e775443c5be79dd423fcabahrens# nfsmapid entry in /etc/net/ti*/services
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Going forward neither should exist, but no harm if services entry exists
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Going way backwards (pre-04/28/2004), inetd.conf must exist but will
fa9e4066f08beec538e775443c5be79dd423fcabahrens# be a conflict that should be merged in
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Define global variables
fa9e4066f08beec538e775443c5be79dd423fcabahrens# List of SDS commands that must be deleted.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# List of SDS configuration files that must be deleted.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# List of rc scripts that must be deleted.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# List of flashprom-related files that must be deleted.
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrensusr/platform/SUNW,Ultra-Enterprise/lib/flash-update.sh
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# delete the entries associated with bootlist from /etc/system
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling sed -e /"Begin MDD database info"/,/"End MDD database info"/d \
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling echo "copy error: /tmp/system.$$ to ${SYSTEM_FILE}"
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# Add entries in md.conf for bootlist
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling echo "# Begin MDD database info (do not edit)" >> /tmp/md.conf.$$
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling sed -e 's/^set md://' -e 's/$/;/' ${SYSTEM_FILE} | \
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling echo "# End MDD database info (do not edit)" >> /tmp/md.conf.$$
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# add_devid_destroy(filename)
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# returns contents in filename
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# md_devid_destroy property is required when upgrading
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# from pre SVM to SVM releases or when the device ID returned from
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# the driver changes.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# It is specifically placed between
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# # Begin MDD database info and # End MDD database info because
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# on the subsequent reboot, this line will be removed automatically when
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# metadevadm is run in rc2.d.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling if ( $2 == "End" && $4 == "database") {
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling print "md_devid_destroy=1;"
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# Reads existing configuration values in /etc/rcap.conf and puts
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# them in repository upon reboot(via /var/svc/profile/upgrade).
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling PROFILE_UPGRADE="${rootprefix}/var/svc/profile/upgrade"
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling pressure=`awk '$1 == "RCAPD_MEMORY_CAP_ENFORCEMENT_PRESSURE" \
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling reconfig_int=`awk '$1 == "RCAPD_RECONFIGURATION_INTERVAL" \
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling walk_int=`awk '$1 == "RCAPD_PROC_WALK_INTERVAL" && \
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling report_int=`awk '$1 == "RCAPD_REPORT_INTERVAL" && \
44cb6abc89aa591c23f5e58296c6d2a29302344abmc rss_sample_int=`awk '$1 == "RCAPD_RSS_SAMPLE_INTERVAL" && \
91ebeef555ce7f899b6270a3c2df47b51f7ad59aahrens echo "# Migrating pre-existing rcap configuration" >> \
44cb6abc89aa591c23f5e58296c6d2a29302344abmc echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/pressure = " \
9253d63df408bb48584e0b1abfcc24ef2472382eGeorge Wilson "setprop ${PG}/reconfig_interval = $reconfig_int" >> \
44cb6abc89aa591c23f5e58296c6d2a29302344abmc "setprop ${PG}/rss_sample_interval = $rss_sample_int" >> \
91ebeef555ce7f899b6270a3c2df47b51f7ad59aahrens# smf(5) "Greenline" doesn't install the init.d or rc*.d scripts for
91ebeef555ce7f899b6270a3c2df47b51f7ad59aahrens# converted services. Clean up previous scripts for such services.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Obsolete smf manifests
fa9e4066f08beec538e775443c5be79dd423fcabahrens# smf services whose manifests have been renamed
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Obsolete smf methods
fa9e4066f08beec538e775443c5be79dd423fcabahrens [[ -x /tmp/bfubin/svccfg ]] || return 0
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ ! -f \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $rootprefix/var/svc/profile/platform_SUNW,Sun-Fire.xml \
fa9e4066f08beec538e775443c5be79dd423fcabahrensselect smf/manifest
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrockdelpg ${pfx}ar_svc_profile_platform_${plname}_xml
fa9e4066f08beec538e775443c5be79dd423fcabahrens # default-enabled-in-profile services. If so, add a command
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock if [ ! -f $rootprefix/var/svc/profile/system/sac.xml ]; then
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock ! -f $rootprefix/var/svc/manifest/system/intrd.xml ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens ! -f $rootprefix/var/svc/manifest/system/scheduler.xml ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens ! -f $rootprefix/var/svc/manifest/system/hal.xml ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens ! -f $rootprefix/var/svc/manifest/system/filesystem/rmvolmgr.xml ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo /usr/sbin/svcadm enable system/filesystem/rmvolmgr >> \
fa9e4066f08beec538e775443c5be79dd423fcabahrens ! -f $rootprefix/var/svc/manifest/network/ipsec/manual-key.xml &&
fa9e4066f08beec538e775443c5be79dd423fcabahrens ! -f $rootprefix/var/svc/manifest/network/ipsec/ike.xml &&
b87f3af36bb994656da117319f5129ddfd05ed21perrin ! -f $rootprefix/var/svc/manifest/system/pools.xml &&
b87f3af36bb994656da117319f5129ddfd05ed21perrin if [[ ! -f $mymfs ]] || ! cmp -s $manifest_src/$1 $mymfs ; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens [ -f $mfst ] || return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -r /etc/svc/volatile/repository_door ]; then
614409b5be5411058e7e9b6cc93dddaff9fb13f7ahrens echo "svcadm enable $*" >> $rootprefix/var/svc/profile/upgrade
fa9e4066f08beec538e775443c5be79dd423fcabahrens [[ -f $rootprefix/$repository ]] || return
fa9e4066f08beec538e775443c5be79dd423fcabahrens sqlite="${SQLITEBIN-$GATE/public/bin/$bfu_isa/sqlite}"
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ ! -x $sqlite ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ $? -eq 0 ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ $force_override = no ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrensReseed the repository (see http://greenline.eng/quickstart.shtml#newrep)
c5904d138f3bdf0762dbf452a43d5a5c387ea6a8eschrockbefore BFUing (or use the -f flag to force BFU to continue). Re-seeding
fa9e4066f08beec538e775443c5be79dd423fcabahrenswill lose all smf(5) customizations.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print "*************************************************************"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " WARNING: BFU'ing $1 backwards across 5090532."
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " Fixes have been made but the services cannot be refreshed"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " on the $1's inactive repository. Next boot for the"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " $1 will probably result in maintenance mode due to"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " dependency cycles. If so, at the $1's console, run:"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " /usr/sbin/svcadm refresh system/sysidtool:system"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " /usr/sbin/svcadm refresh system/sysidtool:net"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " /usr/sbin/svcadm clear milestone/single-user"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " /usr/sbin/svcadm clear system/sysidtool:system"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print " To avoid these problems, reseed the zone's repository."
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens print " See http://greenline.eng/quickstart.shtml#newrep ."
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens print " Note: Re-seeding will lose all smf(5) customization."
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens print "*************************************************************"
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Return success if going to post-5090532, i.e. post-sysconfig bits
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # By now, we're going to post-smf bits - so multi-user.xml must
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # exist (since it was introduced by first SMF putback).
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Function return status is return status of last command executed.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # So, no need to check return status from grep below.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens grep sysconfig $rootprefix/var/svc/manifest/milestone/multi-user.xml \
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Check if bfu'ing back from post-5090532 to pre-5090532 bits.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens if [[ -f $rootprefix/var/svc/manifest/milestone/sysconfig.xml ]] &&
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Perform the necessary corrections when bfu'ing backwards
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Get the pre-5090532 non-ON manifests, and issue minimal fixes
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens smf_copy_manifest pre-5090532/kdmconfig.xml platform/i86pc
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Now, remove sysidtool:{system, net}'s dependency on
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # If $rootprefix is not empty, this could be the global zone,
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # with an alternate root BFU, or a non-global zone. For either
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # case, the repository to be updated is not the live one: use
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # SVCCFG_REPOSITORY to point to the repository to be updated.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Note that in the alternate-root case, doing this seems better
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # than forcing the user to re-seed, or to dis-allow it. The
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # issue of svccfg and the repository not matching seems remote,
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # given that from initial SMF integration (on10_64) to on10_74,
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # there was no mismatch. In the remote possibility that there is a
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # mis-match (in the future) causing these calls to be suspect,
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # the user is already being advised, via the warning message, to
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # reseed the repository in case of trouble. If a mis-match is ever
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # introduced, code such as this would have to be fixed, so this
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # aspect of the warning is useful only during the interim period.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # NOTE that this is not an issue for non-global zones'
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ -n $rootprefix ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens export SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ $zone = global ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Using the newer "-s" option to svccfg in the following is OK
fa9e4066f08beec538e775443c5be79dd423fcabahrens # since its introduction preceded 5090532 (and this routine wouldn't
fa9e4066f08beec538e775443c5be79dd423fcabahrens # be called unless the machine is running post-5090532 bits).
fa9e4066f08beec538e775443c5be79dd423fcabahrens /tmp/bfubin/svccfg -s system/sysidtool:net delpg single-user
fa9e4066f08beec538e775443c5be79dd423fcabahrens /tmp/bfubin/svccfg -s system/sysidtool:system delpg single-user
fa9e4066f08beec538e775443c5be79dd423fcabahrens /tmp/bfubin/svccfg -s system/sysidtool:net delpg filesystem_local
fa9e4066f08beec538e775443c5be79dd423fcabahrens /tmp/bfubin/svccfg -s system/sysidtool:system delpg filesystem_local
fa9e4066f08beec538e775443c5be79dd423fcabahrens # On a live system, issue the refresh; For alternate root or non-global
fa9e4066f08beec538e775443c5be79dd423fcabahrens # zone, the user was asked to issue the refreshes and "clear"s in the
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ -z $rootprefix ]]; then
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens [[ -n $rootprefix ]] && unset SVCCFG_REPOSITORY
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # Remove the sysconfig.xml manifest when going back. So backward
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # bfu check continues to work, and all manifests are correct.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens rm -f /var/svc/manifest/milestone/sysconfig.xml
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens# Return true if $file exists in $archive. $file may also be a pattern.
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens $ZCAT $cpiodir/${archive}${ZFIX} | cpio -it 2>/dev/null | \
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens# If we're no longer delivering the eeprom service, remove it from the system,
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens# as eeprom -I is removed as well.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens if ! archive_file_exists generic.root "^$profile"; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ ! -f $rootprefix/$mfst ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # we must disable via svccfg directly, as manifest-import runs after
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens export SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Go thru the original manifests and move any that were unchanged
fa9e4066f08beec538e775443c5be79dd423fcabahrens # (or are not system-provided) back to their proper location. This
fa9e4066f08beec538e775443c5be79dd423fcabahrens # will avoid superfluous re-import on reboot, as the inode and mtime
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -d $rootprefix/$old_mfst_dir ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens for f in `cd $rootprefix/$old_mfst_dir ; find . -type f`
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [ ! -f $new ]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [ -f $rootprefix/etc/init.d/inetd ]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # BFUing to non-SMF system -- undo our previous changes,
fa9e4066f08beec538e775443c5be79dd423fcabahrens # run an old hack, and skip the remainder of this function.
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # At this point, the archive in question is a SMF version. If
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # the smf(5) repository does not yet exist, create it by copying
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # the appropriate seed repository. Since updating of non-global
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # zones only occurs when the live system is bfu'ed, the
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrens # appropriate seed is guaranteed to exist under the /lib
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ ! -f $repository ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens print "Initializing service configuration repository ..."
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ $zone = global ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ $need_datalink = no ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens print "Connecting platform and name service profiles ..."
fa9e4066f08beec538e775443c5be79dd423fcabahrens grep ldap $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
fa9e4066f08beec538e775443c5be79dd423fcabahrens grep nisplus $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
fa9e4066f08beec538e775443c5be79dd423fcabahrens grep nis $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ $is_ldap = 0 ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens elif [ $is_nisplus = 0 ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens elif [ $is_nis = 0 ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens ln -s $ns_profile $rootprefix/var/svc/profile/name_service.xml
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock rm -f $rootprefix/var/svc/profile/inetd_services.xml
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock ln -s inetd_upgrade.xml $rootprefix/var/svc/profile/inetd_services.xml
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock print "Marking converted services as enabled ..."
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock [ -f $rootprefix/etc/resolv.conf ] && smf_enable network/dns/client
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock # Not concerned about enabling/disabling rcap but will migrate
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock if [ -f $rootprefix/etc/rcap.conf ]; then
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock if [ $zone = global ]; then
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock echo "/usr/sbin/svcadm disable network/nfs/server" >> \
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock [ -f $rootprefix/etc/inet/ntp.conf ] && smf_enable network/ntp
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock domainname=`cat $rootprefix/etc/defaultdomain 2>/dev/null`
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock if [ ! -z "$domainname" -a -d $rootprefix/var/yp/$domainname ]; then
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock # Determining whether we're a NIS master requires
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock cat >>$rootprefix/var/svc/profile/upgrade <<\_EOF
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock# Determine whether we are a YP master.
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrockhostname=`uname -n | cut -d. -f1 | tr '[A-Z]' '[a-z]'`
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrockif [ -x /usr/sbin/makedbm ]; then
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock if [ -f /var/yp/NISLDAPmapping ]; then
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock master=`/usr/sbin/makedbm -u /var/yp/\$domain/LDAP_passwd.byname | grep YP_MASTER_NAME | nawk '{ print $2 }'`
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock master=`/usr/sbin/makedbm -u /var/yp/\$domain/passwd.byname | grep YP_MASTER_NAME | nawk '{ print $2 }'`
fa9e4066f08beec538e775443c5be79dd423fcabahrens# If we are the master server, enable appropriate services.
fa9e4066f08beec538e775443c5be79dd423fcabahrensif [ "$master" = "$hostname" -a "$YP_SERVER" = "TRUE" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ ! -f /var/yp/NISLDAPmapping ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens [ -f /var/yp/updaters ] && \
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock # Check if mddbs don't exist on the image. If so, disable SVM services.
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -f $rootprefix/kernel/drv/md.conf ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ $MDDB_STATUS -ne 0 ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo "/usr/sbin/svcadm disable system/$svc:default" >> \
088e9d477eee66081e407fbc5a33c4da25f66f6aeschrock echo "/usr/sbin/svcadm disable network/rpc/$svc:default" \
088e9d477eee66081e407fbc5a33c4da25f66f6aeschrock # Workaround inetd's handling of "tcp6/udp6" when no IPv6 interfaces
c5904d138f3bdf0762dbf452a43d5a5c387ea6a8eschrock echo "/usr/sbin/inetadm -m network/rpc/$svc:default proto=tcp" \
c5904d138f3bdf0762dbf452a43d5a5c387ea6a8eschrock ">/dev/null 2>&1" >> $rootprefix/var/svc/profile/upgrade
c5904d138f3bdf0762dbf452a43d5a5c387ea6a8eschrock [[ -d $manifest_src ]] || manifest_src=/net/greenline.eng/meta0/smf
ec9f632e53cc822267588170e45d89b9dc72153fEric Schrock echo "BFU'ing backwards across 5090532! Now repairing..."
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # If bfu'ing milestone/sysconfig bits or onwards, update the
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # corresponding non-ON manifests - sysidtool and kdmconfig.
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock sysidmfst=$rootprefix/var/svc/manifest/system/sysidtool.xml
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock kdmmfst=$rootprefix/var/svc/manifest/platform/i86pc/kdmconfig.xml
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock if [[ ! -f $sysidmfst ]]; then
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock smf_copy_manifest post-5090532/sysidtool.xml system
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock if [[ $zone = global ]]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # must occur in the dir: $manifest_src/post-5090532
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore smf_copy_manifest post-5090532/sysidtool.xml system
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [[ $zone = global && $karch = i86pc ]]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [[ ! -f $kdmmfst ]]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # if WOS build on machine is pre-greenline, and
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens smf_copy_manifest post-5090532/kdmconfig.xml \
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock if [[ ! -f $sysidmfst ]]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore smf_copy_manifest pre-5090532/sysidtool.xml system
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock if [[ $zone = global ]]; then
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock if [[ $zone = global && $karch = i86pc && ! -f $kdmmfst ]];
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # If we've still got the old dtlogin manifest delivered by earlier
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # versions of bfu, delete it, as it was broken and should have
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # never been delivered. A new version delivered by the CDE
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [[ -f $rootprefix/var/svc/manifest/application/dtlogin.xml &&
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens $rootprefix/var/svc/manifest/application/dtlogin.xml` -gt 0 &&
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore rm -f $rootprefix/var/svc/manifest/application/dtlogin.xml
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # Delete the service from repository, then use dtconfig -e to
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # revert to whatever the WOS bits are using if dtlogin was
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore cat >> $rootprefix/var/svc/profile/upgrade <<-EOFA
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Mooreif /usr/bin/svcprop -q application/cde-login; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [ \`/usr/bin/svcprop -p general/enabled \
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore application/cde-login:default\` = "true" ]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore do_dtconfig=1;
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore do_dtconfig=0;
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock /usr/sbin/svccfg delete -f application/cde-login
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore type instance_refresh 2>&1 > /dev/null
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [ \$? = 0 ]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens instance_refresh system/console-login
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens /usr/sbin/svcadm refresh system/console-login
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [ \$do_dtconfig -eq 1 -a -x /usr/dt/bin/dtconfig ]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore /usr/dt/bin/dtconfig -e
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # Enable the inetd-upgrade service to convert any changes to inetd.conf
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # If global zone, and bfu'ing from smf, and the inetd-upgrade
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # service has an obsolete dependency, then add a clear of inetd
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # and inetd-upgrade to the upgrade file as either may drop into
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # maintenance due to a dependency loop resulting from the new
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [[ $zone = global && -x /tmp/bfubin/svccfg ]]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore /tmp/bfubin/svcprop -q -p network/entities network/inetd-upgrade
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [[ $? = 0 ]]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore echo "/usr/sbin/svcadm clear network/inetd-upgrade" >> \
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # If we're in the global zone, and using an alternate root, see if
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # we are in an smf root. If so, import name-service-cache. If we're
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # not bfu'ing an alternate root, and we're post-smf, import
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # name-service-cache. This is to get name-service-cache(with correct
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # dependencies) in the repository before reboot. If we're bfu'ing
fac3008cc3156093d29951128c236e1a6c4bc0e8eschrock # from pre-smf, this isn't an issue, as name-service-cache will be
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore -f $rootprefix/var/svc/manifest/system/name-service-cache.xml ]];
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [[ -n $rootprefix ]]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [ -x /usr/sbin/svccfg ]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore $rootprefix/var/svc/manifest/system/name-service-cache.xml
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock echo "Warning: This system does not have SMF, so I "
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock echo "name-service-cache. If name-service-cache does "
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore echo "not work, reboot your alternate root to fix it."
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore elif [ -x /tmp/bfubin/svccfg ]; then
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # If we're in the global zone, and using an alternate root, see if
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # we are in an smf root. If so, import datalink and aggregation svcs.
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # If we're not bfu'ing an alternate root, and we're post-smf,
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # import datalink and aggregation. This is to get them
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # in the repository before reboot. If we're bfu'ing from pre-smf,
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore # this isn't an issue, as they are in the seed repository.
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore -f $rootprefix/var/svc/manifest/network/datalink.xml ]]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [[ -n $rootprefix ]]; then
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock if [ -x /usr/sbin/svccfg ]; then
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore $rootprefix/var/svc/manifest/network/aggregation.xml \
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore $rootprefix/var/svc/manifest/network/datalink.xml \
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock $rootprefix/var/svc/manifest/network/datalink-init.xml \
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock echo "Warning: This system does not have SMF, so I"
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock echo "cannot ensure the pre-import of datalink and"
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock elif [ -x /tmp/bfubin/svccfg ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Enable new NFS status and nlockmgr services if client is enabled
fa9e4066f08beec538e775443c5be79dd423fcabahrens cl="svc:/network/nfs/client:default"
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ \`/usr/bin/svcprop -p general/enabled \$cl\` = "true" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens /usr/sbin/svcadm enable svc:/network/nfs/status:default
fa9e4066f08beec538e775443c5be79dd423fcabahrens /usr/sbin/svcadm enable svc:/network/nfs/nlockmgr:default
fa9e4066f08beec538e775443c5be79dd423fcabahrens kpmani="$rootprefix/var/svc/manifest/network/security/krb5_prop.xml"
fa9e4066f08beec538e775443c5be79dd423fcabahrens if grep svc-kdc.slave $kpmani > /dev/null 2>&1; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # We are deleting and reimporting kpropd's manifest, because we
fa9e4066f08beec538e775443c5be79dd423fcabahrens # need to change the restarter.
fa9e4066f08beec538e775443c5be79dd423fcabahrens kpfmri="svc:/network/security/krb5_prop"
fa9e4066f08beec538e775443c5be79dd423fcabahrens kkfmri="svc:/network/security/krb5kdc:default"
fa9e4066f08beec538e775443c5be79dd423fcabahrens lkpmani="/var/svc/manifest/network/security/krb5_prop.xml"
fa9e4066f08beec538e775443c5be79dd423fcabahrens restarter=\`svcprop -c -p general/restarter \$kpfmri 2>&1\`
fa9e4066f08beec538e775443c5be79dd423fcabahrens case \$restarter in
fa9e4066f08beec538e775443c5be79dd423fcabahrens *network/inetd:default)
fa9e4066f08beec538e775443c5be79dd423fcabahrens kken=\`svcprop -c -p general/enabled \$kkfmri\`
fa9e4066f08beec538e775443c5be79dd423fcabahrens svccfg delete -f \$kpfmri
fa9e4066f08beec538e775443c5be79dd423fcabahrens svccfg import \$lkpmani
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Enable kpropd if krb5kdc is enabled, since
fa9e4066f08beec538e775443c5be79dd423fcabahrens # krb5kdc would have run kpropd
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ \$kken = "true" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens svcadm enable \$kpfmri
fa9e4066f08beec538e775443c5be79dd423fcabahrens queues=`echo $rootprefix/etc/lp/printers/*/configuration`
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ "$queues" != "$rootprefix/etc/lp/printers/*/configuration" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Enable rarpd and bootparamd if they would have been running pre-SMF
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -d $rootprefix/tftpboot ] || [ -d $rootprefix/rplboot ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # To handle the transition from pre-smf ipfilter to smf-aware ipfilter,
fa9e4066f08beec538e775443c5be79dd423fcabahrens # check if ipfilter had been enabled with at least one rule, and if so
fa9e4066f08beec538e775443c5be79dd423fcabahrens if grep '^[ \t]*[^# \t]' $rootprefix/etc/ipf/ipf.conf >/dev/null 2>&1 &&
fa9e4066f08beec538e775443c5be79dd423fcabahrens [[ $zone = global ]]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # We are deleting and reimporting dcs's manifest, because we
fa9e4066f08beec538e775443c5be79dd423fcabahrens # need to change the restarter.
fa9e4066f08beec538e775443c5be79dd423fcabahrens dcsfmri="svc:/platform/sun4u/dcs:default"
fa9e4066f08beec538e775443c5be79dd423fcabahrens dcsmani="/var/svc/manifest/platform/sun4u/dcs.xml"
fa9e4066f08beec538e775443c5be79dd423fcabahrens restarter=\`svcprop -c -p general/restarter \$dcsfmri 2>&1\`
fa9e4066f08beec538e775443c5be79dd423fcabahrens case \$restarter in
fa9e4066f08beec538e775443c5be79dd423fcabahrens *network/inetd:default)
fa9e4066f08beec538e775443c5be79dd423fcabahrens en=\`svcprop -c -p general/enabled \$dcsfmri\`
fa9e4066f08beec538e775443c5be79dd423fcabahrens svccfg delete -f \$dcsfmri
fa9e4066f08beec538e775443c5be79dd423fcabahrens svccfg import \$dcsmani
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ \$en = "true" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens svcadm enable \$dcsfmri
fa9e4066f08beec538e775443c5be79dd423fcabahrens# The directboot putback moved the console property from
fa9e4066f08beec538e775443c5be79dd423fcabahrens# /boot/solaris/bootenv.rc to /boot/grub/menu.lst. It should be kept in both.
fa9e4066f08beec538e775443c5be79dd423fcabahrens bootenv_console=`grep '^setprop[ ]\{1,\}console\>' $bootenvrc`
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -n "$menu_console" ] && [ -z "$bootenv_console" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Make a local copy of bfu in /tmp and execute that instead.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# This makes us immune to loss of networking and/or changes
fa9e4066f08beec538e775443c5be79dd423fcabahrens# to the original copy that might occur during execution.
fa9e4066f08beec538e775443c5be79dd423fcabahrens print "Copying $abspath to $localpath"
fa9e4066f08beec538e775443c5be79dd423fcabahrens print "Executing $localpath $*\n"
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo "\tUpdate a single machine by loading archives on root-dir."
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo "\tUpdate all diskless clients by loading archives on each client"
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo "\tthat mounts exec-dir as /usr. <exec-dir> must start with"
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo "\t/export/exec and each client's root must be in /export/root.\n"
fa9e4066f08beec538e775443c5be79dd423fcabahrens echo "\t-f force bfu to continue even if it doesn't seem safe"
fa9e4066f08beec538e775443c5be79dd423fcabahrens fail "\t-h|-help print this usage message and exit\n"
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# Variables for x86 platforms
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# Set when moving to either directboot or multiboot
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# Shows which type of archives we have, which type of system we are
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# running on (before the bfu), and what the failsafe archives are
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# (again, before the bfu). failsafe_type is only needed on diskful
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# bfu's, so it's not set in the diskless case.
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock# Possible values: unknown, dca, multiboot, directboot
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # We prefer to use ppriv, as it is a more accurate test, and also
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # has the benefit of preventing use from within a nonglobal zone.
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock # Fall back to old id check if system does not yet have ppriv.
ccae0b50330edda9b094cee1ec6a0ad35443e8b0eschrock cpiodir=`nawk '/^bfu.ed from / { print $3; exit }' /etc/motd`
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens[[ "$cpiodir" = */* ]] || cpiodir=$ARCHIVE/archives/$target_isa/$1
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens[[ "$cpiodir" = /* ]] || fail "archive-dir must be an absolute path"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens *) fail "generic.root missing or in unknown compression format";;
ff64c0f7947882a0dbee45c31d69cb30bd003e5fMatthew Ahrens# Determine what kind of archives we're installing, using the following rules:
ff64c0f7947882a0dbee45c31d69cb30bd003e5fMatthew Ahrens# 1. If strap.com is present, the archives are pre-multiboot
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens# 2. If symdef is present, the archives are directboot
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens# 3. Otherwise, the archives are multiboot
ff64c0f7947882a0dbee45c31d69cb30bd003e5fMatthew Ahrens archive_file_exists i86pc.boot "strap.com"; then
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens [[ "$root" = /* ]] || fail "root-dir must be an absolute path"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens fail "$root/etc/system not found; nonglobal zone target not allowed"
ff64c0f7947882a0dbee45c31d69cb30bd003e5fMatthew Ahrens # Make sure we extract the sun4u-us3 libc_psr.so.1
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens if [ $karch != $plat -a -f ${cpiodir}/${plat}.usr$ZFIX ]; then
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens if [ $karch != $plat -a -f ${cpiodir}/${plat}.root$ZFIX ]; then
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens if [ $plat != $karch -a -f ${cpiodir}/${plat}.root$ZFIX \
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # Look through all the archives we build and match
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # the names of built archives with the names of
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # directories installed on this machine. We assume
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # here that we can get the names of all architectures
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # by pattern matching the names of .root archives - so
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # if we ever had a case where we had only a .usr archive
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # we wouldn't find that archive.
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [ -z "${platname}" -o ${platname} = $karch -o \
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens $platname = generic -o ${platname} = $plat ]; then
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens rootslice=`df -k $root | nawk 'NR > 1 { print $1 }' | sed s/dsk/rdsk/`
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens print "Loading $cpiodir on $root"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens [[ "$usr" = /export/exec/* ]] || fail "exec-dir $usrroot sounds bogus"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens test -f generic.root$ZFIX || fail "$cpiodir/generic.root$ZFIX missing"
ad135b5d644628e791c3188a6ecbd9c257961ef8Christopher Siden allarchs=$(echo $(ls *.root$ZFIX | grep -v generic.root$ZFIX | \
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # XXX Pick karch as last available root arch
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens # XXX Pick plat as first available root arch
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens test -n "$rootlist" || fail "no clients to upgrade"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens print "Loading $cpiodir usr archives on:\n\t$usr\n"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens print "Loading $cpiodir root archives on:"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrensif grep '^[ ]*zfsroot:' $root/etc/system >/dev/null && \
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens archive_file_exists i86pc.boot boot/grub/zfs_stage1_5; then
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "Cannot BFU a system with the mountroot version"\
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens "of zfs boot support."
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "For information on how to transition this system to the new"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "zfs boot support, see:"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "http://www.opensolaris.org/os/community/zfs/boot/zfsboot-manual/mntroot-transition/"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrensvalid_rpath="\$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "/usr/bin/ldd is missing but -f is set; continuing."
ff64c0f7947882a0dbee45c31d69cb30bd003e5fMatthew Ahrens echo "/usr/bin/ldd is missing."
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrensnss_rpath=`ldd -s $nss_lib | egrep "$rpath_msg" | head -1 | cut -d'=' -f2 | \
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrensupdate_script="/ws/onnv-gate/public/bin/update_nsspkgs"
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "$nss_lib is not valid but -f is set; continuing."
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "$nss_lib is not valid."
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens fail "Run $update_script to update the SUNWtls package."
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrensif [ $target_isa = i386 -a ! -f $nss_lib64 ]; then
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens echo "$nss_lib64 does not exist."
88b7b0f29b20b808b9e06071885b1d6a3ddb6328Matthew Ahrens fail "Run $update_script to update the NSS packages."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensupdate_script="/ws/onnv-gate/public/bin/migrate_bind9"
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensif [[ ! -f $usr/lib/dns/libdns.so ]] && ! $ZCAT $cpiodir/generic.usr$ZFIX | \
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens cpio -it 2>/dev/null | egrep -s '^usr/sbin/ndc' ; then
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens echo "BIND 9 has not been installed, but -f is set; continuing."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens echo "BIND 8 has been removed from ON; BIND 9 is available from SFW."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens fail "Run $update_script to migrate to BIND 9."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensupdate_script="/ws/onnv-gate/public/bin/update_ce"
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensif ifconfig -a | egrep '^ce' >/dev/null 2>/dev/null; then
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens # CE version 1.148 or later is required
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens cever=`modinfo | grep 'CE Ethernet' | sed 's/.*v1\.//' | tr -d ')' | \
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens nawk '{ if ($1 < 148) print "BAD"; else print $1 }'`
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens fail "You must run $update_script to upgrade your ce driver."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensupdate_script="/ws/onnv-gate/public/bin/update_dbus"
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens# We need biosdev if we're moving from pre-multiboot to multiboot or directboot
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensif [ $target_isa = i386 ] && [ $multi_or_direct = yes ] && [ $diskless = no ]
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens if [ $? -ne 0 ] && [ ! -f $rootprefix/platform/i86pc/multiboot ]; then
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens echo "biosdev cannot be run on this machine."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens echo "Transitioning from classic to multiboot requires a"
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens echo "bootconf which is compatible with biosdev."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens echo "bfu to onnv_12 first, then to a build with multiboot."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensif $ZCAT $cpiodir/generic.root$ZFIX | cpio -it 2>/dev/null | \
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens# Check whether the archives have an etc/dladm directory; this is
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens# later used to determine if aggregation.conf needs to be moved.
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensif $ZCAT $cpiodir/generic.root$ZFIX | cpio -it 2>/dev/null | \
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrenstouch $time_ref || fail "$time_ref: Unable to create time reference."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrensprint "\nCreating bfu execution environment ..."
9966ca11f4a1481acce85f690fa59e4084050627Matthew Ahrens# Save off a few critical libraries and commands, so that bfu will
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# continue to function properly even in the face of major
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# kernel/library/command incompatibilities during a live upgrade.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum ${FASTFS-$GATE/public/bin/$bfu_isa/fastfs}
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens ${GZIPBIN-$GATE/public/bin/$bfu_isa/gzip}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# Scripts needed by BFU. These must be modified to use the interpreters in
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# /tmp/bfubin. The interpreters in /usr/bin may not be compatible with the
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# libraries in the archives being extracted.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum ${ACR-${GATE}/public/bin/acr}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# basename and dirname may be ELF executables, not shell scripts;
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# make sure they go into the right list.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaumif `file /usr/bin/basename | grep ELF >/dev/null`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaumif `file /usr/bin/dirname | grep ELF >/dev/null`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum isacmd=`(find $isalist -name $cmd 2>/dev/null; echo $cmd) | head -1`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum cp $dir/$isacmd /tmp/bfubin || fail "cannot copy $dir/$isacmd"
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# Optional commands. We warn, but do not abort, if we are crossing a
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# feature boundary (where a command is not present in the parent).
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# Clauses requiring these commands must explicitly test for their
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# presence in /tmp/bfubin.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum isacmd=`(find $isalist -name $cmd 2>/dev/null; echo $cmd) | head -1`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# set up installgrub and friends if transitioning to multiboot or directboot
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# do this now so ldd can determine library dependencies
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# We split the binaries into two groups: the type where we want to make any
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# effort to get the newest version (like symdef and bootadm), and the type
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# where any old version will do (like installgrub and biosdev).
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# If we're bfu'ing across the directboot/multiboot boundary, we need the new
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# bootadm and symdef to properly handle menu.lst changes. If the system is
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# directboot, we can use the local copies. If the system is multiboot but
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# the archives are directboot, we extract the binaries early. Otherwise,
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# we're not crossing the boundary, and which one we use doesn't matter.
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# NB - if bootadm or symdef is ever changed to require a new library, the
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# early extraction will blow up horribly.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# For testing purposes, a user can set DIRECTBOOT_BIN_DIR in the environment,
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# and we'll use that instead.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark ShellenbaumMULTIBOOT_BIN_DIR=${MULTIBOOT_BIN_DIR:=${GATE}/public/multiboot}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaumif [ -x $root/boot/solaris/bin/symdef ] && \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum $root/boot/solaris/bin/symdef $root/platform/i86pc/kernel/unix dboot_image
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# A comma-separated list of the command and the archive it's in
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -x $cmd ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # If all else fails, grab the local version
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ $archive_type = directboot ] && [ $root_is_directboot = yes ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -f $cmd ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ ! -d $MULTIBOOT_BIN_DIR ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum echo "$MULTIBOOT_BIN_DIR: not found"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum elif [ ! -f $MULTIBOOT_BIN_DIR/$file ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum echo "$MULTIBOOT_BIN_DIR/$file: not found"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum echo "installing files from $MULTIBOOT_BIN_DIR"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# If available, use ldd to determine which libraries bfu depends on.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# Otherwise, just make an educated guess.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum bfulib="`ldd /tmp/bfubin/* | nawk '$3 ~ /lib/ { print $3 }' | sort -u`"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# add dlopen()'ed stuff
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# add libc_psr.so.1, if available and not empty
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaumif [ -s /platform/`uname -i`/lib/libc_psr.so.1 ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# Create 64 bit directory structure and determine 64 bit arch name.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum link=`ls -dl /usr/lib/64 | awk '{print $NF}'`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # Copy libraries to proper directories
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # Private 64 bit runtime linker.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaumcp /lib/ld.so.1 /tmp/bfulib/bf.1 # bfu's private runtime linker
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum${BFULD-$GATE/public/bin/$bfu_isa/bfuld} /tmp/bfubin/* || fail "bfuld failed"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum -e 's/\/bin\//\/tmp\/bfubin\//g' < $x > /tmp/bfubin/`basename $x`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# scripts used together with multiboot
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -f $cmd ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ ! -d $MULTIBOOT_BIN_DIR ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum echo "$MULTIBOOT_BIN_DIR: not found"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum echo "$MULTIBOOT_BIN_DIR/$file: not found"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum echo "copying $file from $MULTIBOOT_BIN_DIR"
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # We do two substitutions here to replace references to
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # both /usr/bin/ and /bin/ with /tmp/bfubin/
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum mv /tmp/bfubin/${file} /tmp/bfubin/${file}-
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum -e 's/\/bin\//\/tmp\/bfubin\//g' \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum < /tmp/bfubin/${file}- > /tmp/bfubin/${file}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# For directboot archives, /boot/platform/i86pc/kernel/unix will be
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# overwritten, which could cause a mis-match with the failsafe
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# miniroot. Extract unix from the miniroot and save it off for now.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaumif [ $archive_type = directboot ] && [ $diskless = no ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if gunzip -c "$root/boot/x86.miniroot-safe" \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # Shouldn't happen? See if someone already unzipped it.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -n "$lofidev" ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum unix=/tmp/bfubin/mnt/boot/platform/i86pc/kernel/unix
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -f $unix ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum elif [ -f /tmp/bfubin/mnt/platform/i86pc/multiboot ]
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # /etc/datalink.conf needs to be populated.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ ! -f $conf ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # nothing to do if we bfu'ed from an archive that doesn't
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum ls -1 $rootprefix/etc | egrep -e '^hostname.|^hostname6.|^dhcp.' | \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum cut -d . -f2 | sort -u > /tmp/ifnames.$$
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum -n "`echo $devnum | tr -d '[0-9]'`" ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum awk '{ print $1 }' $conf | grep $ifname > /dev/null
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ $? -ne 0 ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # An entry for that interface does not exist
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum /^[ \t]*#/ || /^[ \t]*$/ || $4 ~ "/0" {
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum gsub(/[^,]*/, "&/0", $4);
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # If we're delivering a new version of an existing /etc/init.d script,
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # remove all hard links to the existing file in /etc/rc?.d whose
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # names begin with [SK][0-9][0-9]. Additionally, in case an S or K
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # file was previously delivered as a symbolic link or the hard link
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # was broken, remove any file in /etc/rc?.d whose name is
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # [SK][0-9][0-9] followed by the basename of the file we're going
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum scripts=`$ZCAT $cpiodir/generic.root$ZFIX |
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum cpio -it 2>/dev/null | grep '^etc/init\.d/'`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum nawk -F/ '{ print "-name [SK][0-9][0-9]" $NF }'`
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum find etc/rc?.d \( $inodes $names \) -print | xargs rm -f
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# Remove the old 5.005_03 version of perl.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum typeset -r perl_pkgs='SUNWopl5m SUNWopl5p SUNWopl5u'
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum typeset -r pkgroot=${rootprefix:+-R $rootprefix}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # First, attempt to remove the packages cleanly if possible.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # In case that didn't work, do it manually.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum printf 'Removing perl 5.005_03 from %s/var/sadm/install/contents' \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum grep -vw $pkg $rootprefix/var/sadm/install/contents > \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum cp /tmp/contents.$$ /var/sadm/install/contents.$$
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum printf 'Removing perl 5.005_03 from %s/perl5\n' $usr
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum# Remove Wildcat (aka Sun Fire Link)
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum typeset -r wildcat_pkgs='SUNWwrsa SUNWwrsd SUNWwrsu SUNWwrsm'
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum typeset -r pkgroot=${rootprefix:+-R $rootprefix}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # First, attempt to remove the packages cleanly if possible.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # Use a custom "admin" file to specify that removal scripts
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # in the packages being removed should be run even if they
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum pkgrm $pkgroot -n -a $admfile $pkg >/dev/null 2>&1
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # In case that didn't work, do it manually.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum printf 'Removing Wildcat from %s/var/sadm/install/contents...' \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum grep -vw $pkg $rootprefix/var/sadm/install/contents > \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # Cleanup any remaining Wildcat files, symlinks, and directories.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wci_common.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wci_regs.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wci_offsets.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wci_cmmu.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsm.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsm_common.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsm_config.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsm_types.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsm_plat.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsm_plugin.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/include/sys/wrsmconf.h
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/lib/mdb/kvm/sparcv9/wrsm.so
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $usr/platform/sun4u/lib/mdb/kvm/sparcv9/wrsmd.so
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $rootprefix/platform/SUNW,Sun-Fire-15000/kernel/misc/sparcv9/gptwo_wci
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $rootprefix/platform/sun4u/kernel/kmdb/sparcv9/wrsm
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum rm -f $rootprefix/platform/sun4u/kernel/kmdb/sparcv9/wrsmd
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens typeset -r pkgroot=${rootprefix:+-R $rootprefix}
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # First, attempt to remove the packages cleanly if possible.
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # Remove ASET from $rootprefix/var/sadm/install/contents
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens grep -vw $pkg $rootprefix/var/sadm/install/contents > \
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens cp /tmp/contents.$$ $rootprefix/var/sadm/install/contents.$$
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # Cleanup any remaining ASET files, symlinks, and directories.
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens# Remove BIND 8 named server/tools packages
fa9e4066f08beec538e775443c5be79dd423fcabahrens typeset -r pkgroot=${rootprefix:+-R $rootprefix}
fa9e4066f08beec538e775443c5be79dd423fcabahrens # We cann't pkgrm SUNWinamd at this time as the BIND 9 binaries are
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Remove BIND 8 packages from $rootprefix/var/sadm/install/contents
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens grep -vw $pkg $rootprefix/var/sadm/install/contents > \
a3f829ae41ece20e7f5f63604e177aeeb8b24628Bill Moore cp /tmp/contents.$$ /var/sadm/install/contents.$$
614409b5be5411058e7e9b6cc93dddaff9fb13f7ahrens# Remove the 5.8.3 version of perl.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # Copy perl 5.8.3 into the new 5.8.4 locations. This will preserve
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # any add-on modules that might have been installed, and any 5.8.3
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # core files that get copied over will be replaced by the new 5.8.4
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # versions when the cpio archives are subsequently extracted.
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum printf 'Preserving user-installed perl modules...\n'
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens # Update the #! lines in any scripts in /usr/perl5/5.8.4/bin to refer
fa9e4066f08beec538e775443c5be79dd423fcabahrens # to 5.8.4 instead of 5.8.3. Take care to edit only scripts.
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [[ $script = "$usr/perl5/5.8.4/bin/perl5.8.3" ]]; then
28e4da25922bdfc5cba7ab29f47de911bbd78009Matthew Ahrens 's!/usr/perl5/5.8.3/bin/perl!/usr/perl5/5.8.4/bin/perl!g' \
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum typeset -r perl_pkgs='SUNWperl583man SUNWperl583usr SUNWperl583root'
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum typeset -r pkgroot=${rootprefix:+-R $rootprefix}
0a586cea3ceec7e5e50e7e54c745082a7a333ac2Mark Shellenbaum # First, attempt to remove the packages cleanly if possible.
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
if [ -f $auth_attr ]; then
cp /tmp/a.$$ $auth_attr
if [ -f $exec_attr ]; then
cp /tmp/e.$$ $exec_attr
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"
# 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 [ $system_type != dca ]; then
rm -f $rootprefix/boot/mdboot
dboot_image; then
if [ -f $rootprefix/etc/lu/GRUB_slice ]; then
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 [ -x $rootprefix/boot/solaris/bin/update_grub ]; then
-R $root
elif [ $is_pcfs_boot = no ]; then
get_rootdev_list | while read rootdev
# We check for several possibilites of a bootenv.rc line:
line=$1
echo $value
if [ $bootenvrc_updated = 1 ]; then
rootdev=$1
grubhd=$1
if [ $archive_type = multiboot ]; then
if [ -f ${rootprefix}/$BOOT_FAILSAFE_FILE ] &&
[ -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 \'`
[ -f /boot/x86.miniroot-safe ] || \
[ ! -x ${GATEPATH}/public/bin/update_failsafe ]; then
if [ $failsafe_type = multiboot ]; then
elif [ $failsafe_type = directboot ]; 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
if [ $multi_or_direct = yes ]; then
if [ $archive_type != $system_type ]; then
[ $system_type = dca ] && setup_grub_menu
if [ $have_new_bootadm = yes ] || \
dboot_or_multiboot; then
if [[ -z $rootprefix ]]; then
-m upgrade -R $rootprefix \
[ $archive_type = directboot ] && update_bootenv
cat >&2 <<EOF
if [ -f $rootprefix/boot/solaris/bin/symdef ] && \
[ $archive_type = multiboot ]
elif [ $failsafe_type = multiboot ]; then
elif [ $failsafe_type = directboot ]; then
typeset pkgroot
typeset pkg
root=$1
zone=$2
rootprefix=${root%/}
if boot_is_upgradeable $root && \
[ $archive_type = dca ]; then
if [ $multi_or_direct = 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
rm -f $root/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/security/64/pam_projects.so.1
rm -f $usr/lib/security/64/pam_projects.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
if [ -f $rootprefix/platform/SUNW,Sun-Fire-15000/kernel/misc/sparcv9/gptwo_wci -o \
-f $rootprefix/platform/sun4u/kernel/drv/wrsmd.conf -o \
-d $rootprefix/etc/wrsm -o \
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
rm -f $root/lib/libmacadm.so.1
rm -f $root/lib/liblaadm.so.1
rm -f $root/lib/libwladm.so.1
rm -f $root/kernel/drv/i2o_bs.conf
rm -f $root/kernel/drv/pci_to_i2o
rm -f $usr/ccs/bin/gprof.flat.blurb
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 [ $multi_or_direct = 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 [ -f $rzi ]; then
if [ $new_dladm = yes ]; then
if [ -f $aggr_old ]; then
if [ -f $aggr_new ]; then
if [ $multi_or_direct = yes ]; then
if [ -f $rootprefix/etc/aggregation.conf -a \
! -d $rootprefix/kernel/mac -a \
$from_new_aggrconf = 1 ]; then
cd $root
if [ $target_isa = i386 ]; then
if [ -f $epilogue ]; then
if [ -s "$bfu_zone_list" ]; then
print "\nNow for zone $zone..."
print "See $EXTRACT_LOG for details.\n"