PSARC 2010/019 EOF esp and dma
[illumos-gate.git] / usr / src / tools / scripts / bfu.sh
blobae53e733c5ae6d5e174240aa0c5092a7aba8572d
1 #!/bin/ksh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
24 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 # Upgrade a machine from a cpio archive area in about 5 minutes.
28 # By Roger Faulkner and Jeff Bonwick, April 1993.
29 # (bfu == Bonwick/Faulkner Upgrade, a.k.a. Blindingly Fast Upgrade)
31 # Usage: bfu [-f] <archive_dir> [root-dir] # for normal machines
32 # bfu -c [-f] <archive_dir> <exec-dir> # for diskless clients
34 # The -f flag is to override the built-in safety check which requires
35 # that the starting-point OS be a least a certain revision.
37 # You have to be super-user. It's safest to run this from the
38 # system console, although I've run it under OW and even via
39 # remote login with no problems.
41 # You will have to reboot the system when the upgrade is complete.
43 # You should add any administrative files you care about to this list.
44 # Warning: there had better be no leading '/' on any of these filenames.
47 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
48 # under certain circumstances, which can really screw things up; unset it.
50 unset CDPATH
52 export LC_ALL="C"
54 if [ -z "$GATEPATH" ]; then
55 GATEPATH=/ws/onnv-gate
56 test -d $GATEPATH || GATEPATH=/net/onnv.eng/export/onnv-gate
58 export GATE=${GATEPATH}
59 export ARCHIVE=${ARCHIVEPATH:-${GATEPATH}}
62 # NOTE: Entries in *_files must expand to either the exact files required,
63 # or to directories that will be scoured for files. Any directories
64 # (and subdirectories) resulting from a wildcard expansion will be
65 # fully recursed by BFU's searching for files. (E.g. /etc/inet/* will
66 # include all files in any of its directories, as well as any files in
67 # /etc/inet/ itself.
69 # These lists should really be generated automatically from the
70 # pkgmap(4) metadata.
74 # First list: files to be saved in global and non-global zones.
76 all_zones_files="
77 etc/.login
78 etc/acct/holidays
79 etc/auto_*
80 etc/cron.d/at.deny
81 etc/cron.d/cron.deny
82 etc/crypto/pkcs11.conf
83 etc/default/*
84 etc/dev/reserved_devnames
85 etc/dfs/dfstab
86 etc/dumpdates
87 etc/ftpd/*
88 etc/ftpusers
89 etc/group
90 etc/gss/gsscred.conf
91 etc/gss/mech
92 etc/gss/qop
93 etc/inet/*
94 etc/init.d/*
95 etc/inittab
96 etc/ipf/ipf.conf
97 etc/iu.ap
98 etc/krb5/kadm5.acl
99 etc/krb5/kdc.conf
100 etc/krb5/kpropd.acl
101 etc/krb5/krb5.conf
102 etc/krb5/warn.conf
103 etc/ksh.kshrc
104 etc/logadm.conf
105 etc/logindevperm
106 etc/lp/Systems
107 etc/mail/*.cf
108 etc/mail/*.hf
109 etc/mail/*.rc
110 etc/mail/aliases
111 etc/mail/helpfile
112 etc/mail/local-host-names
113 etc/mail/trusted-users
114 etc/named.conf
115 etc/net/*/services
116 etc/netconfig
117 etc/nfs/nfslog.conf
118 etc/nfssec.conf
119 etc/nscd.conf
120 etc/nsswitch.*
121 etc/pam.conf
122 etc/passwd
123 etc/policy.conf
124 etc/printers.conf
125 etc/profile
126 etc/project
127 etc/publickey
128 etc/remote
129 etc/resolv.conf
130 etc/rmmount.conf
131 etc/rpc
132 etc/rpld.conf
133 etc/saf/_sactab
134 etc/saf/_sysconfig
135 etc/saf/zsmon/_pmtab
136 etc/security/audit_class
137 etc/security/audit_control
138 etc/security/audit_event
139 etc/security/audit_startup
140 etc/security/audit_user
141 etc/security/audit_warn
142 etc/security/auth_attr
143 etc/security/crypt.conf
144 etc/security/exec_attr
145 etc/security/policy.conf
146 etc/security/prof_attr
147 etc/sfw/openssl/openssl.cnf
148 etc/shadow
149 etc/skel/.profile
150 etc/skel/local.*
151 etc/ssh/ssh_config
152 etc/ssh/sshd_config
153 etc/syslog.conf
154 etc/ttydefs
155 etc/ttysrch
156 etc/user_attr
157 etc/uucp/[A-Z]*
158 etc/vfstab
159 var/smb/*
160 var/spool/cron/crontabs/*
161 var/yp/Makefile
162 var/yp/aliases
163 var/yp/nicknames
167 # Second list: files to be saved in the global zone only.
169 global_zone_only_files="
170 boot/grub/menu.lst
171 boot/solaris/bootenv.rc
172 boot/solaris/devicedb/master
173 boot/solaris/filelist.ramdisk
174 etc/aggregation.conf
175 etc/bootrc
176 etc/crypto/kcf.conf
177 etc/devlink.tab
178 etc/dladm/*
179 etc/lvm/devpath
180 etc/lvm/lock
181 etc/lvm/md.cf
182 etc/lvm/md.ctlrmap
183 etc/lvm/md.tab
184 etc/lvm/mddb.cf
185 etc/lvm/runtime.cf
186 etc/mach
187 etc/name_to_sysnum
188 etc/nca/nca.if
189 etc/nca/ncakmod.conf
190 etc/nca/ncalogd.conf
191 etc/nca/ncaport.conf
192 etc/openwin/server/etc/OWconfig
193 etc/path_to_inst
194 etc/power.conf
195 etc/ppp/chap-secrets
196 etc/ppp/options
197 etc/ppp/pap-secrets
198 etc/security/extra_privs
199 etc/security/tsol/devalloc_defaults
200 etc/security/tsol/label_encodings
201 etc/security/tsol/relabel
202 etc/security/tsol/tnrhdb
203 etc/security/tsol/tnrhtp
204 etc/security/tsol/tnzonecfg
205 etc/system
206 etc/zones/index
207 kernel/drv/aac.conf
208 kernel/drv/elxl.conf
209 kernel/drv/emlxs.conf
210 kernel/drv/fp.conf
211 kernel/drv/iscsi.conf
212 kernel/drv/md.conf
213 kernel/drv/mpt.conf
214 kernel/drv/mpt_sas.conf
215 kernel/drv/options.conf
216 kernel/drv/pmcs.conf
217 kernel/drv/qlc.conf
218 kernel/drv/ra.conf
219 kernel/drv/scsa2usb.conf
220 kernel/drv/scsi_vhci.conf
221 kernel/drv/sd.conf
222 kernel/drv/ssd.conf
223 platform/*/kernel/drv/*ppm.conf
224 platform/i86pc/kernel/drv/aha.conf
225 platform/i86pc/kernel/drv/asy.conf
226 platform/sun4u/boot.conf
230 # Third list: files extracted from generic.root but which belong in the global
231 # zone only: they are superfluous (and some even harmful) in nonglobal zones.
233 # (note: as /etc/init.d scripts are converted to smf(5) "Greenline" services,
234 # they (and their /etc/rc?.d hardlinks) should be removed from this list when
235 # they are added to smf_obsolete_rc_files, below)
237 superfluous_nonglobal_zone_files="
238 dev/dsk
239 dev/fd
240 dev/pts
241 dev/rdsk
242 dev/rmt
243 dev/stderr
244 dev/stdin
245 dev/stdout
246 dev/swap
247 dev/term
248 dev/vt
249 devices
250 etc/dacf.conf
251 etc/dat
252 etc/default/metassist.xml
253 etc/default/power
254 etc/flash/postdeployment/svm.cleanup
255 etc/flash/predeployment/svm.save
256 etc/inet/ipqosconf.1.sample
257 etc/inet/ipqosconf.2.sample
258 etc/inet/ipqosconf.3.sample
259 etc/inet/sock2path
260 etc/init.d/devlinks
261 etc/init.d/dodatadm.udaplt
262 etc/init.d/drvconfig
263 etc/init.d/llc2
264 etc/init.d/ncakmod
265 etc/init.d/ncalogd
266 etc/init.d/pcmcia
267 etc/init.d/pppd
268 etc/init.d/wrsmcfg
269 etc/llc2
270 etc/lvm
271 etc/nca
272 etc/openwin
273 etc/ppp
274 etc/rc0.d/K34ncalogd
275 etc/rc0.d/K50pppd
276 etc/rc0.d/K52llc2
277 etc/rc1.d/K34ncalogd
278 etc/rc1.d/K50pppd
279 etc/rc1.d/K52llc2
280 etc/rc2.d/S40llc2
281 etc/rc2.d/S42ncakmod
282 etc/rc2.d/S47pppd
283 etc/rc2.d/S81dodatadm.udaplt
284 etc/rc2.d/S94ncalogd
285 etc/rcS.d/K34ncalogd
286 etc/rcS.d/K44wrsmcfg
287 etc/rcS.d/K50pppd
288 etc/rcS.d/K52llc2
289 etc/rcS.d/S29wrsmcfg
290 etc/rcm
291 etc/sock2path
292 etc/usb
293 etc/wrsm
294 etc/zones
295 kernel
296 lib/libmeta.so
297 lib/libmeta.so.1
298 lib/svc/method/devices-audio
299 lib/svc/method/fc-fabric
300 lib/svc/method/iscsi-initiator
301 lib/svc/method/ldoms-agents
302 lib/svc/method/npivconfig
303 lib/svc/method/sf880dr
304 lib/svc/method/svc-cvcd
305 lib/svc/method/svc-dcs
306 lib/svc/method/svc-drd
307 lib/svc/method/svc-dscp
308 lib/svc/method/svc-dumpadm
309 lib/svc/method/svc-fcoei
310 lib/svc/method/svc-fcoet
311 lib/svc/method/svc-intrd
312 lib/svc/method/svc-hal
313 lib/svc/method/svc-labeld
314 lib/svc/method/svc-mdmonitor
315 lib/svc/method/svc-metainit
316 lib/svc/method/svc-metasync
317 lib/svc/method/svc-oplhpd
318 lib/svc/method/svc-poold
319 lib/svc/method/svc-pools
320 lib/svc/method/svc-power
321 lib/svc/method/svc-resource-mgmt
322 lib/svc/method/svc-rmvolmgr
323 lib/svc/method/svc-scheduler
324 lib/svc/method/svc-sckmd
325 lib/svc/method/svc-stmf
326 lib/svc/method/svc-syseventd
327 lib/svc/method/svc-tnctl
328 lib/svc/method/svc-tnd
329 lib/svc/method/svc-vntsd
330 lib/svc/method/svc-zones
331 lib/svc/method/vtdaemon
332 platform/*/kernel
333 platform/SUNW,Sun-Fire-15000/lib/cvcd
334 platform/SUNW,Ultra-Enterprise-10000/lib/cvcd
335 platform/i86pc/biosint
336 platform/i86pc/multiboot
337 platform/sun4u/cprboot
338 platform/sun4u/lib/libwrsmconf.so
339 platform/sun4u/lib/libwrsmconf.so.1
340 platform/sun4u/lib/sparcv9/libwrsmconf.so
341 platform/sun4u/lib/sparcv9/libwrsmconf.so.1
342 platform/sun4u/sbin
343 platform/sun4u/wanboot
344 platform/sun4v/wanboot
345 sbin/metadb
346 sbin/metadevadm
347 sbin/metainit
348 sbin/metarecover
349 sbin/metastat
350 usr/include/sys/dcam
351 usr/lib/devfsadm/linkmod/SUNW_dcam1394_link.so
352 usr/lib/ldoms
353 usr/platform/SUNW,SPARC-Enterprise/lib/dscp.ppp.options
354 usr/platform/SUNW,SPARC-Enterprise/lib/libdscp.so
355 usr/platform/SUNW,SPARC-Enterprise/lib/libdscp.so.1
356 usr/platform/SUNW,SPARC-Enterprise/lib/llib-ldscp.ln
357 usr/platform/SUNW,SPARC-Enterprise/sbin/prtdscp
358 var/adm/pool
359 var/log/pool
360 var/svc/manifest/network/iscsi/iscsi-initiator.xml
361 var/svc/manifest/network/npiv_config.xml
362 var/svc/manifest/network/rpc/mdcomm.xml
363 var/svc/manifest/network/rpc/meta.xml
364 var/svc/manifest/network/rpc/metamed.xml
365 var/svc/manifest/network/rpc/metamh.xml
366 var/svc/manifest/network/tnctl.xml
367 var/svc/manifest/network/tnd.xml
368 var/svc/manifest/platform/i86pc/eeprom.xml
369 var/svc/manifest/platform/sun4u/dcs.xml
370 var/svc/manifest/platform/sun4u/dscp.xml
371 var/svc/manifest/platform/sun4u/efdaemon.xml
372 var/svc/manifest/platform/sun4u/oplhpd.xml
373 var/svc/manifest/platform/sun4u/sckmd.xml
374 var/svc/manifest/platform/sun4u/sf880drd.xml
375 var/svc/manifest/platform/sun4v
376 var/svc/manifest/system/cvc.xml
377 var/svc/manifest/system/device/devices-audio.xml
378 var/svc/manifest/system/device/devices-fc-fabric.xml
379 var/svc/manifest/system/dumpadm.xml
380 var/svc/manifest/system/fcoe_initiator.xml
381 var/svc/manifest/system/fcoe_target.xml
382 var/svc/manifest/system/filesystem/rmvolmgr.xml
383 var/svc/manifest/system/fmd.xml
384 var/svc/manifest/system/hal.xml
385 var/svc/manifest/system/intrd.xml
386 var/svc/manifest/system/labeld.xml
387 var/svc/manifest/system/mdmonitor.xml
388 var/svc/manifest/system/metainit.xml
389 var/svc/manifest/system/metasync.xml
390 var/svc/manifest/system/picl.xml
391 var/svc/manifest/system/poold.xml
392 var/svc/manifest/system/pools.xml
393 var/svc/manifest/system/power.xml
394 var/svc/manifest/system/resource-mgmt.xml
395 var/svc/manifest/system/scheduler.xml
396 var/svc/manifest/system/stmf.xml
397 var/svc/manifest/system/sysevent.xml
398 var/svc/manifest/system/vtdaemon.xml
399 var/svc/manifest/system/zones.xml
403 # Fourth list: files to be preserved, ie unconditionally restored to
404 # "child" versions
406 preserve_files="
407 etc/driver_aliases
408 etc/driver_classes
409 etc/hostid
410 etc/minor_perm
411 etc/name_to_major
412 etc/security/device_policy
413 kernel/misc/amd64/sysinit
414 kernel/misc/amd64/usbs49_fw
415 kernel/misc/sparcv9/usbs49_fw
416 kernel/misc/sysinit
417 kernel/misc/usbs49_fw
418 var/adm/aculog
419 var/adm/spellhist
420 var/adm/utmpx
421 var/adm/wtmpx
422 var/log/authlog
423 var/log/syslog
424 var/saf/zsmon/log
427 realmode_files="
428 boot/solaris/bootenv.rc
429 boot/solaris/devicedb/master
433 # /usr/sadm/install/scripts/i.build class runs class client provided
434 # script. The files below are managed by build class and its build script.
435 # They are added to /bfu.conflict/NEW.
437 build_class_script_files="
438 etc/mpapi.conf
439 etc/hba.conf
440 etc/ima.conf
443 fail() {
444 print "$*" >& 2
445 print "bfu aborting" >& 2
446 rm -f "$bfu_zone_list"
447 exit 1
450 filelist() {
451 files="$all_zones_files $preserve_files"
452 if [ $1 = "global" ]; then
453 files="$global_zone_only_files $files"
455 find $files -depth -type f ! -name core -print 2>/dev/null | sort -u || {
457 # Force cpio to return non-zero by printing an error message
458 # to stdout that it won't be able to lstat().
460 echo 'filelist: sort failed'
461 fail "sort failed"
465 realmode_filelist() {
466 find $realmode_files -depth -type f ! -name core -print 2>/dev/null | sort
469 smf_inetd_conversions="
470 100134
471 100150
472 100155
473 100229
474 100230
475 100234
476 100242
477 100422
478 chargen
479 comsat
480 daytime
481 discard
482 echo
483 eklogin
484 exec
485 finger
487 gssd
488 klogin
489 krb5_prop
490 kshell
491 ktkt_warnd
492 login
493 metad
494 metamedd
495 metamhd
496 name
497 printer
498 rexd
499 rquotad
500 rstatd
501 rusersd
502 shell
503 smserverd
504 sprayd
505 sun-dr
506 talk
507 telnet
508 time
509 uucp
510 walld
513 enable_next_boot () {
514 if [ -x /tmp/bfubin/svccfg ]; then
515 svcadm disable -t $1
516 [ $? = 0 ] || echo "warning: unable to temporarily disable $1"
517 eval $BFUSVCCFG -s $1 setprop general/enabled = true
518 [ $? = 0 ] || echo "warning: unable to enable $1 for next boot"
523 # If we're in the global zone, import the manifest for the specified service.
524 # Note that we will need to see whether we are in an smf root if we are using
525 # an alternate root. If so, import the service directly; otherwise, print the
526 # warning messages.
528 # $1: the path of the xml file (the related path to /var/svc/manifest)
529 # $2: the service name - specified only if the service is enabled after reboot.
531 smf_import_service() {
532 if [[ $zone = global && -f $rootprefix/var/svc/manifest/$1 ]]; then
533 if [[ -n $rootprefix && -x /usr/sbin/svccfg ]]; then
534 SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db \
535 svccfg import $rootprefix/var/svc/manifest/$1
536 elif [[ -n $rootprefix ]]; then
537 echo "Warning: This system does not have SMF, so I"
538 echo "cannot ensure the pre-import of $1. If it does"
539 echo "not work, reboot your alternate root to fix it."
540 elif [[ -x /tmp/bfubin/svccfg ]]; then
541 if [[ "${2}a" == a ]]; then
542 eval $BFUSVCCFG import /var/svc/manifest/$1
543 else
544 tmpfile=/tmp/`echo "$1" | tr / :`.$$
545 sed -e "s/enabled='true'/enabled='false'/" \
546 /var/svc/manifest/$1 > "$tmpfile"
547 eval $BFUSVCCFG import "$tmpfile"
549 # Make sure the service is enabled after reboot.
551 enable_next_boot $2
557 smf_inetd_disable() {
558 inetconf=$rootprefix/etc/inet/inetd.conf
559 inettmp=/tmp/inetd.tmp.$$
561 sed "$(for i in $smf_inetd_conversions; do
562 echo "s:^[ ]*$i[ /]:#SMFbfu# &:"
563 done)" $inetconf > $inettmp && ! cmp -s $inettmp $inetconf &&
564 cp $inettmp $inetconf
566 rm -f -- $inettmp
569 smf_inetd_reenable() {
570 inetconf=$rootprefix/etc/inet/inetd.conf
571 inettmp=/tmp/inetd.tmp.$$
573 sed 's/^#SMFbfu# //' $inetconf > $inettmp && cp $inettmp $inetconf
575 rm -f -- $inettmp
578 smf_tftp_reinstall() {
579 inetconf=$rootprefix/etc/inet/inetd.conf
580 inettmp=/tmp/inetd.tmp.$$
582 if grep '^#SMFbfu# tftp' $inetconf >/dev/null ; then
583 # BFU previously commented out, put it back in place
584 sed 's/^#SMFbfu# tftp/tftp/' $inetconf > $inettmp &&
585 cp $inettmp $inetconf
586 elif ! grep '^[# ]*tftp' $inetconf >/dev/null; then
587 # No entry, append to end
588 cat >>$inetconf <<EOF
589 # TFTPD - tftp server (primarily used for booting)
590 #tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot
594 rm -f -- $inettmp
597 inetd_conf_svm_hack() {
598 # Since inetd.conf is updated by SUNWmdr's postinstall script,
599 # we will update the actual inetd.conf here to reflect the postinstall
600 # changes.
602 inetconf=$rootprefix/etc/inet/inetd.conf
603 inettmp=/tmp/inetd.tmp.$$
604 inetnew=/tmp/inetd.new.$$
607 # only change inetd.conf if the rpc.metad entry is out of date
610 if ! grep "^[# ]*100229/1-2" $inetconf > /dev/null ; then
612 # Grab existing rpc entries for rpc.metad
613 # and convert spaces to tabs within the rpc entry, as well as
614 # the transport method;
615 # or add a new entry in case there was none.
616 if grep "^[# ]*100229/1" $inetconf > /dev/null ; then
617 grep "^# METAD - SLVM metadb" $inetconf > $inettmp
618 grep "^[# ]*100229/1" $inetconf | \
619 sed -e 's/[ ][ ]*/ /g' \
620 -e 's?100229/1?100229/1-2?' >> $inettmp
621 else
622 echo '# METAD - SVM metadb Daemon' > $inettmp
623 echo "100229/1-2\ttli\trpc/tcp\twait\troot\t/usr/sbin/rpc.metad\trpc.metad" >> $inettmp
626 grep -v '^# METAD - SLVM metadb' $inetconf | \
627 grep -v '^[# ]*100229/1' > $inetnew
628 cat $inettmp >> $inetnew
630 if ! diff $inetnew $inetconf > /dev/null ; then
631 print "Updating inet.conf metad entry ... \c"
632 if cp $inetnew $inetconf ; then
633 print "done."
634 else
635 print "failed."
638 rm -f $inettmp $inetnew
642 # only change inetd.conf if the rpc.mdcommd entry is out of date
645 if ! grep "^[# ]*100422/1" $inetconf > /dev/null ; then
647 # Grab existing rpc entries for rpc.mdcommd
648 # and convert spaces to tabs within the rpc entry,
649 # or add a new entry in case there was none.
650 if grep "^[# ]*100422/1" $inetconf > /dev/null ; then
651 grep "^# MDMN_COMMD - SVM Multi node" $inetconf > $inettmp
652 grep "^[# ]*100422/1" $inetconf | \
653 sed -e 's/[ ][ ]*/ /g' >> $inettmp
654 else
655 echo '# MDMN_COMMD - SVM Multi node communication daemon' >$inettmp
656 echo '100422/1\ttli\trpc/tcp\twait\troot\t/usr/sbin/rpc.mdcommd\trpc.mdcommd' >> $inettmp
659 grep -v '^# MDMN_COMMD - SVM Multi node' $inetconf | \
660 grep -v '^[# ]*100422/1' > $inetnew
661 cat $inettmp >> $inetnew
663 if ! diff $inetnew $inetconf > /dev/null ; then
664 print "Updating inetd.conf rpc.mdcommd entry ... \c"
665 if cp $inetnew $inetconf; then
666 print "done."
667 else
668 print "failed."
672 rm -f $inettmp $inetnew
676 upgrade_aggr_and_linkprop () {
677 # Since aggregation.conf and linkprop.conf are upgraded by
678 # SUNWcnetr's postinstall script, put the relevant portions of the
679 # postinstall script here, modified to rename the old files instead
680 # of removing them.
683 # Convert datalink configuration into a series of dladm(1M) commands
684 # and keep them in an upgrade script. This script will then be run
685 # in the network-physical service.
687 # Note that we cannot use the /var/svc/profile/upgrade script because
688 # that script is run in the manifest-import service which is too late
689 # for the datalink configuration.
691 UPGRADE_SCRIPT=/var/svc/profile/upgrade_datalink
693 AGGR_CONF=/etc/aggregation.conf
694 ORIG=$rootprefix$AGGR_CONF
695 if [[ ! -f $ORIG ]]; then
696 # Try the alternate location.
697 AGGR_CONF=/etc/dladm/aggregation.conf
698 ORIG=$rootprefix$AGGR_CONF
701 if [[ -f $ORIG ]]; then
702 # Strip off comments, then each remaining line defines
703 # an aggregation the administrator configured on the old
704 # system. Each line corresponds to one dladm command
705 # that is appended to the upgrade script.
706 cat $ORIG | grep '^[^#]' | while read line; do
707 echo $line | while read aggr_index rest
709 policy=`echo $rest | /usr/bin/awk '{print $1}'`
710 nports=`echo $rest | /usr/bin/awk '{print $2}'`
711 ports=`echo $rest | /usr/bin/awk '{print $3}'`
712 mac=`echo $rest | /usr/bin/awk '{print $4}'`
713 lacp_mode=`echo $rest | /usr/bin/awk \
714 '{print $5}'`
715 lacp_timer=`echo $rest | /usr/bin/awk \
716 '{print $6}'`
717 dladm_string="dladm create-aggr -P $policy -l \
718 $lacp_mode -T $lacp_timer"
719 # A fixed MAC address
720 if [[ $mac != "auto" ]]; then
721 dladm_string="$dladm_string -u $mac"
724 while [ $i -le $nports ]; do
725 device=`echo $ports | cut -d, -f$i`
726 # Older aggregation.conf files have the
727 # format of device_name/port_number.
728 # We don't need the port number, so get
729 # rid of it if it is there.
730 device=`echo $device | cut -d/ -f1`
731 ((i = i + 1))
732 dladm_string="$dladm_string -d \
733 $device"
734 done
735 dladm_string="$dladm_string $aggr_index"
736 echo $dladm_string >> \
737 $rootprefix$UPGRADE_SCRIPT
738 done
739 done
740 mv $ORIG $ORIG.bak
743 # Upgrade linkprop.conf
744 ORIG=$rootprefix/etc/dladm/linkprop.conf
746 if [[ -f $ORIG ]]; then
747 # Strip off comments, then each remaining line lists
748 # properties the administrator configured for a
749 # particular interface. Each line includes several
750 # properties, but we can only set one property per
751 # dladm invocation.
752 cat $ORIG | grep '^[^#]' | while read line; do
753 echo $line | while read link rest
755 while [ -n "$rest" ]; do
756 linkprop=`echo $rest | cut -d";" -f1`
757 rest=`echo $rest | cut -d";" -f2-`
758 echo dladm set-linkprop -p $linkprop \
759 $link >> $rootprefix$UPGRADE_SCRIPT
760 done
761 done
762 done
763 mv $ORIG $ORIG.bak
767 upgrade_vlan () {
768 # Convert hostname.*** and zonecfg vlan configurations
769 UPGRADE_SCRIPT=/var/svc/profile/upgrade_datalink
771 for ifname in $host_ifs $zone_ifs
773 phys=`echo $ifname | sed "s/[0-9]*$//"`
774 devnum=`echo $ifname | sed "s/$phys//g"`
775 if [ "$phys$devnum" != $ifname -o \
776 -n "`echo $devnum | tr -d '[0-9]'`" ]; then
777 echo "skipping invalid interface $ifname"
778 continue
781 vid=`expr $devnum / 1000`
782 inst=`expr $devnum % 1000`
784 if [ "$vid" != "0" ]; then
785 echo dladm create-vlan -l $phys$inst -v $vid $ifname \
786 >> $rootprefix$UPGRADE_SCRIPT
788 done
791 # Update aac.conf for set legacy-name-enable properly
792 update_aac_conf()
794 conffile=$rootprefix/kernel/drv/aac.conf
795 childconffile=$rootprefix/bfu.child/kernel/drv/aac.conf
797 # Already using autoenumeration mode, return
798 egrep -s "legacy-name-enable" $childconffile && \
799 grep "legacy-name-enable" $childconffile | egrep -s "no" && return
801 # Else enable legacy mode
802 sed -e 's/legacy-name-enable="no"/legacy-name-enable="yes"/g' \
803 < $conffile > /tmp/aac.conf.$$
804 mv -f /tmp/aac.conf.$$ $conffile
807 update_etc_inet_sock2path()
810 # The PF_PACKET module may need to be added to the configuration
811 # file socket sockets.
813 # When being added to the system, the socket itself will remain
814 # inactive until the next reboot when soconfig is run. When being
815 # removed, the kernel configuration stays active until the system
816 # is rebooted and the sockets will continue to work until it is
817 # unloaded from the kernel, after which applications will fail.
819 sockfile=$rootprefix/etc/inet/sock2path
821 ${ZCAT} ${cpiodir}/generic.usr$ZFIX | cpio -it 2>/dev/null |
822 xpg4grep -q sockpfp
823 if [ $? -eq 1 ] ; then
824 xpg4grep -v -E '^ 32 [14] 0 sockpfp' \
825 ${sockfile} > /tmp/sock2path.tmp.$$
826 cp /tmp/sock2path.tmp.$$ ${sockfile}
827 else
828 if ! xpg4grep -q -E \
829 '^ 31 [14] 0 sockpfp' ${sockfile}; then
830 echo '' >> ${sockfile}
831 echo ' 32 1 0 sockpfp' >> ${sockfile}
832 echo ' 32 4 0 sockpfp' >> ${sockfile}
837 # update x86 version mpt.conf for property tape
838 mpttapeprop='[ ]*tape[ ]*=[ ]*"sctp"[ ]*;'
839 update_mptconf_i386()
841 conffile=$rootprefix/kernel/drv/mpt.conf
842 test -f $conffile || return
843 egrep -s "$mpttapeprop" $conffile
844 if [ $? -ne 0 ] ; then
845 echo 'tape="sctp";' >> $conffile
849 # update x86 etc/mach file after xVM_uppc is added,
850 # which makes xpv_psm a non-default psm module
851 update_etc_mach_i386()
853 etc_mach=$rootprefix/etc/mach
854 test -f $etc_mach || return
855 grep -w "xpv_psm" $etc_mach > /dev/null 2>&1
856 if [ $? -ne 0 ] ; then
857 echo 'xpv_psm' >> $etc_mach
861 # check and update driver class for scsi-self-identifying
862 chk_update_drv_class()
865 drvclassfile=$rootprefix/etc/driver_classes
866 name2majorfile=$rootprefix/etc/name_to_major
867 drvname=$1
868 classentry="^$drvname[ ].*scsi-self-identifying"
870 [ -f $drvclassfile ] || return
871 [ -f $name2majorfile ] || return
873 grep -w $drvname $name2majorfile > /dev/null 2>&1 || return
875 egrep -s "$classentry" $drvclassfile
876 if [ $? -ne 0 ]; then
877 echo "$drvname scsi-self-identifying" >> $drvclassfile
881 update_drvclass_i386()
883 chk_update_drv_class ahci
884 chk_update_drv_class si3124
885 chk_update_drv_class marvell88sx
886 chk_update_drv_class nv_sata
889 update_policy_conf() {
890 # update /etc/security/policy.conf with the default
891 # Solaris crypt(3c) policy.
893 dest=$rootprefix/etc/security/policy.conf
895 grep 'CRYPT_' $dest > /dev/null 2>&1
896 if [ $? = 1 ] ; then
897 print "Updating entries for crypt(3c), see policy.conf(4)"
898 cat >> $dest <<EOM
900 # crypt(3c) Algorithms Configuration
902 # CRYPT_ALGORITHMS_ALLOW specifies the algorithms that are allowed to
903 # be used for new passwords. This is enforced only in crypt_gensalt(3c).
905 CRYPT_ALGORITHMS_ALLOW=1,2a,md5
907 # To deprecate use of the traditional unix algorithm, uncomment below
908 # and change CRYPT_DEFAULT= to another algorithm. For example,
909 # CRYPT_DEFAULT=1 for BSD/Linux MD5.
911 #CRYPT_ALGORITHMS_DEPRECATE=__unix__
913 # The Solaris default is the traditional UNIX algorithm. This is not
914 # listed in crypt.conf(4) since it is internal to libc. The reserved
915 # name __unix__ is used to refer to it.
917 CRYPT_DEFAULT=__unix__
920 grep PRIV_ $dest >/dev/null 2>&1
921 if [ $? = 1 ]; then
922 echo "Updating entries for privileges(5)," \
923 "see policy.conf(4) for details."
924 cat >> $dest <<EOM
926 # These settings determine the default privileges users have. If not set,
927 # the default privileges are taken from the inherited set.
928 # There are two different settings; PRIV_DEFAULT determines the default
929 # set on login; PRIV_LIMIT defines the Limit set on login.
930 # Individual users can have privileges assigned or taken away through
931 # user_attr. Privileges can also be assigned to profiles in which case
932 # the users with those profiles can use those privileges through pfexec(1).
933 # For maximum future compatibility, the specifications should
934 # always include "basic" or "all"; privileges should then be removed using
935 # the negation. E.g., PRIV_LIMIT=all,!sys_linkdir takes away only the
936 # sys_linkdir privilege, regardless of future additional privileges.
937 # Similarly, PRIV_DEFAULT=basic,!file_link_any takes away only the
938 # file_link_any privilege from the basic privilege set; only that notation
939 # is immune from a future addition of currently unprivileged operations to
940 # the basic privilege set.
941 # NOTE: removing privileges from the the Limit set requires EXTREME care
942 # as any set-uid root program may suddenly fail because it lacks certain
943 # privilege(s).
945 #PRIV_DEFAULT=basic
946 #PRIV_LIMIT=all
953 # Cleanup nfsmapid configuration before extracting
954 # root bits. Remove if they exist:
955 # nfsmapid entry in inetd.conf
956 # nfsmapid entry in /etc/net/ti*/services
958 # Going forward neither should exist, but no harm if services entry exists
959 # Going way backwards (pre-04/28/2004), inetd.conf must exist but will
960 # be a conflict that should be merged in
962 nfsmapid_cfg() {
963 inetdconf=$rootprefix/etc/inet/inetd.conf
964 tmpinetcf=/tmp/inetd.conf.$$
965 cp -pf ${inetdconf} ${tmpinetcf}
966 cat /dev/null > ${inetdconf} 2>&1
967 sed -e "/^#[# ]*NFSv4/d" \
968 -e "/^[# ]*100166\/1/d" \
969 ${tmpinetcf} > ${inetdconf} 2>&1
970 rm -f ${tmpinetcf}
972 tmpservices=/tmp/services.$$
974 services=$rootprefix/etc/net/ticotsord/services
975 cp -pf ${services} ${tmpservices}
976 cat /dev/null > ${services} 2>&1
977 sed -e "/^[# ]*nfsmapid/d" \
978 ${tmpservices} > ${services} 2>&1
979 rm -f ${tmpservices}
981 services=$rootprefix/etc/net/ticots/services
982 cp -pf ${services} ${tmpservices}
983 cat /dev/null > ${services} 2>&1
984 sed -e "/^[# ]*nfsmapid/d" \
985 ${tmpservices} > ${services} 2>&1
986 rm -f ${tmpservices}
988 services=$rootprefix/etc/net/ticlts/services
989 cp -pf ${services} ${tmpservices}
990 cat /dev/null > ${services} 2>&1
991 sed -e "/^[# ]*nfsmapid/d" \
992 ${tmpservices} > ${services} 2>&1
993 rm -f ${tmpservices}
997 # Detect Boomer audio framework; used to emit a notice at the end of BFU
998 # telling the user to run update_audio to complete the upgrade.
1000 BOOMER_PRESENT_SYS=false
1001 BOOMER_PRESENT_BFU=false
1002 BOOMER_DRIVERS="audio"
1003 AUSTR_PRESENT_SYS=false
1004 AUSTR_PRESENT_BFU=false
1006 check_boomer_sys() {
1007 typeset root=$1
1008 typeset n2m=$root/etc/name_to_major
1009 typeset drv
1011 for drv in $BOOMER_DRIVERS; do
1012 if ! grep -w $drv $n2m > /dev/null 2>&1; then
1013 return 1
1015 done
1017 return 0
1020 check_boomer_bfu() {
1021 $ZCAT $cpiodir/generic.root$ZFIX | cpio -it 2>/dev/null |
1022 grep devices-audio.xml > /dev/null 2>&1
1025 check_austr_sys() {
1026 typeset root=$1
1027 typeset n2m=$root/etc/name_to_major
1028 typeset drv
1030 if ! grep -w austr $n2m > /dev/null 2>&1; then
1031 return 1
1033 return 0
1036 check_austr_bfu() {
1037 $ZCAT $cpiodir/generic.kernel$ZFIX | cpio -it 2>/dev/null |
1038 grep austr > /dev/null 2>&1
1043 # Define global variables
1045 CALL_DEVID_DESTROY=""
1047 # List of SDS commands that must be deleted.
1049 SDSCMDLIST="
1050 growfs
1051 metaclear
1052 metadb
1053 metadetach
1054 metahs
1055 metainit
1056 metaoffline
1057 metaonline
1058 metaparam
1059 metarename
1060 metareplace
1061 metaroot
1062 metaset
1063 metastat
1064 metasync
1065 metattach
1066 rpc.metad
1067 rpc.metamhd
1070 # List of SDS configuration files that must be deleted.
1072 SDSCONFIGLIST="
1073 lock
1074 md.cf
1075 mddb.cf
1076 md.tab
1077 devpath
1078 md.ctlrmap
1081 # List of rc scripts that must be deleted.
1083 RCLIST="
1084 etc/init.d/SUNWmd.init
1085 etc/init.d/SUNWmd.sync
1086 etc/init.d/lvm.init
1087 etc/init.d/lvm.sync
1088 etc/rcS.d/S35SUNWmd.init
1089 etc/rcS.d/S35lvm.init
1090 etc/rc2.d/S95SUNWmd.sync
1091 etc/rc2.d/S95lvm.sync
1092 etc/rcS.d/S35slvm.init
1093 etc/rc2.d/S95slvm.sync
1094 etc/init.d/slvm.init
1095 etc/init.d/slvm.sync
1096 etc/init.d/init.mdlogd
1097 etc/rc3.d/S25mdlogd
1100 # List of flashprom-related files that must be deleted.
1102 FLASHPROMLIST="
1103 etc/rc2.d/S75flashprom
1104 etc/init.d/flashprom
1105 usr/platform/SUNW,Ultra-2/lib/flash-update.sh
1106 usr/platform/SUNW,Ultra-4/lib/flash-update.sh
1107 usr/platform/SUNW,Ultra-Enterprise/lib/flash-update.sh
1108 usr/platform/sun4u/doc/flashupdate.txt
1109 usr/platform/sun4u/lib/flash-update.sh
1110 usr/platform/sun4u/lib/prom/SUNW,Ultra-2
1111 usr/platform/sun4u/lib/prom/SUNW,Ultra-4
1112 usr/platform/sun4u/lib/prom/SUNW,Ultra-Enterprise
1116 # delete the entries associated with bootlist from /etc/system
1119 delete_system_bootlist() {
1120 sed -e /"Begin MDD database info"/,/"End MDD database info"/d \
1121 < ${SYSTEM_FILE} > /tmp/system.$$
1122 cp /tmp/system.$$ ${SYSTEM_FILE} || \
1123 echo "copy error: /tmp/system.$$ to ${SYSTEM_FILE}"
1127 # Add entries in md.conf for bootlist
1130 fix_mdconf() {
1131 cp ${mdconf} /tmp/md.conf.$$
1132 echo >> /tmp/md.conf.$$
1133 echo "# Begin MDD database info (do not edit)" >> /tmp/md.conf.$$
1134 sed -e 's/^set md://' -e 's/$/;/' ${SYSTEM_FILE} | \
1135 grep mddb_bootlist >> /tmp/md.conf.$$
1136 echo "# End MDD database info (do not edit)" >> /tmp/md.conf.$$
1137 cp /tmp/md.conf.$$ ${mdconf} || \
1138 echo "copy error: /tmp/md.conf.$$ to ${mdconf}"
1142 # add_devid_destroy(filename)
1143 # returns contents in filename
1144 # md_devid_destroy property is required when upgrading
1145 # from pre SVM to SVM releases or when the device ID returned from
1146 # the driver changes.
1147 # It is specifically placed between
1148 # # Begin MDD database info and # End MDD database info because
1149 # on the subsequent reboot, this line will be removed automatically when
1150 # metadevadm is run in rc2.d.
1152 add_devid_destroy() {
1153 cat $1 | awk '{
1154 if ( $2 == "End" && $4 == "database") {
1155 print "md_devid_destroy=1;"
1157 print $0
1158 }' >> /tmp/t$$
1159 mv /tmp/t$$ $1
1163 # Reads existing configuration values in /etc/rcap.conf and puts
1164 # them in repository upon reboot(via /var/svc/profile/upgrade).
1166 migrate_rcap_conf() {
1167 RCAP_CONF="${rootprefix}/etc/rcap.conf"
1168 PROFILE_UPGRADE="${rootprefix}/var/svc/profile/upgrade"
1169 SVCCFG="/usr/sbin/svccfg"
1170 RCAP_FMRI="svc:/system/rcap:default"
1171 PG="config"
1173 pressure=`awk '$1 == "RCAPD_MEMORY_CAP_ENFORCEMENT_PRESSURE" \
1174 && NF == 3 {print $3}' $RCAP_CONF`
1176 reconfig_int=`awk '$1 == "RCAPD_RECONFIGURATION_INTERVAL" \
1177 && NF == 3 {print $3}' $RCAP_CONF`
1179 walk_int=`awk '$1 == "RCAPD_PROC_WALK_INTERVAL" && \
1180 NF == 3 {print $3}' $RCAP_CONF`
1182 report_int=`awk '$1 == "RCAPD_REPORT_INTERVAL" && \
1183 NF == 3 {print $3}' $RCAP_CONF`
1185 rss_sample_int=`awk '$1 == "RCAPD_RSS_SAMPLE_INTERVAL" && \
1186 NF == 3 {print $3}' $RCAP_CONF`
1188 # Blindly update default configuration values with
1189 # pre-existing values
1191 echo "# Migrating pre-existing rcap configuration" >> \
1192 $PROFILE_UPGRADE
1194 echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/pressure = " \
1195 "$pressure" >> $PROFILE_UPGRADE
1197 echo "$SVCCFG -s $RCAP_FMRI " \
1198 "setprop ${PG}/reconfig_interval = $reconfig_int" >> \
1199 $PROFILE_UPGRADE
1201 echo "$SVCCFG -s $RCAP_FMRI " \
1202 "setprop ${PG}/walk_interval = $walk_int" >> \
1203 $PROFILE_UPGRADE
1205 echo "$SVCCFG -s $RCAP_FMRI " \
1206 "setprop ${PG}/report_interval = $report_int" >> \
1207 $PROFILE_UPGRADE
1209 echo "$SVCCFG -s $RCAP_FMRI " \
1210 "setprop ${PG}/rss_sample_interval = $rss_sample_int" >> \
1211 $PROFILE_UPGRADE
1213 echo "/usr/sbin/svcadm refresh $RCAP_FMRI" >> \
1214 $PROFILE_UPGRADE
1216 echo "rm /etc/rcap.conf" >> \
1217 $PROFILE_UPGRADE
1221 # Migrate an existing extended accounting configuration from /etc/acctadm.conf
1222 # to the smf(5) repository upon reboot. Enable the instance if the
1223 # configuration differs from the default configuration.
1225 migrate_acctadm_conf()
1227 cat >> $rootprefix/var/svc/profile/upgrade <<\_EOF
1228 if [ -f /etc/acctadm.conf ]; then
1229 . /etc/acctadm.conf
1231 fmri="svc:/system/extended-accounting:flow"
1232 eval $BFUSVCCFG -s $fmri setprop config/file = \
1233 ${ACCTADM_FLOW_FILE:="none"}
1234 eval $BFUSVCCFG -s $fmri setprop config/tracked = \
1235 ${ACCTADM_FLOW_TRACKED:="none"}
1236 eval $BFUSVCCFG -s $fmri setprop config/untracked = \
1237 ${ACCTADM_FLOW_UNTRACKED:="extended"}
1238 if [ ${ACCTADM_FLOW_ENABLE:="no"} = "yes" ]; then
1239 eval $BFUSVCCFG -s $fmri setprop config/enabled = "true"
1240 else
1241 eval $BFUSVCCFG -s $fmri setprop config/enabled = "false"
1243 if [ $ACCTADM_FLOW_ENABLE = "yes" -o \
1244 $ACCTADM_FLOW_FILE != "none" -o \
1245 $ACCTADM_FLOW_TRACKED != "none" ]; then
1246 svcadm enable $fmri
1249 fmri="svc:/system/extended-accounting:process"
1250 eval $BFUSVCCFG -s $fmri setprop config/file = \
1251 ${ACCTADM_PROC_FILE:="none"}
1252 eval $BFUSVCCFG -s $fmri setprop config/tracked = \
1253 ${ACCTADM_PROC_TRACKED:="none"}
1254 eval $BFUSVCCFG -s $fmri setprop config/untracked = \
1255 ${ACCTADM_PROC_UNTRACKED:="extended"}
1256 if [ ${ACCTADM_PROC_ENABLE:="no"} = "yes" ]; then
1257 eval $BFUSVCCFG -s $fmri setprop config/enabled = "true"
1258 else
1259 eval $BFUSVCCFG -s $fmri setprop config/enabled = "false"
1261 if [ $ACCTADM_PROC_ENABLE = "yes" -o \
1262 $ACCTADM_PROC_FILE != "none" -o \
1263 $ACCTADM_PROC_TRACKED != "none" ]; then
1264 svcadm enable $fmri
1267 fmri="svc:/system/extended-accounting:task"
1268 eval $BFUSVCCFG -s $fmri setprop config/file = \
1269 ${ACCTADM_TASK_FILE:="none"}
1270 eval $BFUSVCCFG -s $fmri setprop config/tracked = \
1271 ${ACCTADM_TASK_TRACKED:="none"}
1272 eval $BFUSVCCFG -s $fmri setprop config/untracked = \
1273 ${ACCTADM_TASK_UNTRACKED:="extended"}
1274 if [ ${ACCTADM_TASK_ENABLE:="no"} = "yes" ]; then
1275 eval $BFUSVCCFG -s $fmri setprop config/enabled = "true"
1276 else
1277 eval $BFUSVCCFG -s $fmri setprop config/enabled = "false"
1279 if [ $ACCTADM_TASK_ENABLE = "yes" -o \
1280 $ACCTADM_TASK_FILE != "none" -o \
1281 $ACCTADM_TASK_TRACKED != "none" ]; then
1282 svcadm enable $fmri
1285 fmri="svc:/system/extended-accounting:net"
1286 eval $BFUSVCCFG -s $fmri setprop config/file = \
1287 ${ACCTADM_NET_FILE:="none"}
1288 eval $BFUSVCCFG -s $fmri setprop config/tracked = \
1289 ${ACCTADM_NET_TRACKED:="none"}
1290 eval $BFUSVCCFG -s $fmri setprop config/untracked = \
1291 ${ACCTADM_NET_UNTRACKED:="extended"}
1292 if [ ${ACCTADM_NET_ENABLE:="no"} = "yes" ]; then
1293 eval $BFUSVCCFG -s $fmri setprop config/enabled = "true"
1294 else
1295 eval $BFUSVCCFG -s $fmri setprop config/enabled = "false"
1297 if [ $ACCTADM_NET_ENABLE = "yes" -o \
1298 $ACCTADM_NET_FILE != "none" -o \
1299 $ACCTADM_NET_TRACKED != "none" ]; then
1300 svcadm enable $fmri
1303 rm /etc/acctadm.conf
1305 _EOF
1309 # smf(5) "Greenline" doesn't install the init.d or rc*.d scripts for
1310 # converted services. Clean up previous scripts for such services.
1312 smf_obsolete_rc_files="
1313 etc/init.d/ANNOUNCE
1314 etc/init.d/MOUNTFSYS
1315 etc/init.d/RMTMPFILES
1316 etc/init.d/acctadm
1317 etc/init.d/audit
1318 etc/init.d/autofs
1319 etc/init.d/boot.server
1320 etc/init.d/coreadm
1321 etc/init.d/cron
1322 etc/init.d/cryptosvc
1323 etc/init.d/cvc
1324 etc/init.d/devfsadm
1325 etc/init.d/dhcp
1326 etc/init.d/dhcpagent
1327 etc/init.d/domainname
1328 etc/init.d/efcode
1329 etc/init.d/inetd
1330 etc/init.d/inetinit
1331 etc/init.d/inetsvc
1332 etc/init.d/initboot
1333 etc/init.d/ipfboot
1334 etc/init.d/kdc
1335 etc/init.d/kdc.master
1336 etc/init.d/keymap
1337 etc/init.d/ldap.client
1338 etc/init.d/libc.mount
1339 etc/init.d/network
1340 etc/init.d/nfs.client
1341 etc/init.d/nodename
1342 etc/init.d/nscd
1343 etc/init.d/perf
1344 etc/init.d/picld
1345 etc/init.d/power
1346 etc/init.d/rcapd
1347 etc/init.d/rootusr
1348 etc/init.d/rpc
1349 etc/init.d/savecore
1350 etc/init.d/sckm
1351 etc/init.d/sf880dr
1352 etc/init.d/slpd
1353 etc/init.d/sshd
1354 etc/init.d/standardmounts
1355 etc/init.d/svm.init
1356 etc/init.d/svm.sync
1357 etc/init.d/sysid.net
1358 etc/init.d/sysid.sys
1359 etc/init.d/syslog
1360 etc/init.d/utmpd
1361 etc/init.d/volmgt
1362 etc/init.d/xntpd
1363 etc/init.d/zones
1364 etc/rc0.d/K00ANNOUNCE
1365 etc/rc0.d/K01zones
1366 etc/rc0.d/K03sshd
1367 etc/rc0.d/K05volmgt
1368 etc/rc0.d/K07snmpdx
1369 etc/rc0.d/K10rcapd
1370 etc/rc0.d/K21dhcp
1371 etc/rc0.d/K27boot.server
1372 etc/rc0.d/K28kdc
1373 etc/rc0.d/K28kdc.master
1374 etc/rc0.d/K28nfs.server
1375 etc/rc0.d/K32cryptosvc
1376 etc/rc0.d/K33audit
1377 etc/rc0.d/K33efcode
1378 etc/rc0.d/K34svm.sync
1379 etc/rc0.d/K36sendmail
1380 etc/rc0.d/K36utmpd
1381 etc/rc0.d/K37power
1382 etc/rc0.d/K40cron
1383 etc/rc0.d/K40inetd
1384 etc/rc0.d/K40nscd
1385 etc/rc0.d/K40sf880dr
1386 etc/rc0.d/K40slpd
1387 etc/rc0.d/K40syslog
1388 etc/rc0.d/K40xntpd
1389 etc/rc0.d/K41autofs
1390 etc/rc0.d/K41ldap.client
1391 etc/rc0.d/K41nfs.client
1392 etc/rc0.d/K41rpc
1393 etc/rc0.d/K42sckm
1394 etc/rc0.d/K43inet
1395 etc/rc0.d/K68picld
1396 etc/rc0.d/K83devfsadm
1397 etc/rc0.d/K90dhcpagent
1398 etc/rc1.d/K00ANNOUNCE
1399 etc/rc1.d/K01zones
1400 etc/rc1.d/K03sshd
1401 etc/rc1.d/K05volmgt
1402 etc/rc1.d/K07snmpdx
1403 etc/rc1.d/K10rcapd
1404 etc/rc1.d/K21dhcp
1405 etc/rc1.d/K27boot.server
1406 etc/rc1.d/K28kdc
1407 etc/rc1.d/K28kdc.master
1408 etc/rc1.d/K28nfs.server
1409 etc/rc1.d/K33audit
1410 etc/rc1.d/K33efcode
1411 etc/rc1.d/K34svm.sync
1412 etc/rc1.d/K36sendmail
1413 etc/rc1.d/K36utmpd
1414 etc/rc1.d/K37power
1415 etc/rc1.d/K40cron
1416 etc/rc1.d/K40inetd
1417 etc/rc1.d/K40nscd
1418 etc/rc1.d/K40sf880dr
1419 etc/rc1.d/K40slpd
1420 etc/rc1.d/K40syslog
1421 etc/rc1.d/K40xntpd
1422 etc/rc1.d/K41autofs
1423 etc/rc1.d/K41ldap.client
1424 etc/rc1.d/K41rpc
1425 etc/rc1.d/K42sckm
1426 etc/rc1.d/K43inet
1427 etc/rc1.d/K99libc.mount
1428 etc/rc1.d/S01MOUNTFSYS
1429 etc/rc2.d/K01zones
1430 etc/rc2.d/K03sshd
1431 etc/rc2.d/K05volmgt
1432 etc/rc2.d/K07snmpdx
1433 etc/rc2.d/K21dhcp
1434 etc/rc2.d/K27boot.server
1435 etc/rc2.d/K28kdc
1436 etc/rc2.d/K28kdc.master
1437 etc/rc2.d/K28nfs.server
1438 etc/rc2.d/S01MOUNTFSYS
1439 etc/rc2.d/S05RMTMPFILES
1440 etc/rc2.d/S21perf
1441 etc/rc2.d/S30sysid.net
1442 etc/rc2.d/S65ipfboot
1443 etc/rc2.d/S69domainname
1444 etc/rc2.d/S69inet
1445 etc/rc2.d/S70sckm
1446 etc/rc2.d/S71ldap.client
1447 etc/rc2.d/S71rpc
1448 etc/rc2.d/S71sysid.sys
1449 etc/rc2.d/S72inetsvc
1450 etc/rc2.d/S72slpd
1451 etc/rc2.d/S73nfs.client
1452 etc/rc2.d/S74autofs
1453 etc/rc2.d/S74syslog
1454 etc/rc2.d/S74xntpd
1455 etc/rc2.d/S75cron
1456 etc/rc2.d/S75savecore
1457 etc/rc2.d/S76nscd
1458 etc/rc2.d/S77inetd
1459 etc/rc2.d/S77sf880dr
1460 etc/rc2.d/S85power
1461 etc/rc2.d/S88sendmail
1462 etc/rc2.d/S88utmpd
1463 etc/rc2.d/S95svm.sync
1464 etc/rc2.d/S98efcode
1465 etc/rc2.d/S98libc.mount
1466 etc/rc2.d/S99audit
1467 etc/rc2.d/S99rcapd
1468 etc/rc3.d/S13kdc.master
1469 etc/rc3.d/S14kdc
1470 etc/rc3.d/S15nfs.server
1471 etc/rc3.d/S16boot.server
1472 etc/rc3.d/S34dhcp
1473 etc/rc3.d/S76snmpdx
1474 etc/rc3.d/S81volmgt
1475 etc/rc3.d/S89sshd
1476 etc/rc3.d/S99zones
1477 etc/rcS.d/K01zones
1478 etc/rcS.d/K03sshd
1479 etc/rcS.d/K05volmgt
1480 etc/rcS.d/K07snmpdx
1481 etc/rcS.d/K10rcapd
1482 etc/rcS.d/K21dhcp
1483 etc/rcS.d/K27boot.server
1484 etc/rcS.d/K28kdc
1485 etc/rcS.d/K28kdc.master
1486 etc/rcS.d/K28nfs.server
1487 etc/rcS.d/K33audit
1488 etc/rcS.d/K33efcode
1489 etc/rcS.d/K34svm.sync
1490 etc/rcS.d/K36sendmail
1491 etc/rcS.d/K36utmpd
1492 etc/rcS.d/K37power
1493 etc/rcS.d/K40cron
1494 etc/rcS.d/K40inetd
1495 etc/rcS.d/K40nscd
1496 etc/rcS.d/K40sf880dr
1497 etc/rcS.d/K40slpd
1498 etc/rcS.d/K40syslog
1499 etc/rcS.d/K40xntpd
1500 etc/rcS.d/K41autofs
1501 etc/rcS.d/K41ldap.client
1502 etc/rcS.d/K41rpc
1503 etc/rcS.d/K42sckm
1504 etc/rcS.d/K43inet
1505 etc/rcS.d/K99libc.mount
1506 etc/rcS.d/S10cvc
1507 etc/rcS.d/S28network.sh
1508 etc/rcS.d/S29nodename.sh
1509 etc/rcS.d/S30rootusr.sh
1510 etc/rcS.d/S33keymap.sh
1511 etc/rcS.d/S35svm.init
1512 etc/rcS.d/S40standardmounts.sh
1513 etc/rcS.d/S42coreadm
1514 etc/rcS.d/S45initboot
1515 etc/rcS.d/S50devfsadm
1516 etc/rcS.d/S72cryptosvc
1517 etc/rcS.d/S95picld
1520 # Obsolete smf manifests
1521 smf_obsolete_manifests="
1522 var/svc/manifest/application/print/cleanup.xml
1523 var/svc/manifest/network/tftp.xml
1524 var/svc/manifest/network/lp.xml
1525 var/svc/manifest/system/filesystem/volfs.xml
1526 var/svc/manifest/network/pfil.xml
1527 var/svc/manifest/platform/sun4u/mpxio-upgrade.xml
1528 var/svc/manifest/network/tname.xml
1529 var/svc/manifest/network/aggregation.xml
1530 var/svc/manifest/network/datalink.xml
1531 var/svc/manifest/network/datalink-init.xml
1532 var/svc/manifest/network/iscsi_initiator.xml
1533 var/svc/manifest/network/fcoe_config.xml
1534 var/svc/manifest/network/rpc/ocfserv.xml
1537 # smf services whose manifests have been renamed
1538 smf_renamed_manifests="
1539 var/svc/manifest/milestone/name-service.xml
1540 var/svc/manifest/system/filesystem/boot-archive.xml
1543 # Obsolete smf methods
1544 smf_obsolete_methods="
1545 lib/svc/method/print-cleanup
1546 lib/svc/method/print-server
1547 lib/svc/method/svc-volfs
1548 lib/svc/method/pfil
1549 lib/svc/method/aggregation
1550 lib/svc/method/datalink
1551 lib/svc/method/datalink-init
1552 lib/svc/method/svc-kdc
1553 lib/svc/method/svc-kdc.master
1554 lib/svc/method/svc-kdc.slave
1555 lib/svc/share/krb_include.sh
1556 lib/svc/method/iscsid
1557 lib/svc/method/fcoeconfig
1560 smf_cleanup () {
1562 cd $root;
1563 print "Removing obsolete rc.d scripts ... \c"
1564 rm -f $smf_obsolete_rc_files
1565 print "done."
1569 smf_new_profiles () {
1570 [[ "$bfu_isa" = "sparc" ]] || return 0
1572 [[ -x /tmp/bfubin/svccfg ]] || return 0
1574 print "Clearing platform profile hash ..."
1576 # platform_SUNW,Sun-Fire.xml (and other new and
1577 # corrected platforms) were delivered in Build 68.
1578 if [ ! -f \
1579 $rootprefix/var/svc/profile/platform_SUNW,Sun-Fire.xml \
1580 ]; then
1581 for pfx in " " "v"; do
1582 for plname in \
1583 none \
1584 SUNW_Sun_Fire_880 \
1585 SUNW_Sun_Fire_V890 \
1586 SUNW_Sun_Fire_15000 \
1587 SUNW_UltraEnterprise_10000; do
1588 eval $BFUSVCCFG -f - <<EOF
1589 select smf/manifest
1590 delpg ${pfx}ar_svc_profile_platform_${plname}_xml
1591 exit
1593 done
1594 done
1598 smf_handle_new_services () {
1600 # Detect, prior to extraction the arrival of new,
1601 # default-enabled-in-profile services. If so, add a command
1602 # such that they are enabled.
1604 if [ ! -f $rootprefix/var/svc/profile/system/sac.xml ]; then
1605 echo /usr/sbin/svcadm enable system/sac >> \
1606 $rootprefix/var/svc/profile/upgrade
1608 if [[ $zone = global &&
1609 ! -f $rootprefix/var/svc/manifest/system/intrd.xml ]]; then
1610 echo /usr/sbin/svcadm enable system/intrd >> \
1611 $rootprefix/var/svc/profile/upgrade
1613 if [[ $zone = global &&
1614 ! -f $rootprefix/var/svc/manifest/system/scheduler.xml ]]; then
1615 echo /usr/sbin/svcadm enable system/scheduler >> \
1616 $rootprefix/var/svc/profile/upgrade
1618 if [[ $zone = global &&
1619 ! -f $rootprefix/var/svc/manifest/system/hal.xml ]]; then
1620 echo /usr/sbin/svcadm enable system/hal >> \
1621 $rootprefix/var/svc/profile/upgrade
1623 if [[ $zone = global &&
1624 ! -f $rootprefix/var/svc/manifest/system/filesystem/rmvolmgr.xml ]]; then
1625 echo /usr/sbin/svcadm enable system/filesystem/rmvolmgr >> \
1626 $rootprefix/var/svc/profile/upgrade
1628 if [[ $zone = global &&
1629 ! -f $rootprefix/var/svc/manifest/network/ipsec/manual-key.xml &&
1630 -f $rootprefix/etc/inet/secret/ipseckeys ]]; then
1631 smf_enable svc:/network/ipsec/manual-key:default
1633 if [[ $zone = global &&
1634 ! -f $rootprefix/var/svc/manifest/network/ipsec/ike.xml &&
1635 -f $rootprefix/etc/inet/ike/config ]]; then
1636 smf_enable svc:/network/ipsec/ike:default
1638 if [[ $zone = global &&
1639 ! -f $rootprefix/var/svc/manifest/system/pools.xml &&
1640 -f $rootprefix/etc/pooladm.conf ]]; then
1641 smf_enable svc:/system/pools:default
1643 if [[ $zone = global && $karch = sun4v &&
1644 ! -f $rootprefix/var/svc/manifest/platforms/sun4v/ldoms-agents.xml ]]; then
1645 smf_enable svc:/ldoms/agents:default
1649 smf_copy_manifest() {
1650 mfstbase=`basename $1`
1651 mymfs=$rootprefix/var/svc/manifest/$2/$mfstbase
1652 if [[ ! -f $mymfs ]] || ! cmp -s $manifest_src/$1 $mymfs ; then
1653 cp $manifest_src/$1 $mymfs ||
1654 echo "bfu: could not copy $manifest_src/$1"
1658 smf_copy_method() {
1659 cp $manifest_src/$1 $rootprefix/lib/svc/method ||
1660 echo "bfu: could not copy $manifest_src/$1"
1663 smf_cleanup_initd() {
1664 rm -f $rootprefix/etc/rc?.d/[SK]??$1
1667 smf_delete_manifest() {
1669 mfst=$1
1670 cd $root
1671 [[ -f $mfst ]] || return;
1672 if [ -r /etc/svc/volatile/repository_door ]; then
1673 ENTITIES=`eval $BFUSVCCFG inventory $mfst`
1674 for fmri in $ENTITIES; do
1675 if [[ -n $root && $root != "/" ]]; then
1676 SVCCFG_REPOSITORY=$root/etc/svc/repository.db
1677 export SVCCFG_REPOSITORY
1679 eval $BFUSVCCFG delete -f $fmri >/dev/null 2>&1
1680 if [[ -n $root && $root != "/" ]]; then
1681 unset SVCCFG_REPOSITORY
1683 done
1685 rm $mfst
1689 smf_delete_methods() {
1691 cd $root;
1692 rm -f $smf_obsolete_methods
1696 smf_delete_renamed_manifests() {
1698 cd $root;
1699 rm -f $smf_renamed_manifests
1703 smf_cleanup_dlmgmtd() {
1706 # Delete the service instance, then refresh all its dependents in the
1707 # cases of alternative root and zones.
1709 smf_delete_manifest "var/svc/manifest/network/dlmgmt.xml"
1711 if [[ -n $root && $root != "/" ]]; then
1712 export SVCCFG_REPOSITORY=$root/etc/svc/repository.db
1713 eval $BFUSVCCFG -s svc:/network/physical:nwam refresh
1714 eval $BFUSVCCFG -s svc:/network/physical:default refresh
1715 eval $BFUSVCCFG -s svc:/system/device/local:default refresh
1716 unset SVCCFG_REPOSITORY
1718 cd $root
1719 rm -f lib/svc/method/svc-dlmgmtd
1720 rm -f etc/.dlmgmt_door
1721 rm -f sbin/dlmgmtd
1725 smf_cleanup_nwam() {
1728 # Delete NWAM phase 1-specific components, which comprise the
1729 # netcfg, location and ipqos services and associated scripts/binaries.
1731 smf_delete_manifest "var/svc/manifest/network/network-netcfg.xml"
1732 smf_delete_manifest "var/svc/manifest/network/network-location.xml"
1733 smf_delete_manifest "var/svc/manifest/network/network-ipqos.xml"
1734 cd $root
1735 rm -f lib/svc/method/net-loc
1736 rm -f lib/inet/netcfgd
1737 rm -f lib/svc/method/net-ipqos
1738 rm -f usr/sbin/nwamcfg
1739 rm -f usr/sbin/nwamadm
1743 smf_cleanup_vt() {
1745 smf_delete_manifest var/src/manifest/system/vtdaemon.xml
1746 cd $root
1747 rm -f lib/svc/method/vtdaemon
1749 vt_conslogin_instances=`/tmp/bfubin/svcs -o FMRI | \
1750 grep console-login:vt`
1751 for i in $vt_conslogin_instances; do
1752 eval $BFUSVCCFG delete -f $i
1753 done
1757 smf_cleanup_boomer() {
1759 smf_delete_manifest var/src/manifest/system/devices-audio.xml
1760 cd $root
1761 rm -f lib/svc/method/devices-audio
1763 /tmp/bfubin/svccfg delete -f svc:/system/device/audio
1767 old_mfst_dir="var/svc/manifest.orig"
1768 new_mfst_dir="var/svc/manifest"
1770 smf_enable() {
1771 echo "svcadm enable $*" >> $rootprefix/var/svc/profile/upgrade
1774 smf_check_repository() {
1775 repository=etc/svc/repository.db
1776 [[ -f $rootprefix/$repository ]] || return
1778 print -n "$rootprefix/$repository: " >&2
1780 sqlite="${SQLITEBIN-$GATE/public/bin/$bfu_isa/sqlite}"
1781 [[ -x $sqlite ]] || sqlite=/lib/svc/bin/sqlite
1782 if [[ ! -x $sqlite ]]; then
1783 echo "no sqlite binary: skipped integrity check" >&2
1784 return
1787 rm -f /tmp/bfurepo.db;
1788 cp $rootprefix/$repository /tmp/bfurepo.db
1789 bad_errors=`echo "PRAGMA integrity_check;" |
1790 $sqlite /tmp/bfurepo.db 2>&1 | grep -v '^ok$'`
1791 if [[ $? -eq 0 ]]; then
1792 echo "integrity check failed:" >&2
1793 echo "$bad_errors" >&2
1794 echo >&2
1795 if [[ $force_override = no ]]; then
1796 cat >&2 <<EOF
1797 Reseed the repository (see http://greenline.eng/quickstart.shtml#newrep)
1798 before BFUing (or use the -f flag to force BFU to continue). Re-seeding
1799 will lose all smf(5) customizations.
1801 echo >&2
1802 exit 2;
1803 else
1804 echo "driving on anyway" >&2
1806 else
1807 echo "passed integrity check" >&2;
1811 smf_bkbfu_warning() {
1812 print ""
1813 print "*************************************************************"
1814 print " WARNING: BFU'ing $1 backwards across 5090532."
1815 print " Fixes have been made but the services cannot be refreshed"
1816 print " on the $1's inactive repository. Next boot for the"
1817 print " $1 will probably result in maintenance mode due to"
1818 print " dependency cycles. If so, at the $1's console, run:"
1819 print ""
1820 print " /usr/sbin/svcadm refresh system/sysidtool:system"
1821 print " /usr/sbin/svcadm refresh system/sysidtool:net"
1822 print " /usr/sbin/svcadm clear milestone/single-user"
1823 print " /usr/sbin/svcadm clear system/sysidtool:system"
1824 print " /usr/sbin/svcadm clear system/sysidtool:net"
1825 print ""
1826 print " to resolve."
1827 print " To avoid these problems, reseed the zone's repository."
1828 print " See http://greenline.eng/quickstart.shtml#newrep ."
1829 print " Note: Re-seeding will lose all smf(5) customization."
1830 print "*************************************************************"
1831 print ""
1834 smf_is_sysconfig() {
1836 # Return success if going to post-5090532, i.e. post-sysconfig bits
1838 # By now, we're going to post-smf bits - so multi-user.xml must
1839 # exist (since it was introduced by first SMF putback).
1841 # Function return status is return status of last command executed.
1842 # So, no need to check return status from grep below.
1844 grep sysconfig $rootprefix/var/svc/manifest/milestone/multi-user.xml \
1845 >/dev/null 2>&1
1848 smf_bkbfu_past_sysconfig() {
1850 # Check if bfu'ing back from post-5090532 to pre-5090532 bits.
1852 if [[ -f $rootprefix/var/svc/manifest/milestone/sysconfig.xml ]] &&
1853 ! smf_is_sysconfig ; then
1854 return 0
1856 return 1
1859 smf_bkbfu_repair_sysconfig() {
1861 # Perform the necessary corrections when bfu'ing backwards
1862 # from post-5090532 to pre-5090532 bits.
1864 # Get the pre-5090532 non-ON manifests, and issue minimal fixes
1865 # to the repository, to enable re-boot.
1867 smf_copy_manifest pre-5090532/sysidtool.xml system
1868 if [[ $zone = global && $karch = i86pc ]]; then
1869 smf_copy_manifest pre-5090532/kdmconfig.xml platform/i86pc
1872 # Now, remove sysidtool:{system, net}'s dependency on
1873 # single-user and filesystem-local.
1875 # If $rootprefix is not empty, this could be the global zone,
1876 # with an alternate root BFU, or a non-global zone. For either
1877 # case, the repository to be updated is not the live one: use
1878 # SVCCFG_REPOSITORY to point to the repository to be updated.
1880 # Note that in the alternate-root case, doing this seems better
1881 # than forcing the user to re-seed, or to dis-allow it. The
1882 # issue of svccfg and the repository not matching seems remote,
1883 # given that from initial SMF integration (on10_64) to on10_74,
1884 # there was no mismatch. In the remote possibility that there is a
1885 # mis-match (in the future) causing these calls to be suspect,
1886 # the user is already being advised, via the warning message, to
1887 # reseed the repository in case of trouble. If a mis-match is ever
1888 # introduced, code such as this would have to be fixed, so this
1889 # aspect of the warning is useful only during the interim period.
1891 # NOTE that this is not an issue for non-global zones'
1892 # repositories - they couldn't be out-of-sync with
1893 # /tmp/bfubin/svccfg.
1895 if [[ -n $rootprefix ]]; then
1896 export SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db
1897 if [[ $zone = global ]]; then
1898 smf_bkbfu_warning "alternate root"
1899 else
1900 smf_bkbfu_warning "zone"
1904 # Using the newer "-s" option to svccfg in the following is OK
1905 # since its introduction preceded 5090532 (and this routine wouldn't
1906 # be called unless the machine is running post-5090532 bits).
1908 eval $BFUSVCCFG -s system/sysidtool:net delpg single-user
1909 eval $BFUSVCCFG -s system/sysidtool:system delpg single-user
1910 eval $BFUSVCCFG -s system/sysidtool:net delpg filesystem_local
1911 eval $BFUSVCCFG -s system/sysidtool:system delpg filesystem_local
1914 # On a live system, issue the refresh; For alternate root or non-global
1915 # zone, the user was asked to issue the refreshes and "clear"s in the
1916 # message above after a post-bfu reboot.
1918 if [[ -z $rootprefix ]]; then
1919 /tmp/bfubin/svcadm refresh system/sysidtool:system \
1920 system/sysidtool:net
1924 # Now, reset SVCCFG_REPOSITORY, if it was set
1926 [[ -n $rootprefix ]] && unset SVCCFG_REPOSITORY
1929 # Remove the sysconfig.xml manifest when going back. So backward
1930 # bfu check continues to work, and all manifests are correct.
1932 cat >> $rootprefix/var/svc/profile/upgrade <<-EOF
1933 rm -f /var/svc/manifest/milestone/sysconfig.xml
1938 # Return true if $file exists in $archive. $file may also be a pattern.
1940 archive_file_exists()
1942 archive=$1
1943 file=$2
1945 $ZCAT $cpiodir/${archive}${ZFIX} | cpio -it 2>/dev/null | \
1946 egrep -s "$file"
1950 # extract one or more files from an archive into a temporary directory
1951 # provided by the caller. The caller is responsible for checking to
1952 # to see whether the desired file or files were extracted
1954 # $1 - archive
1955 # $2 - temporary dir
1956 # remaining args: file(s) to be extracted.
1958 archive_file_peek() {
1959 compressed_archive=`pwd`/$1
1960 tdir=$2
1961 shift
1962 shift
1963 if [ ! -d $tdir ] ; then
1964 return
1966 (cd $tdir; $ZCAT $compressed_archive | cpio -idmucB $* 2>&1 )
1970 # If we're no longer delivering the eeprom service, remove it from the system,
1971 # as eeprom -I is removed as well.
1973 smf_fix_i86pc_profile () {
1974 mfst="var/svc/manifest/platform/i86pc/eeprom.xml"
1975 profile="var/svc/profile/platform_i86pc.xml"
1977 if [ ! "$karch" = "i86pc" ]; then
1978 return
1981 if ! archive_file_exists generic.root "^$profile"; then
1982 rm -f $rootprefix/$profile
1983 rm -f $rootprefix/var/svc/profile/platform.xml
1986 if [ ! -f $rootprefix/$mfst ]; then
1987 return
1990 if archive_file_exists generic.root "^$mfst"; then
1991 return
1994 rm -f $rootprefix/$mfst
1997 # we must disable via svccfg directly, as manifest-import runs after
1998 # this service tries to run
2000 [[ -n "$rootprefix" ]] &&
2001 export SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db
2002 eval $BFUSVCCFG delete -f platform/i86pc/eeprom
2003 [[ -n "$rootprefix" ]] && unset SVCCFG_REPOSITORY
2007 # If the new system doesn't support the templates DTD extensions
2008 # (due to backwards bfu), the global.xml manifest should be deleted.
2010 smf_bkbfu_templates() {
2011 mfst="var/svc/manifest/system/svc/global.xml"
2013 grep "pg_pattern" \
2014 $rootprefix/usr/share/lib/xml/dtd/service_bundle.dtd.1> \
2015 /dev/null 2>&1
2016 if [ $? -eq 1 ]; then
2017 rm -f $rootprefix/$mfst
2022 smf_apply_conf () {
2024 # Go thru the original manifests and move any that were unchanged
2025 # (or are not system-provided) back to their proper location. This
2026 # will avoid superfluous re-import on reboot, as the inode and mtime
2027 # are both part of the hash.
2029 if [ -d $rootprefix/$old_mfst_dir ]; then
2030 for f in `cd $rootprefix/$old_mfst_dir ; find . -type f`
2032 old=$rootprefix/$old_mfst_dir/$f
2033 new=$rootprefix/$new_mfst_dir/$f
2034 if [ ! -f $new ]; then
2035 mkdir -m 0755 -p `dirname $new`
2036 mv $old $new
2037 continue
2039 cmp -s $old $new && mv $old $new
2040 done
2041 rm -rf $rootprefix/$old_mfst_dir
2044 if [ -f $rootprefix/etc/init.d/inetd ]; then
2046 # BFUing to non-SMF system -- undo our previous changes,
2047 # run an old hack, and skip the remainder of this function.
2049 smf_inetd_reenable
2050 smf_tftp_reinstall
2052 # Update inetd.conf only if we find rpc.metad file.
2053 [ -f $usr/sbin/rpc.metad ] &&
2054 inetd_conf_svm_hack
2056 return
2060 # At this point, the archive in question is a SMF version. If
2061 # the smf(5) repository does not yet exist, create it by copying
2062 # the appropriate seed repository. Since updating of non-global
2063 # zones only occurs when the live system is bfu'ed, the
2064 # appropriate seed is guaranteed to exist under the /lib
2065 # directory.
2067 repository=$rootprefix/etc/svc/repository.db
2068 if [ ! -f $repository ]; then
2069 print "Initializing service configuration repository ..."
2070 if [ $zone = global ]; then
2071 cp $rootprefix/lib/svc/seed/global.db $repository
2072 else
2073 cp /lib/svc/seed/nonglobal.db $repository
2075 chmod 0600 $repository
2076 chown root:sys $repository
2079 print "Removing obsolete smf services ..."
2080 for f in $smf_obsolete_manifests; do
2081 smf_delete_manifest $f
2082 done
2083 smf_delete_methods
2084 smf_delete_renamed_manifests
2086 if [[ $dlmgmtd_status = cleanup ]]; then
2087 smf_cleanup_dlmgmtd
2090 if [[ $nwam_status = cleanup ]]; then
2091 smf_cleanup_nwam
2094 # When doing backwards BFU, if the target does not contain
2095 # vtdaemon manifest, delete it and delete all the additional
2096 # console-login service instances which were used to provide
2097 # additional console sessions.
2099 if ((! $ZCAT $cpiodir/generic.root$ZFIX | cpio -it 2>/dev/null | \
2100 grep vtdaemon.xml > /dev/null 2>&1) && [ $zone = global ]); then
2101 smf_cleanup_vt
2105 # Remove the Boomer audio service when BFUing to legacy audio bits
2107 if ! check_boomer_bfu && [ $zone = global ]; then
2108 smf_cleanup_boomer
2111 print "Disabling unneeded inetd.conf entries ..."
2112 smf_inetd_disable
2113 smf_tftp_reinstall
2115 print "Connecting platform and name service profiles ..."
2117 rm -f $rootprefix/var/svc/profile/name_service.xml
2119 grep ldap $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
2120 is_ldap=$?
2121 grep nis $rootprefix/etc/nsswitch.conf >/dev/null 2>&1
2122 is_nis=$?
2124 if [ $is_ldap = 0 ]; then
2125 ns_profile=ns_ldap.xml
2126 elif [ $is_nis = 0 ]; then
2127 ns_profile=ns_nis.xml
2128 else
2129 ns_profile=ns_files.xml
2132 ln -s $ns_profile $rootprefix/var/svc/profile/name_service.xml
2134 rm -f $rootprefix/var/svc/profile/inetd_services.xml
2135 ln -s inetd_upgrade.xml $rootprefix/var/svc/profile/inetd_services.xml
2137 print "Marking converted services as enabled ..."
2139 [ -f $rootprefix/etc/resolv.conf ] && smf_enable network/dns/client
2140 [ -f $rootprefix/etc/inet/dhcpsvc.conf ] && \
2141 smf_enable network/dhcp-server
2143 # Not concerned about enabling/disabling rcap but will migrate
2144 # configuration parameters if rcap.conf exists
2146 if [ -f $rootprefix/etc/rcap.conf ]; then
2147 migrate_rcap_conf
2150 migrate_acctadm_conf
2152 if [ $zone = global ]; then
2153 if [ -f $rootprefix/etc/dfs/dfstab ] &&
2154 grep '^[ ]*[^# ]' $rootprefix/etc/dfs/dfstab \
2155 > /dev/null; then
2156 smf_enable network/nfs/server
2158 else
2159 echo "/usr/sbin/svcadm disable network/nfs/server" >> \
2160 $rootprefix/var/svc/profile/upgrade
2163 [ -f $rootprefix/etc/inet/ntp.conf ] && smf_enable network/ntp
2166 domainname=`cat $rootprefix/etc/defaultdomain 2>/dev/null`
2167 if [ ! -z "$domainname" -a -d $rootprefix/var/yp/$domainname ]; then
2168 smf_enable network/nis/server
2170 # Determining whether we're a NIS master requires
2171 # looking through the maps.
2172 cat >>$rootprefix/var/svc/profile/upgrade <<\_EOF
2173 # Determine whether we are a YP master.
2174 domain=`/usr/bin/domainname`
2175 hostname=`uname -n | cut -d. -f1 | tr '[A-Z]' '[a-z]'`
2177 if [ -x /usr/sbin/makedbm ]; then
2178 if [ -f /var/yp/NISLDAPmapping ]; then
2179 master=`/usr/sbin/makedbm -u /var/yp/\$domain/LDAP_passwd.byname | grep YP_MASTER_NAME | nawk '{ print $2 }'`
2180 else
2181 master=`/usr/sbin/makedbm -u /var/yp/\$domain/passwd.byname | grep YP_MASTER_NAME | nawk '{ print $2 }'`
2185 # If we are the master server, enable appropriate services.
2186 if [ "$master" = "$hostname" -a "$YP_SERVER" = "TRUE" ]; then
2187 /usr/sbin/svcadm enable network/nis/xfr
2188 /usr/sbin/svcadm enable network/nis/passwd
2190 if [ ! -f /var/yp/NISLDAPmapping ]; then
2191 [ -f /var/yp/updaters ] && \
2192 /usr/svc/svcadm enable network/nis/update
2195 _EOF
2198 # Check if mddbs don't exist on the image. If so, disable SVM services.
2199 MDDB_STATUS=1
2200 if [ -f $rootprefix/kernel/drv/md.conf ]; then
2201 sed -e 's/#.*$//' $rootprefix/kernel/drv/md.conf | \
2202 egrep '^[ ]*mddb_bootlist' >/dev/null 2>&1
2203 MDDB_STATUS=$?
2206 if [ $MDDB_STATUS -ne 0 ]; then
2207 for svc in metainit mdmonitor; do
2208 echo "/usr/sbin/svcadm disable system/$svc:default" >> \
2209 $rootprefix/var/svc/profile/upgrade
2210 done
2212 for svc in meta mdcomm metamed metamh; do
2213 echo "/usr/sbin/svcadm disable network/rpc/$svc:default" \
2214 >> $rootprefix/var/svc/profile/upgrade
2215 done
2218 # Workaround inetd's handling of "tcp6/udp6" when no IPv6 interfaces
2219 # are configured.
2220 for svc in meta mdcomm metamed metamh; do
2221 echo "/usr/sbin/inetadm -m network/rpc/$svc:default proto=tcp" \
2222 ">/dev/null 2>&1" >> $rootprefix/var/svc/profile/upgrade
2223 done
2225 manifest_src=${MANIFEST_SRC-$GATE/public/smf}
2226 [[ -d $manifest_src ]] ||
2227 manifest_src=${GATE}/public/smf
2228 [[ -d $manifest_src ]] || manifest_src=/net/greenline.eng/meta0/smf
2230 if smf_bkbfu_past_sysconfig ; then
2231 echo "BFU'ing backwards across 5090532! Now repairing..."
2232 smf_bkbfu_repair_sysconfig
2236 # If bfu'ing milestone/sysconfig bits or onwards, update the
2237 # corresponding non-ON manifests - sysidtool and kdmconfig.
2239 sysidmfst=$rootprefix/var/svc/manifest/system/sysidtool.xml
2240 kdmmfst=$rootprefix/var/svc/manifest/platform/i86pc/kdmconfig.xml
2241 if smf_is_sysconfig ; then
2242 if [[ ! -f $sysidmfst ]]; then
2244 # if WOS build on machine is pre-greenline, and
2245 # we're bfu'ing to the sysconfig bits.
2247 smf_copy_manifest post-5090532/sysidtool.xml system
2248 if [[ $zone = global ]]; then
2249 smf_copy_method sysidtool-net
2250 smf_copy_method sysidtool-system
2252 echo "Converted system/sysidtool (post-5090532)"
2253 else
2255 # If sysidtool.xml already exists, update it
2256 # if necessary. Future updates of sysidtool.xml
2257 # must occur in the dir: $manifest_src/post-5090532
2259 smf_copy_manifest post-5090532/sysidtool.xml system
2261 if [[ $zone = global && $karch = i86pc ]]; then
2262 if [[ ! -f $kdmmfst ]]; then
2264 # if WOS build on machine is pre-greenline, and
2265 # we're bfu'ing to the sysconfig bits.
2267 smf_copy_manifest post-5090532/kdmconfig.xml \
2268 platform/i86pc
2269 smf_copy_method svc-kdmconfig
2270 smf_cleanup_initd kdmconfig
2271 echo "Converted platform/i86pc/kdmconfig"
2272 echo "(post-5090532)"
2273 else
2275 # If kdmconfig.xml already exists, update
2276 # it if necessary. Future updates of
2277 # kdmconfig.xml must occur in the dir:
2278 # $manifest_src/post-5090532
2280 smf_copy_manifest post-5090532/kdmconfig.xml \
2281 platform/i86pc
2284 else
2285 if [[ ! -f $sysidmfst ]]; then
2286 smf_copy_manifest pre-5090532/sysidtool.xml system
2287 if [[ $zone = global ]]; then
2288 smf_copy_method sysidtool-net
2289 smf_copy_method sysidtool-system
2291 echo "Converted system/sysidtool"
2293 if [[ $zone = global && $karch = i86pc && ! -f $kdmmfst ]];
2294 then
2295 smf_copy_manifest pre-5090532/kdmconfig.xml \
2296 platform/i86pc
2297 smf_copy_method svc-kdmconfig
2298 smf_cleanup_initd kdmconfig
2299 echo "Converted platform/i86pc/kdmconfig"
2303 # If we've still got the old dtlogin manifest delivered by earlier
2304 # versions of bfu, delete it, as it was broken and should have
2305 # never been delivered. A new version delivered by the CDE
2306 # consolidation should be left alone.
2307 if [[ -f $rootprefix/var/svc/manifest/application/dtlogin.xml &&
2308 `grep -c GLXXX \
2309 $rootprefix/var/svc/manifest/application/dtlogin.xml` -gt 0 &&
2310 -x /tmp/bfubin/svccfg ]]; then
2312 # Delete the obsolete manifest.
2313 rm -f $rootprefix/var/svc/manifest/application/dtlogin.xml
2315 # Delete the service from repository, then use dtconfig -e to
2316 # revert to whatever the WOS bits are using if dtlogin was
2317 # enabled.
2318 cat >> $rootprefix/var/svc/profile/upgrade <<-EOFA
2319 if /usr/bin/svcprop -q application/cde-login; then
2320 if [ \`/usr/bin/svcprop -p general/enabled \
2321 application/cde-login:default\` = "true" ]; then
2322 do_dtconfig=1;
2323 else
2324 do_dtconfig=0;
2327 /usr/sbin/svccfg delete -f application/cde-login
2328 type instance_refresh 2>&1 > /dev/null
2329 if [ \$? = 0 ]; then
2330 instance_refresh system/console-login
2331 else
2332 /usr/sbin/svcadm refresh system/console-login
2335 if [ \$do_dtconfig -eq 1 -a -x /usr/dt/bin/dtconfig ]; then
2336 /usr/dt/bin/dtconfig -e
2339 EOFA
2343 # Enable the inetd-upgrade service to convert any changes to inetd.conf
2344 smf_enable network/inetd-upgrade
2346 # If global zone, and bfu'ing from smf, and the inetd-upgrade
2347 # service has an obsolete dependency, then add a clear of inetd
2348 # and inetd-upgrade to the upgrade file as either may drop into
2349 # maintenance due to a dependency loop resulting from the new
2350 # inetd manifest
2351 if [[ $zone = global && -x /tmp/bfubin/svccfg ]]; then
2352 /tmp/bfubin/svcprop -q -p network/entities network/inetd-upgrade
2353 if [[ $? = 0 ]]; then
2354 echo "/usr/sbin/svcadm clear network/inetd" >> \
2355 $rootprefix/var/svc/profile/upgrade
2356 echo "/usr/sbin/svcadm clear network/inetd-upgrade" >> \
2357 $rootprefix/var/svc/profile/upgrade
2362 # Import the name-service-cache service. This is to get the service
2363 # (with correct dependencies) in the repository before reboot.
2365 smf_import_service system/name-service-cache.xml
2368 # Import the datalink-management service. If datalink-managment
2369 # service exists, there is no need to ensure that the service is
2370 # enabled only after reboot. This enabling after reboot is
2371 # achieved by passing the service FMRI as the second argument to
2372 # smf_import_service().
2374 svcs svc:/network/datalink-management:default \
2375 >/dev/null 2>/dev/null
2376 if [ $? -eq 0 ]; then
2377 smf_import_service network/dlmgmt.xml
2378 else
2379 smf_import_service network/dlmgmt.xml \
2380 svc:/network/datalink-management:default
2384 # Import nwam service if backbfu'ing past NWAM phase 1. This
2385 # is needed prior to reboot to ensure that the nwam service (if active)
2386 # does not end up in maintenance state.
2388 if [[ $nwam_status = cleanup ]]; then
2389 smf_import_service network/network-physical.xml
2393 # Import the ldap/client service. This is to get the service
2394 # (with correct dependencies) in the repository before reboot.
2396 smf_import_service network/ldap/client.xml
2398 # Enable new NFS status and nlockmgr services if client is enabled
2399 cat >> $rootprefix/var/svc/profile/upgrade <<-EOF
2400 cl="svc:/network/nfs/client:default"
2401 if [ \`/usr/bin/svcprop -p general/enabled \$cl\` = "true" ]; then
2402 /usr/sbin/svcadm enable svc:/network/nfs/status:default
2403 /usr/sbin/svcadm enable svc:/network/nfs/nlockmgr:default
2408 kpmani="$rootprefix/var/svc/manifest/network/security/krb5_prop.xml"
2409 if grep svc-kdc.slave $kpmani > /dev/null 2>&1; then
2410 cat >> $rootprefix/var/svc/profile/upgrade <<EOF
2411 # We are deleting and reimporting kpropd's manifest, because we
2412 # need to change the restarter.
2413 kpfmri="svc:/network/security/krb5_prop"
2414 kkfmri="svc:/network/security/krb5kdc:default"
2415 lkpmani="/var/svc/manifest/network/security/krb5_prop.xml"
2416 restarter=\`svcprop -c -p general/restarter \$kpfmri 2>&1\`
2417 case \$restarter in
2418 *network/inetd:default)
2419 kken=\`svcprop -c -p general/enabled \$kkfmri\`
2420 eval $BFUSVCCFG delete -f \$kpfmri
2421 eval $BFUSVCCFG import \$lkpmani
2422 # Enable kpropd if krb5kdc is enabled, since
2423 # krb5kdc would have run kpropd
2424 if [ \$kken = "true" ]; then
2425 svcadm enable \$kpfmri
2428 esac
2432 # Enable print server if there are local queues
2433 queues=`echo $rootprefix/etc/lp/printers/*/configuration`
2434 if [ "$queues" != "$rootprefix/etc/lp/printers/*/configuration" ]; then
2435 smf_enable application/print/server
2438 # Enable rarpd and bootparamd if they would have been running pre-SMF
2439 if [ -d $rootprefix/tftpboot ] || [ -d $rootprefix/rplboot ]; then
2440 smf_enable network/rarp
2441 smf_enable network/rpc/bootparams
2444 touch $rootprefix/var/svc/profile/.upgrade_prophist
2446 cat >> $rootprefix/var/svc/profile/upgrade <<EOF
2447 # We are deleting and reimporting dcs's manifest, because we
2448 # need to change the restarter.
2449 dcsfmri="svc:/platform/sun4u/dcs:default"
2450 dcsmani="/var/svc/manifest/platform/sun4u/dcs.xml"
2451 restarter=\`svcprop -c -p general/restarter \$dcsfmri 2>&1\`
2452 case \$restarter in
2453 *network/inetd:default)
2454 en=\`svcprop -c -p general/enabled \$dcsfmri\`
2455 eval $BFUSVCCFG delete -f \$dcsfmri
2456 eval $BFUSVCCFG import \$dcsmani
2457 if [ \$en = "true" ]; then
2458 svcadm enable \$dcsfmri
2461 esac
2464 smf_fix_i86pc_profile
2466 smf_bkbfu_templates
2469 tx_check_update() {
2471 # If a lbl_edition file is found it's a likely sign that old unbundled
2472 # Trusted Extensions packages are installed and TX is active. Update
2473 # etc/system if needed, to complete enabling of the bundled TX.
2475 LMOD1=$rootprefix/kernel/sys/lbl_edition
2476 LMOD2=$rootprefix/kernel/sys/amd64/lbl_edition
2477 LMOD3=$rootprefix/kernel/sys/sparcv9/lbl_edition
2479 grep "^set sys_labeling=" $rootprefix/bfu.child/etc/system > \
2480 /dev/null 2>&1
2481 if [ $? -eq 0 ]; then
2482 return
2485 if [ -f $LMOD1 -o -f $LMOD2 -o -f $LMOD3 ]; then
2486 echo "set sys_labeling=1" >> $rootprefix/bfu.child/etc/system
2487 if [ $? -ne 0 ]; then
2488 echo "cannot set sys_labeling in $rootprefix/bfu.child/etc/system"
2489 return
2492 rm -f $LMOD1 $LMOD2 $LMOD3
2496 tx_check_bkbfu() {
2498 # Emit a warning message if bfu'ing a Trusted Extensions-enabled system
2499 # backwards to pre TX-merge bits. In this case, unbundled packages must
2500 # be reinstalled to complete restoration of old TX bits.
2502 bsmconv=$rootprefix/etc/security/bsmconv
2504 # This check is only needed in global zone
2505 if [[ $zone != global ]]; then
2506 return
2509 # No warning needed if TX is not currently enabled
2510 grep "^set sys_labeling=" $rootprefix/bfu.child/etc/system > \
2511 /dev/null 2>&1
2512 if [ $? -ne 0 ]; then
2513 return
2516 if [ ! -f $bsmconv ]; then
2517 return
2519 grep " -x /usr/bin/plabel " $bsmconv > /dev/null 2>&1
2520 if [ $? != 0 ]; then
2521 return
2524 print ""
2525 print "*************************************************************"
2526 print " WARNING: BFU'ing TX backwards across 6533113."
2527 print " Must re-install unbundled TX packages to remain Trusted."
2528 print "*************************************************************"
2529 print ""
2533 # The directboot putback moved the console property from
2534 # /boot/solaris/bootenv.rc to /boot/grub/menu.lst. It should be kept in both.
2536 cleanup_eeprom_console()
2538 bootenvrc="$root/boot/solaris/bootenv.rc"
2539 menu_console=`eeprom console 2>/dev/null | \
2540 grep -v 'data not available' | cut -d= -f2-`
2541 bootenv_console=`grep '^setprop[ ]\{1,\}console\>' $bootenvrc`
2542 if [ -n "$menu_console" ] && [ -z "$bootenv_console" ]; then
2543 echo "setprop console '$menu_console'" >> $bootenvrc
2547 EXTRACT_LOG=/tmp/bfu-extract-log.$$
2549 rm -f $EXTRACT_LOG
2551 extraction_error() {
2552 echo error $* >> $EXTRACT_LOG
2556 # Make a local copy of bfu in /tmp and execute that instead.
2557 # This makes us immune to loss of networking and/or changes
2558 # to the original copy that might occur during execution.
2560 cd .
2561 abspath=`[[ $0 = /* ]] && print $0 || print $PWD/$0`
2562 if [[ $abspath != /tmp/* ]]; then
2563 localpath=/tmp/bfu.$$
2564 print "Copying $abspath to $localpath"
2565 cp $abspath $localpath
2566 chmod +x $localpath
2567 print "Executing $localpath $*\n"
2568 exec $localpath $*
2571 export PATH=/usr/bin:/usr/sbin:/sbin
2573 usage() {
2574 echo "Usage:"
2575 echo " bfu [-fh] <archive_dir> [root-dir]"
2576 echo "\tUpdate a single machine by loading archives on root-dir."
2577 echo "\troot-dir defaults to / (a live bfu).\n"
2578 echo " bfu -c [-fh] <archive_dir> <exec-dir>"
2579 echo "\tUpdate all diskless clients by loading archives on each client"
2580 echo "\tthat mounts exec-dir as /usr. <exec-dir> must start with"
2581 echo "\t/export/exec and each client's root must be in /export/root.\n"
2582 echo "\t-f force bfu to continue even if it doesn't seem safe"
2583 fail "\t-h|-help print this usage message and exit\n"
2586 diskless=no
2587 force_override=no
2588 while [ $# -gt 0 ]; do
2589 case $1 in
2590 -c) diskless=yes;;
2591 -f) force_override=yes;;
2592 -h|-help) usage;;
2593 *) break;;
2594 esac
2595 shift
2596 done
2598 # Variables for x86 platforms
2599 boot_is_pcfs=no
2600 have_realmode=no
2601 is_pcfs_boot=no
2602 new_dladm=no
2604 # Set when moving to either directboot or multiboot
2605 multi_or_direct=no
2608 # Shows which type of archives we have, which type of system we are
2609 # running on (before the bfu), and what the failsafe archives are
2610 # (again, before the bfu). failsafe_type is only needed on diskful
2611 # bfu's, so it's not set in the diskless case.
2612 # Possible values: unknown, dca, multiboot, directboot, xpv
2614 archive_type=unknown
2615 system_type=unknown
2616 failsafe_type=unknown
2618 test $# -ge 1 || usage
2620 if [ -x /usr/bin/ppriv ]; then
2621 # We prefer to use ppriv, as it is a more accurate test, and also
2622 # has the benefit of preventing use from within a nonglobal zone.
2623 ppriv $$ | grep -w "E: all" > /dev/null 2>&1 || \
2624 fail "bfu requires all privileges"
2625 else
2626 # Fall back to old id check if system does not yet have ppriv.
2627 uid=`id | nawk '{print $1}'`
2628 [ "$uid" = "uid=0(root)" ] || \
2629 fail "You must be super-user to run this script."
2632 bfu_isa=`uname -p`
2633 target_isa=$bfu_isa
2634 karch=`uname -m`
2635 plat=`uname -i`
2637 cpiodir=$1
2639 if [ "$cpiodir" = again ]; then
2640 cpiodir=`nawk '/^bfu.ed from / { print $3; exit }' /etc/motd`
2643 [[ "$cpiodir" = */* ]] || cpiodir=$ARCHIVE/archives/$target_isa/$1
2645 [[ "$cpiodir" = /* ]] || fail "archive-dir must be an absolute path"
2647 cd $cpiodir
2648 case `echo generic.root*` in
2649 generic.root) ZFIX=""; ZCAT="cat";;
2650 generic.root.gz) ZFIX=".gz"; ZCAT="gzip -d -c";;
2651 generic.root.Z) ZFIX=".Z"; ZCAT="zcat";;
2652 *) fail "generic.root missing or in unknown compression format";;
2653 esac
2656 # Determine what kind of archives we're installing, using the following rules:
2658 # 1. If i86xpv archives exist, the archives are xpv
2659 # 2. If strap.com is present, the archives are pre-multiboot
2660 # 3. If symdef is present, the archives are directboot
2661 # 4. Otherwise, the archives are multiboot
2663 if [ $target_isa = i386 ]; then
2664 if [ -f $cpiodir/i86xpv.root$ZFIX ]; then
2665 archive_type=xpv
2666 multi_or_direct=yes
2667 elif [ -f $cpiodir/i86pc.boot$ZFIX ] && \
2668 archive_file_exists i86pc.boot "strap.com"; then
2669 archive_type=dca
2670 elif [ -f $cpiodir/i86pc.root$ZFIX ] && \
2671 archive_file_exists i86pc.boot symdef; then
2672 archive_type=directboot
2673 multi_or_direct=yes
2674 else
2675 archive_type=multiboot
2676 multi_or_direct=yes
2680 if [ $diskless = no ]; then
2681 root=${2:-/}
2682 [[ "$root" = /* ]] || fail "root-dir must be an absolute path"
2683 usrroot=$root
2684 usr=${usrroot%/}/usr
2685 rootlist=$root
2687 [[ -f $root/etc/system ]] || \
2688 fail "$root/etc/system not found; nonglobal zone target not allowed"
2690 rootfstype=`df -n $root | awk '{print $3}'`
2692 if [ "$rootfstype" = "zfs" ]; then
2693 archive_has_zfs_root_support=no
2694 mkdir /tmp/zfschk.$$
2695 archive_file_peek generic.lib /tmp/zfschk.$$ \
2696 "lib/svc/share/fs_include.sh"
2697 if [ -f /tmp/zfschk.$$/lib/svc/share/fs_include.sh ] ; then
2698 if grep '^readswapdev' \
2699 /tmp/zfschk.$$/lib/svc/share/fs_include.sh \
2700 >/dev/null 2>&1 ; then
2701 archive_has_zfs_root_support=yes
2704 rm -fr /tmp/zfschk.$$
2706 if [ "$archive_has_zfs_root_support" = "no" ] ; then
2707 fail "Cannot bfu a system with zfs root to an archive with no zfs root support"
2711 # Make sure we extract the sun4u-us3 libc_psr.so.1
2712 if [ -d $root/platform/sun4u -a \
2713 ! -d $root/platform/sun4u-us3 ]
2714 then
2715 mkdir $root/platform/sun4u-us3
2716 chmod 755 $root/platform/sun4u-us3
2717 chown root $root/platform/sun4u-us3
2718 chgrp sys $root/platform/sun4u-us3
2721 if [ $target_isa = i386 ]; then
2722 if [ $archive_type = xpv ]; then
2724 # On i386, we want to apply the archives for both
2725 # platforms (i86pc and i86xpv) if they exist. We
2726 # force the platform to i86xpv so that both will be
2727 # applied.
2729 karch=i86pc
2730 plat=i86xpv
2732 if [ ! -d $root/platform/i86hvm ]; then
2733 mkdir $root/platform/i86hvm
2737 if [ $karch != $plat -a -f ${cpiodir}/${plat}.usr$ZFIX ]; then
2738 usrarchs="$karch $plat"
2739 else
2740 usrarchs="$karch"
2742 if [ $karch != $plat -a -f ${cpiodir}/${plat}.root$ZFIX ]; then
2743 rootarchs="$karch $plat"
2744 else
2745 rootarchs="$karch"
2748 if [ -h ${root}/platform/${plat} ]; then
2749 rm -f ${root}/platform/${plat}
2751 if [ -h ${usr}/platform/${plat} ]; then
2752 rm -f ${usr}/platform/${plat}
2755 if [ $plat != $karch -a -f ${cpiodir}/${plat}.root$ZFIX \
2756 -a -f ${cpiodir}/${plat}.usr$ZFIX ]
2757 then
2758 cd $cpiodir
2760 # Look through all the archives we build and match
2761 # the names of built archives with the names of
2762 # directories installed on this machine. We assume
2763 # here that we can get the names of all architectures
2764 # by pattern matching the names of .root archives - so
2765 # if we ever had a case where we had only a .usr archive
2766 # we wouldn't find that archive.
2768 for i in *.root*
2770 platname=${i%.root*}
2771 if [ -z "${platname}" -o ${platname} = $karch -o \
2772 $platname = generic -o ${platname} = $plat ]; then
2773 continue;
2775 if [ -d ${root}/platform/${platname} -o \
2776 -h ${root}/platform/${platname} ]; then
2777 rootarchs="${rootarchs} ${platname}"
2779 if [ -d ${usr}/platform/${platname} -o \
2780 -h ${usr}/platform/${platname} ]; then
2781 usrarchs="${usrarchs} ${platname}"
2783 if [ -h ${root}/platform/${platname} ]; then
2784 rm -f ${root}/platform/${platname}
2786 if [ -h ${usr}/platform/${platname} ]; then
2787 rm -f ${usr}/platform/${platname}
2789 done
2791 if [ "$rootfstype" = "ufs" ] ; then
2792 rootslice=`df -k $root | nawk 'NR > 1 { print $1 }' | \
2793 sed s/dsk/rdsk/`
2796 print "Loading $cpiodir on $root"
2797 else
2798 usrroot=$2
2799 usr=$2/usr
2800 [[ "$usr" = /export/exec/* ]] || fail "exec-dir $usrroot sounds bogus"
2801 case $2 in
2802 *sparc*)
2803 target_isa=sparc ;;
2804 *i386*)
2805 target_isa=i386 ;;
2806 esac
2807 cd $cpiodir
2808 test -f generic.root$ZFIX || fail "$cpiodir/generic.root$ZFIX missing"
2809 allarchs=$(echo $(ls *.root$ZFIX | grep -v generic.root$ZFIX | \
2810 sed -e 's/.root.*//'))
2812 if [ $target_isa = i386 -a $archive_type = xpv ]; then
2814 # On i386, we want to apply the archives for both platforms
2815 # (i86pc and i86xpv) if they exist. We force the platform
2816 # to i86xpv so that both will be applied.
2818 karch=i86pc
2819 plat=i86xpv
2820 else
2821 # XXX Pick karch as last available root arch
2822 karch=${allarchs##* }
2823 # XXX Pick plat as first available root arch
2824 plat=${allarchs%% *}
2827 rootlist=""
2828 for root in /export/root/*
2830 test -f $root/etc/vfstab &&
2831 egrep -s $usrroot $root/etc/vfstab &&
2832 rootlist="$rootlist $root"
2833 done
2834 test -n "$rootlist" || fail "no clients to upgrade"
2835 print "Loading $cpiodir usr archives on:\n\t$usr\n"
2836 print "Loading $cpiodir root archives on:"
2837 for root in $rootlist
2839 print "\t$root"
2840 done
2843 if grep '^[ ]*zfsroot:' $root/etc/system >/dev/null && \
2844 archive_file_exists i86pc.boot boot/grub/zfs_stage1_5; then
2845 echo "Cannot BFU a system with the mountroot version"\
2846 "of zfs boot support."
2847 echo "For information on how to transition this system to the new"
2848 echo "zfs boot support, see:"
2849 echo "http://www.opensolaris.org/os/community/zfs/boot/zfsboot-manual/mntroot-transition/"
2850 fail ""
2853 nss_lib="$usr/lib/mps/libnss3.so"
2854 nss_lib64="$usr/lib/mps/64/libnss3.so"
2855 valid_rpath="\$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps"
2856 rpath_msg="R(UN)?PATH from file ${nss_lib}\)"
2857 if [ ! -x /usr/bin/ldd ]; then
2858 if [ "$force_override" = yes ]; then
2859 echo "/usr/bin/ldd is missing but -f is set; continuing."
2860 else
2861 echo "/usr/bin/ldd is missing."
2862 fail "Install the SUNWtoo package."
2865 nss_rpath=`ldd -s $nss_lib | egrep "$rpath_msg" | head -1 | cut -d'=' -f2 | \
2866 awk '{print $1}'`
2867 update_script="${GATE}/public/bin/update_nsspkgs"
2868 if [ $valid_rpath != "$nss_rpath" ]; then
2869 if [ "$force_override" = yes ]; then
2870 echo "$nss_lib is not valid but -f is set; continuing."
2871 else
2872 echo "$nss_lib is not valid."
2873 fail "Run $update_script to update the SUNWtls package."
2876 if [ $target_isa = i386 -a ! -f $nss_lib64 ]; then
2877 echo "$nss_lib64 does not exist."
2878 fail "Run $update_script to update the NSS packages."
2881 update_script="${GATE}/public/bin/migrate_bind9"
2882 if [[ ! -f $usr/lib/dns/libdns.so ]] && ! $ZCAT $cpiodir/generic.usr$ZFIX | \
2883 cpio -it 2>/dev/null | egrep -s '^usr/sbin/ndc' ; then
2884 if [ "$force_override" = yes ]; then
2885 echo "BIND 9 has not been installed, but -f is set; continuing."
2886 else
2887 echo "BIND 8 has been removed from ON; BIND 9 is available from SFW."
2888 fail "Run $update_script to migrate to BIND 9."
2892 update_script="${GATE}/public/bin/update_ce"
2893 if ifconfig -a | egrep '^ce' >/dev/null 2>/dev/null; then
2894 # CE version 1.148 or later is required
2895 cever=`modinfo | grep 'CE Ethernet' | sed 's/.*v1\.//' | tr -d ')' | \
2896 nawk '{ if ($1 < 148) print "BAD"; else print $1 }'`
2897 if [ "$cever" = "BAD" ]; then
2898 fail "You must run $update_script to upgrade your ce driver."
2902 update_script="${GATE}/public/bin/update_dbus"
2903 if [ ! -x $usr/lib/dbus-daemon ]; then
2904 fail "Run $update_script to update D-Bus."
2908 # We need biosdev if we're moving from pre-multiboot to multiboot or directboot
2909 # kernels. If we already have an i86xpv kernel, then we must already be a
2910 # directboot kernel, and can therefore skip the check.
2912 if [ $target_isa = i386 ] && [ $multi_or_direct = yes ] && \
2913 [ $diskless = no ] && [ ! -d /platform/i86xpv/ ]; then
2914 prtconf -v | grep biosdev >/dev/null 2>&1
2915 if [ $? -ne 0 ] && [ ! -f $rootprefix/platform/i86pc/multiboot ]; then
2916 echo "biosdev cannot be run on this machine."
2917 echo "Transitioning from classic to multiboot requires a"
2918 echo "bootconf which is compatible with biosdev."
2919 echo "bfu to onnv_12 first, then to a build with multiboot."
2920 fail ""
2925 # Check whether the archives have a datalink-management services; this is
2926 # later used to determine whether we need to upgrade the existing datalink
2927 # configuration and if the datalink-management service needs to be removed.
2929 if archive_file_exists generic.sbin "sbin/dlmgmtd"; then
2930 dlmgmtd_exists=true
2931 else
2932 dlmgmtd_exists=false
2935 # Set the value of dlmgmtd_status based on the existence of the
2936 # /sbin/dlmgmtd file
2938 dlmgmtd_status=none
2939 if [[ -f $root/sbin/dlmgmtd ]] && ! $dlmgmtd_exists ; then
2940 dlmgmtd_status=cleanup
2941 elif [[ ! -f $root/sbin/dlmgmtd ]] && $dlmgmtd_exists ; then
2942 dlmgmtd_status=new
2946 # Check whether the archives have an etc/dladm directory; this is
2947 # later used to determine if aggregation.conf needs to be moved.
2949 if $ZCAT $cpiodir/generic.root$ZFIX | cpio -it 2>/dev/null | \
2950 grep etc/dladm > /dev/null 2>&1 ; then
2951 new_dladm=yes
2955 # The Clearview IP Tunneling project changes the format of the
2956 # /etc/dladm/datalink.conf file. The conversion is done in the
2957 # dlmgmtd daemon, so there is no backwards conversion when bfu'ing
2958 # backwards. The solution is to have bfu save the old file away when
2959 # bfu'ing across this project, and restore it when bfu'ing back.
2961 datalink_file=$root/etc/dladm/datalink.conf
2962 datalink_backup=$root/etc/dladm/datalink.conf.bfusave
2963 datalink_action=none
2964 if [[ -f $datalink_file ]]; then
2965 iptun_exists=false
2966 if archive_file_exists generic.kernel "kernel/drv/iptun.conf"; then
2967 iptun_exists=true
2969 if [[ ! -f $root/kernel/drv/iptun.conf ]] && $iptun_exists; then
2970 datalink_action=save
2971 elif [[ -f $root/kernel/drv/iptun.conf ]] && ! $iptun_exists; then
2972 datalink_action=restore
2977 # Check whether the archives have a netcfgd service; this is later used to
2978 # determine whether we need to remove the netcfg and location services as
2979 # part of a backbfu using a pre-NWAM phase 1 archive.
2981 if archive_file_exists generic.lib "lib/inet/netcfgd"; then
2982 netcfgd_exists=true
2983 else
2984 netcfgd_exists=false
2987 nwam_status=none
2988 if [[ -f $root/lib/inet/netcfgd ]] && ! $netcfgd_exists ; then
2989 nwam_status=cleanup
2993 # Check whether the build is boot-archive or ufsboot sparc
2994 # boot based on the existence of a generic.boot archive
2996 newboot_sparc=no
2997 if [ $target_isa = sparc -a -f $cpiodir/generic.boot$ZFIX ]; then
2998 newboot_sparc=yes
3001 time_ref=/tmp/bfu.time_ref.$$
3002 rm -f $time_ref
3003 touch $time_ref || fail "$time_ref: Unable to create time reference."
3004 time_ref_seconds=$SECONDS
3006 print "\nCreating bfu execution environment ..."
3009 # Save off a few critical libraries and commands, so that bfu will
3010 # continue to function properly even in the face of major
3011 # kernel/library/command incompatibilities during a live upgrade.
3013 bfucmd="
3014 /usr/bin/awk
3015 /usr/bin/cat
3016 /usr/bin/chgrp
3017 /usr/bin/chmod
3018 /usr/bin/chown
3019 /usr/bin/cmp
3020 /usr/bin/cp
3021 /usr/bin/cpio
3022 /usr/bin/csh
3023 /usr/bin/cut
3024 /usr/bin/date
3025 /usr/bin/dd
3026 /usr/bin/df
3027 /usr/bin/diff
3028 /usr/bin/du
3029 /usr/bin/echo
3030 /usr/bin/ed
3031 /usr/bin/egrep
3032 /usr/bin/env
3033 /usr/bin/ex
3034 /usr/bin/expr
3035 /usr/bin/false
3036 /usr/bin/fgrep
3037 /usr/bin/file
3038 /usr/bin/find
3039 /usr/bin/gettext
3040 /usr/bin/grep
3041 /usr/bin/head
3042 /usr/bin/id
3043 /usr/bin/ksh
3044 /usr/bin/ksh93
3045 /usr/bin/line
3046 /usr/bin/ln
3047 /usr/bin/ls
3048 /usr/bin/mkdir
3049 /usr/bin/mktemp
3050 /usr/bin/more
3051 /usr/bin/mv
3052 /usr/bin/nawk
3053 /usr/bin/od
3054 /usr/bin/pgrep
3055 /usr/bin/pkginfo
3056 /usr/bin/pkill
3057 /usr/bin/plabel
3058 /usr/bin/printf
3059 /usr/bin/ps
3060 /usr/bin/ptree
3061 /usr/bin/rm
3062 /usr/bin/rmdir
3063 /usr/bin/sed
3064 /usr/bin/sh
3065 /usr/bin/sort
3066 /usr/bin/strings
3067 /usr/bin/stty
3068 /usr/bin/su
3069 /usr/bin/tail
3070 /usr/bin/tee
3071 /usr/bin/touch
3072 /usr/bin/tr
3073 /usr/bin/true
3074 /usr/bin/truss
3075 /usr/bin/tty
3076 /usr/bin/uname
3077 /usr/bin/uniq
3078 /usr/bin/uptime
3079 /usr/bin/vi
3080 /usr/bin/w
3081 /usr/bin/wc
3082 /usr/bin/xargs
3083 /usr/bin/zcat
3084 /lib/svc/bin/mfstscan
3085 /usr/sbin/add_drv
3086 /usr/sbin/chroot
3087 /usr/sbin/fstyp
3088 /usr/sbin/halt
3089 /usr/sbin/lockfs
3090 /usr/sbin/lofiadm
3091 /usr/sbin/logadm
3092 /usr/sbin/mkfile
3093 /usr/sbin/mkfs
3094 /usr/sbin/mknod
3095 /usr/sbin/mount
3096 /usr/sbin/newfs
3097 /usr/sbin/pkgrm
3098 /usr/sbin/prtconf
3099 /usr/sbin/reboot
3100 /usr/sbin/rem_drv
3101 /usr/sbin/sync
3102 /usr/sbin/tar
3103 /usr/sbin/uadmin
3104 /usr/sbin/umount
3105 /usr/sbin/update_drv
3106 /usr/sbin/wall
3107 /usr/sbin/zfs
3108 /usr/sbin/zpool
3109 /usr/sbin/zonecfg
3110 ${FASTFS-$GATE/public/bin/$bfu_isa/fastfs}
3111 ${GZIPBIN-$GATE/public/bin/$bfu_isa/gzip}
3115 # Add /usr/xpg4/bin/grep to the bfucmd list as xpg4grep
3117 rm -rf /tmp/xpg4grep
3118 cp /usr/xpg4/bin/grep /tmp/xpg4grep
3119 bfucmd="${bfucmd} /tmp/xpg4grep"
3122 # Scripts needed by BFU. These must be modified to use the interpreters in
3123 # /tmp/bfubin. The interpreters in /usr/bin may not be compatible with the
3124 # libraries in the archives being extracted.
3126 bfuscr=""
3129 # Tools which may be either scripts or ELF binaries,
3130 # so we need to check them before adding to either $bfucmd or $bfuscr.
3131 # This does not handle compiled shell scripts yet.
3133 bfuchameleons="
3134 /usr/bin/basename
3135 /usr/bin/bg
3136 /usr/bin/cd
3137 /usr/bin/cksum
3138 /usr/bin/cmp
3139 /usr/bin/comm
3140 /usr/bin/command
3141 /usr/bin/dirname
3142 /usr/bin/cut
3143 /usr/bin/fc
3144 /usr/bin/fg
3145 /usr/bin/gconftool-2
3146 /usr/bin/getopts
3147 /usr/bin/hash
3148 /usr/bin/jobs
3149 /usr/bin/join
3150 /usr/bin/kill
3151 /usr/bin/logname
3152 /usr/bin/paste
3153 /usr/bin/print
3154 /usr/bin/read
3155 /usr/bin/rev
3156 /usr/bin/sleep
3157 /usr/bin/sum
3158 /usr/bin/tee
3159 /usr/bin/test
3160 /usr/bin/type
3161 /usr/bin/ulimit
3162 /usr/bin/umask
3163 /usr/bin/unalias
3164 /usr/bin/uniq
3165 /usr/bin/wait
3166 /usr/bin/wc
3169 for chameleon in ${bfuchameleons} ; do
3170 if [[ "$(file "${chameleon}")" == *ELF* ]] ; then
3171 bfucmd="${bfucmd} ${chameleon}"
3172 else
3173 bfuscr="${bfuscr} ${chameleon}"
3175 done
3177 rm -rf /tmp/bfubin
3178 mkdir /tmp/bfubin
3179 set $bfucmd
3180 isalist=`isalist`
3181 while [ $# -gt 0 ]
3183 dir=${1%/*}
3184 cmd=${1##*/}
3185 cd $dir
3186 isacmd=`(find $isalist -name $cmd 2>/dev/null; echo $cmd) | head -1`
3187 cp $dir/$isacmd /tmp/bfubin || fail "cannot copy $dir/$isacmd"
3188 shift
3189 done
3192 # Optional commands. We warn, but do not abort, if we are crossing a
3193 # feature boundary (where a command is not present in the parent).
3194 # Clauses requiring these commands must explicitly test for their
3195 # presence in /tmp/bfubin.
3197 bfuoptcmd="
3198 /sbin/biosdev
3199 /sbin/bootadm
3200 /sbin/installgrub
3201 /usr/sbin/fdisk
3202 /usr/sbin/metastat
3203 /usr/bin/mkisofs
3204 /usr/sbin/svcadm
3205 /usr/sbin/svccfg
3206 /usr/bin/svcprop
3207 /usr/bin/svcs
3210 set $bfuoptcmd
3211 isalist=`isalist`
3212 while [ $# -gt 0 ]
3214 dir=${1%/*}
3215 cmd=${1##*/}
3216 cd $dir
3217 isacmd=`(find $isalist -name $cmd 2>/dev/null; echo $cmd) | head -1`
3218 cp $dir/$isacmd /tmp/bfubin 2>/dev/null
3219 shift
3220 done
3224 # set up installgrub and friends if transitioning to multiboot or directboot
3225 # do this now so ldd can determine library dependencies
3227 # We split the binaries into two groups: the type where we want to make any
3228 # effort to get the newest version (like symdef and bootadm), and the type
3229 # where any old version will do (like installgrub and biosdev).
3231 # If we're bfu'ing across the directboot/multiboot boundary, we need the new
3232 # bootadm and symdef to properly handle menu.lst changes. If the system is
3233 # directboot, we can use the local copies. If the system is multiboot but
3234 # the archives are directboot, we extract the binaries early. Otherwise,
3235 # we're not crossing the boundary, and which one we use doesn't matter.
3237 # NB - if bootadm or symdef is ever changed to require a new library, the
3238 # early extraction will blow up horribly.
3240 # For testing purposes, a user can set DIRECTBOOT_BIN_DIR in the environment,
3241 # and we'll use that instead.
3243 MULTIBOOT_BIN_DIR=${MULTIBOOT_BIN_DIR:=${GATE}/public/multiboot}
3244 have_new_bootadm=unknown
3246 if [ -f "$root/platform/i86xpv/kernel/unix" ]; then
3247 root_is_xpv=yes
3248 root_is_directboot=yes
3249 elif [ -x "$root/boot/solaris/bin/symdef" ] && \
3250 "$root"/boot/solaris/bin/symdef "$root/platform/i86pc/kernel/unix" \
3251 dboot_image; then
3252 root_is_xpv=no
3253 root_is_directboot=yes
3254 else
3255 root_is_xpv=no
3256 root_is_directboot=no
3260 # A comma-separated list of the command and the archive it's in
3262 multiboot_new_cmds="
3263 sbin/bootadm,generic.sbin
3264 boot/solaris/bin/symdef,i86pc.boot
3267 if [ $multi_or_direct = yes ]; then
3268 for line in $multiboot_new_cmds
3270 cmd=${line%,*}
3271 file=${cmd##*/}
3272 archive=${line#*,}
3273 if [ -n "$DIRECTBOOT_BIN_DIR" ] && \
3274 [ -f $DIRECTBOOT_BIN_DIR/$file ]; then
3275 cp $DIRECTBOOT_BIN_DIR/$file /tmp/bfubin/
3276 else
3277 if [[ $root_is_xpv = yes ||
3278 $root_is_directboot = yes &&
3279 $archive_type = multiboot ]]; then
3280 cp $root/$cmd /tmp/bfubin/
3281 have_new_bootadm=yes
3282 elif [ $archive_type = directboot ] || \
3283 [ $archive_type = xpv ]; then
3284 DBOOT_TMPDIR=/tmp/dboot.$$
3285 trap "rm -rf $DBOOT_TMPDIR" EXIT
3286 OLD_PWD=$(pwd)
3287 rm -rf $DBOOT_TMPDIR
3288 mkdir $DBOOT_TMPDIR
3289 cd $DBOOT_TMPDIR
3290 $ZCAT $cpiodir/${archive}$ZFIX | \
3291 cpio -id "$cmd" 2>/dev/null
3292 if [ -x $cmd ]; then
3293 cp $cmd /tmp/bfubin/
3294 have_new_bootadm=yes
3296 cd $OLD_PWD
3297 rm -rf $DBOOT_TMPDIR
3298 trap - EXIT
3303 # If all else fails, grab the local version
3305 if [ ! -x /tmp/bfubin/$file ]; then
3306 [ -x /$cmd ] && cp /$cmd /tmp/bfubin
3308 done
3309 if [ $archive_type = directboot ] && [ $root_is_directboot = yes ]; then
3310 cleanup_eeprom_console
3314 multiboot_cmds="
3315 /sbin/biosdev
3316 /sbin/installgrub
3318 copying_mboot_cmds=no
3319 if [ $multi_or_direct = yes ]; then
3320 for cmd in $multiboot_cmds
3322 file=`basename $cmd`
3323 if [ -f $cmd ]; then
3324 cp $cmd /tmp/bfubin
3325 elif [ -n "$DIRECTBOOT_BIN_DIR" ] &&
3326 [ -d $DIRECTBOOT_BIN_DIR ] &&
3327 [ -x $DIRECTBOOT_BIN_DIR/$file ]; then
3328 cp $DIRECTBOOT_BIN_DIR/$file /tmp/bfubin/
3329 else
3330 if [ ! -d $MULTIBOOT_BIN_DIR ]; then
3331 echo "$MULTIBOOT_BIN_DIR: not found"
3332 elif [ ! -f $MULTIBOOT_BIN_DIR/$file ]; then
3333 echo "$MULTIBOOT_BIN_DIR/$file: not found"
3335 if [ $copying_mboot_cmds = no ]; then
3336 echo "installing files from $MULTIBOOT_BIN_DIR"
3337 copying_mboot_cmds=yes
3339 cp $MULTIBOOT_BIN_DIR/$file /tmp/bfubin
3342 done
3346 # If available, use ldd to determine which libraries bfu depends on.
3347 # Otherwise, just make an educated guess.
3349 if [ -x /usr/bin/ldd ]; then
3350 bfulib="`ldd /tmp/bfubin/* | nawk '$3 ~ /lib/ { print $3 }' | sort -u`"
3351 else
3352 bfulib="
3353 /lib/libc.so.1
3354 /lib/libm.so.2
3355 /lib/libdoor.so.1
3356 /lib/libm.so.2
3357 /lib/libmd.so.1
3358 /lib/libmd5.so.1
3359 /lib/libnvpair.so.1
3360 /lib/libscf.so.1
3361 /lib/libuutil.so.1
3362 /usr/lib/libbsm.so.1
3363 /usr/lib/libc2.so
3364 /usr/lib/libdl.so.1
3365 /usr/lib/libelf.so.1
3366 /usr/lib/libkstat.so.1
3367 /usr/lib/libmapmalloc.so.1
3368 /usr/lib/libmp.so.1
3369 /usr/lib/libnsl.so.1
3370 /usr/lib/libpam.so.1
3371 /usr/lib/libsec.so.1
3372 /usr/lib/libsocket.so.1
3373 /usr/lib/libtecla.so.1
3377 # add dlopen()'ed stuff
3378 bfulib="
3379 $bfulib
3380 /lib/ld.so.1
3381 /usr/lib/nss_*
3384 # add svccfg dtd rules
3385 bfulib="
3386 $bfulib
3387 /usr/share/lib/xml/dtd/service_bundle.dtd.1
3390 BFUSVCCFG="SVCCFG_DTD=/tmp/bfulib/service_bundle.dtd.1 /tmp/bfubin/svccfg"
3392 # add libc_psr.so.1, if available and not empty
3393 if [ -s /platform/`uname -i`/lib/libc_psr.so.1 ]; then
3394 bfulib="
3395 $bfulib
3396 /platform/`uname -i`/lib/libc_psr.so.1
3400 rm -rf /tmp/bfulib /tmp/bl
3401 mkdir /tmp/bfulib /tmp/bl
3404 # Create 64 bit directory structure and determine 64 bit arch name.
3406 if [ -h /usr/lib/64 ]
3407 then
3408 link=`ls -dl /usr/lib/64 | awk '{print $NF}'`
3409 ln -s $link /tmp/bfulib/64
3410 ln -s $link /tmp/bl/64
3411 mkdir /tmp/bfulib/$link /tmp/bl/$link
3412 bfulib="$bfulib /usr/lib/64/nss_*"
3414 # Copy libraries to proper directories
3416 for lib in $bfulib
3418 case $lib in
3419 */64/* | */$link/*)
3420 cp $lib /tmp/bfulib/64;;
3422 cp $lib /tmp/bfulib;;
3423 esac
3424 done
3426 # Private 64 bit runtime linker.
3428 cp /lib/64/ld.so.1 /tmp/bfulib/64/bf.1
3429 cp /lib/64/ld.so.1 /tmp/bl/64/bf.1
3430 else
3431 cp $bfulib /tmp/bfulib
3433 cp /lib/ld.so.1 /tmp/bfulib/bf.1 # bfu's private runtime linker
3434 cp /lib/ld.so.1 /tmp/bl/bf.1
3436 ${BFULD-$GATE/public/bin/$bfu_isa/bfuld} /tmp/bfubin/* || fail "bfuld failed"
3438 for x in $bfuscr
3440 sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \
3441 -e 's/\/bin\//\/tmp\/bfubin\//g' < $x > /tmp/bfubin/`basename $x`
3442 chmod +x /tmp/bfubin/`basename $x`
3443 done
3446 # scripts used together with multiboot
3448 if [ $target_isa = sparc -a $diskless = no ] ; then
3449 multiboot_scr="
3450 /boot/solaris/bin/create_ramdisk
3452 else
3453 multiboot_scr="
3454 /boot/solaris/bin/create_ramdisk
3455 /boot/solaris/bin/create_diskmap
3456 /boot/solaris/bin/root_archive
3460 for cmd in $multiboot_scr
3462 file=`basename $cmd`
3463 if [ -f $cmd ]; then
3464 cp $cmd /tmp/bfubin
3465 else
3466 if [ ! -d $MULTIBOOT_BIN_DIR ]; then
3467 echo "$MULTIBOOT_BIN_DIR: not found"
3468 fail ""
3471 if [ ! -f $MULTIBOOT_BIN_DIR/$file ]; then
3472 echo "$MULTIBOOT_BIN_DIR/$file: not found"
3473 fail ""
3475 echo "copying $file from $MULTIBOOT_BIN_DIR"
3476 cp $MULTIBOOT_BIN_DIR/$file /tmp/bfubin
3480 # These files need special editing to be used
3481 # inside the bfu protected environment.
3483 mv /tmp/bfubin/${file} /tmp/bfubin/${file}-
3484 sed -e 's/boot\/solaris\/bin/BOOT_SOLARIS_BIN/g' \
3485 -e 's/usr\/sbin\/install/USR_SBIN_INSTALL/g' \
3486 -e 's/usr\/openwin\/bin/USR_OPENWIN_BIN/g' \
3487 -e 's/ usr\/bin\// USR_BIN/g' \
3488 -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \
3489 -e 's/\/usr\/sbin\//\/tmp\/bfubin\//g' \
3490 -e 's/\/bin\//\/tmp\/bfubin\//g' \
3491 -e 's/\/sbin\//\/tmp\/bfubin\//g' \
3492 -e 's/ USR_BIN/ usr\/bin\//g' \
3493 -e 's/USR_OPENWIN_BIN/usr\/openwin\/bin/g' \
3494 -e 's/USR_SBIN_INSTALL/usr\/sbin\/install/g' \
3495 -e 's/BOOT_SOLARIS_BIN/boot\/solaris\/bin/g' \
3496 -e 's/\$(\$EXTRACT_FILELIST/\$(ksh \$EXTRACT_FILELIST/' \
3497 < /tmp/bfubin/${file}- > /tmp/bfubin/${file}
3498 chmod +x /tmp/bfubin/${file}
3499 rm /tmp/bfubin/${file}-
3500 done
3503 # For directboot archives, /boot/platform/i86pc/kernel/unix will be
3504 # overwritten, which could cause a mis-match with the failsafe
3505 # miniroot. Extract unix from the miniroot and save it off for now.
3507 if [ $archive_type = directboot ] && [ $diskless = no ]; then
3508 if gunzip -c "$root/boot/x86.miniroot-safe" \
3509 >/tmp/bfubin/miniroot-unzipped; then
3510 lofifile=/tmp/bfubin/miniroot-unzipped
3511 else
3512 # Shouldn't happen? See if someone already unzipped it.
3513 lofifile="$root/boot/x86.miniroot-safe"
3515 lofidev=`lofiadm -a $lofifile 2>/dev/null`
3516 if [ -n "$lofidev" ]; then
3517 mkdir /tmp/bfubin/mnt
3518 mount -r $lofidev /tmp/bfubin/mnt
3520 unix=/tmp/bfubin/mnt/boot/platform/i86pc/kernel/unix
3521 if [ -f $unix ]; then
3522 cp $unix /tmp/bfubin/unix
3523 failsafe_type=directboot
3524 elif [ -f /tmp/bfubin/mnt/platform/i86pc/multiboot ]
3525 then
3526 failsafe_type=multiboot
3529 umount /tmp/bfubin/mnt
3530 rmdir /tmp/bfubin/mnt
3531 lofiadm -d $lofidev
3533 rm -f /tmp/bfubin/miniroot-unzipped
3536 revert_aggregation_conf()
3538 aggrconf=$rootprefix/etc/aggregation.conf
3539 nawk '
3540 /^[ \t]*#/ || /^[ \t]*$/ || $4 ~ "/0" {
3541 print;
3542 next;
3546 OFS="\t";
3547 gsub(/[^,]*/, "&/0", $4);
3548 print;
3549 }' $aggrconf > $aggrconf.bfutmp
3550 mv -f $aggrconf.bfutmp $aggrconf
3553 remove_initd_links()
3555 # If we're delivering a new version of an existing /etc/init.d script,
3556 # remove all hard links to the existing file in /etc/rc?.d whose
3557 # names begin with [SK][0-9][0-9]. Additionally, in case an S or K
3558 # file was previously delivered as a symbolic link or the hard link
3559 # was broken, remove any file in /etc/rc?.d whose name is
3560 # [SK][0-9][0-9] followed by the basename of the file we're going
3561 # to update in /etc/init.d.
3563 print "Removing init.d links ... \c"
3564 scripts=`$ZCAT $cpiodir/generic.root$ZFIX |
3565 cpio -it 2>/dev/null | grep '^etc/init\.d/'`
3566 if [ -n "$scripts" ]; then
3567 inodes=`ls -li $scripts 2>/dev/null | \
3568 nawk '{ print "-inum " $1 " -o " }'`
3569 names=`ls -1 $scripts 2>/dev/null | \
3570 nawk -F/ '{ print "-name [SK][0-9][0-9]" $NF }'`
3571 find etc/rc?.d \( $inodes $names \) -print | xargs rm -f
3573 print "done."
3577 # Remove Wildcat (aka Sun Fire Link)
3579 remove_eof_wildcat()
3581 # Packages to remove
3582 typeset -r wildcat_pkgs='SUNWwrsa SUNWwrsd SUNWwrsu SUNWwrsm'
3583 typeset pkg
3586 # First, attempt to remove the packages cleanly if possible.
3587 # Use a custom "admin" file to specify that removal scripts
3588 # in the packages being removed should be run even if they
3589 # will run as root.
3591 typeset -r admfile='/tmp/wcat_eof.$$'
3592 echo "action=nocheck" > $admfile
3594 printf 'Removing Wildcat packages...'
3595 for pkg in $wildcat_pkgs
3597 if pkginfo $pkgroot -q $pkg; then
3598 printf ' %s' $pkg
3599 pkgrm $pkgroot -n -a $admfile $pkg >/dev/null 2>&1
3601 done
3602 printf '\n'
3605 # In case that didn't work, do it manually.
3607 printf 'Removing Wildcat from %s/var/sadm/install/contents...' \
3608 $rootprefix
3609 for pkg in $wildcat_pkgs
3611 printf ' %s' $pkg
3612 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3613 rm -rf $rootprefix/var/sadm/pkg/$pkg
3614 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3615 /tmp/contents.$$
3616 cp /tmp/contents.$$ \
3617 $rootprefix/var/sadm/install/contents
3618 rm /tmp/contents.$$
3620 done
3621 printf '\n'
3624 # Cleanup any remaining Wildcat files, symlinks, and directories.
3626 rm -f $usr/platform/sun4u/include/sys/wci_common.h
3627 rm -f $usr/platform/sun4u/include/sys/wci_regs.h
3628 rm -f $usr/platform/sun4u/include/sys/wci_offsets.h
3629 rm -f $usr/platform/sun4u/include/sys/wci_cmmu.h
3630 rm -f $usr/platform/sun4u/include/sys/wrsm.h
3631 rm -f $usr/platform/sun4u/include/sys/wrsm_common.h
3632 rm -f $usr/platform/sun4u/include/sys/wrsm_config.h
3633 rm -f $usr/platform/sun4u/include/sys/wrsm_types.h
3634 rm -f $usr/platform/sun4u/include/sys/wrsm_plat.h
3635 rm -f $usr/platform/sun4u/include/sys/wrsm_plugin.h
3636 rm -f $usr/platform/sun4u/include/sys/wrsmconf.h
3638 rm -f $usr/platform/sun4u/lib/mdb/kvm/sparcv9/wrsm.so
3639 rm -f $usr/platform/sun4u/lib/mdb/kvm/sparcv9/wrsmd.so
3641 rm -f $rootprefix/platform/SUNW,Sun-Fire-15000/kernel/misc/sparcv9/gptwo_wci
3643 rm -f $rootprefix/platform/sun4u/kernel/kmdb/sparcv9/wrsm
3644 rm -f $rootprefix/platform/sun4u/kernel/kmdb/sparcv9/wrsmd
3646 rm -f $admfile
3650 # Remove ASET
3652 remove_eof_aset()
3654 # Packages to remove
3655 typeset -r aset_pkgs='SUNWast'
3656 typeset pkg
3658 printf 'Removing ASET... '
3661 # First, attempt to remove the packages cleanly if possible.
3663 for pkg in $aset_pkgs
3665 if pkginfo $pkgroot -q $pkg; then
3666 printf ' %s' $pkg
3667 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
3669 done
3670 printf '\n'
3673 # In case that didn't work, do it manually.
3674 # Remove ASET from $rootprefix/var/sadm/install/contents
3676 for pkg in $aset_pkgs
3678 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3679 rm -rf $rootprefix/var/sadm/pkg/$pkg
3680 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3681 /tmp/contents.$$
3682 cp /tmp/contents.$$ $rootprefix/var/sadm/install/contents.$$
3683 rm /tmp/contents.$$
3685 done
3688 # Cleanup any remaining ASET files, symlinks, and directories.
3690 rm -rf $usr/aset
3694 # Remove BIND 8 named server/tools packages
3696 remove_eof_bind8()
3698 # Packages to remove
3699 typeset -r bind8_pkg='SUNWinamd'
3700 typeset pkg
3702 printf 'Removing BIND 8 named server/tools... '
3705 # We cann't pkgrm SUNWinamd at this time as the BIND 9 binaries are
3706 # already in /usr/sbin.
3707 # Remove BIND 8 packages from $rootprefix/var/sadm/install/contents
3709 for pkg in $bind8_pkgs
3711 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3712 rm -rf $rootprefix/var/sadm/pkg/$pkg
3713 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3714 /tmp/contents.$$
3715 cp /tmp/contents.$$ /var/sadm/install/contents.$$
3716 rm /tmp/contents.$$
3718 done
3721 # Cleanup any BIND 8 specific files, symlinks.
3724 # files and symlinks.
3725 rm -f $usr/sbin/named-xfer
3726 rm -f $usr/lib/nslookup.help
3727 rm -f $usr/sbin/dnskeygen
3728 rm -f $usr/sbin/named-bootconf
3729 rm -f $usr/sbin/nstest
3730 rm -rf $rootprefix/var/run/ndc.d
3731 printf 'done.\n'
3735 # Remove the 5.6.1 version of perl.
3737 remove_perl_561()
3741 # Packages to remove.
3743 typeset -r perl_pkgs='SUNWpl5m SUNWpl5p SUNWpl5u SUNWpl5v'
3746 # First, attempt to remove the packages cleanly if possible.
3748 typeset pkg
3749 printf 'Removing perl 5.6.1 packages'
3750 for pkg in $perl_pkgs
3752 if pkginfo $pkgroot -q $pkg; then
3753 printf ' %s' $pkg
3754 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
3756 done
3757 printf '\n'
3760 # In case that didn't work, do it manually.
3762 printf 'Removing perl 5.6.1 from %s/var/sadm/install/contents' \
3763 $rootprefix
3764 for pkg in $PKGS
3766 printf ' %s' $pkg
3767 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3768 rm -rf $rootprefix/var/sadm/pkg/$pkg
3769 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3770 /tmp/contents.$$
3771 cp /tmp/contents.$$ /var/sadm/install/contents.$$
3772 rm /tmp/contents.$$
3774 done
3775 printf '\n'
3778 # Remove any remaining 5.6.1 files,
3780 printf 'Removing perl 5.6.1 from %s/perl5\n' $usr
3782 # Directories.
3783 rm -rf $usr/perl5/5.6.1
3784 rm -rf $usr/perl5/site_perl/5.6.1
3785 rm -rf $usr/perl5/vendor_perl/5.6.1
3788 # Remove FNS/XFN packages
3790 remove_eof_fns()
3792 # Packages to remove
3793 typeset -r fns_pkgs='SUNWfnx5x SUNWfnsx5 SUNWfnsx SUNWfns'
3794 typeset pkg
3796 printf 'Removing FNS/XFN ... '
3799 # First, attempt to remove the packages cleanly if possible.
3801 for pkg in $fns_pkgs
3803 if pkginfo $pkgroot -q $pkg; then
3804 printf ' %s' $pkg
3805 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
3807 done
3808 printf '\n'
3811 # In case that didn't work, do it manually.
3812 # Remove FNS/XFN from $rootprefix/var/sadm/install/contents
3814 for pkg in $fns_pkgs
3816 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3817 rm -rf $rootprefix/var/sadm/pkg/$pkg
3818 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3819 /tmp/contents.$$
3820 cp /tmp/contents.$$ $rootprefix/var/sadm/install/contents.$$
3821 rm /tmp/contents.$$
3823 done
3826 # Cleanup if any remaining FNS/XFN files, symlinks, and directories.
3829 # directories.
3830 rm -rf $rootprefix/etc/fn
3831 rm -rf $usr/include/xfn
3832 rm -rf $usr/lib/fn
3833 rm -rf $rootprefix/var/fn
3835 # files and symlinks.
3836 rm -f $rootprefix/etc/fn.conf
3837 rm -f $usr/bin/fnattr
3838 rm -f $usr/bin/fnbind
3839 rm -f $usr/bin/fncreate_printer
3840 rm -f $usr/bin/fnlist
3841 rm -f $usr/bin/fnlookup
3842 rm -f $usr/bin/fnrename
3843 rm -f $usr/bin/fnsearch
3844 rm -f $usr/bin/fnunbind
3845 rm -f $usr/sbin/fncheck
3846 rm -f $usr/sbin/fncopy
3847 rm -f $usr/sbin/fncreate
3848 rm -f $usr/sbin/fncreate_fs
3849 rm -f $usr/sbin/fndestroy
3850 rm -f $usr/sbin/fnselect
3851 rm -f $usr/sbin/fnsypd
3852 rm -f $usr/lib/libfn_p.so
3853 rm -f $usr/lib/libfn_p.so.1
3854 rm -f $usr/lib/libfn_spf.so
3855 rm -f $usr/lib/libfn_spf.so.1
3856 rm -f $usr/lib/libxfn.so
3857 rm -f $usr/lib/libxfn.so.1
3858 rm -f $usr/lib/libxfn.so.2
3859 rm -f $usr/lib/sparcv9/libfn_p.so
3860 rm -f $usr/lib/sparcv9/libfn_p.so.1
3861 rm -f $usr/lib/sparcv9/libfn_spf.so
3862 rm -f $usr/lib/sparcv9/libfn_spf.so.1
3863 rm -f $usr/lib/sparcv9/libxfn.so
3864 rm -f $usr/lib/sparcv9/libxfn.so.1
3865 rm -f $usr/lib/sparcv9/libxfn.so.2
3868 remove_eof_face() {
3869 # Packages to remove
3870 typeset -r face_pkgs='SUNWfac'
3871 typeset pkg
3873 printf 'Removing AT&T FACE... '
3876 # First, attempt to remove the packages cleanly if possible.
3878 for pkg in $face_pkgs
3880 if pkginfo $pkgroot -q $pkg; then
3881 printf ' %s' $pkg
3882 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
3884 done
3885 printf '\n'
3888 # In case that didn't work, do it manually.
3889 # Remove FACE from $rootprefix/var/sadm/install/contents
3891 for pkg in $face_pkgs
3893 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3894 rm -rf $rootprefix/var/sadm/pkg/$pkg
3895 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3896 /tmp/contents.$$
3897 cp /tmp/contents.$$ $rootprefix/var/sadm/install/contents.$$
3898 rm /tmp/contents.$$
3900 done
3903 # Cleanup any remaining FACE files, symlinks, and directories.
3905 rm -rf $usr/oasys
3906 rm -rf $usr/vmsys
3909 remove_eof_dmi() {
3910 # Packages to remove
3911 typeset -r dmi_pkgs='SUNWsadmi'
3912 typeset pkg
3914 printf 'Removing DMI... '
3917 # First, attempt to remove the packages cleanly if possible.
3919 for pkg in $dmi_pkgs
3921 if pkginfo $pkgroot -q $pkg; then
3922 printf ' %s' $pkg
3923 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
3925 done
3926 printf '\n'
3929 # In case that didn't work, do it manually.
3930 # Remove DMI from $rootprefix/var/sadm/install/contents
3932 for pkg in $dmi_pkgs
3934 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
3935 rm -rf $rootprefix/var/sadm/pkg/$pkg
3936 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
3937 /tmp/contents.$$
3938 cp /tmp/contents.$$ $rootprefix/var/sadm/install/contents.$$
3939 rm /tmp/contents.$$
3941 done
3944 # Cleanup any remaining DMI files, symlinks, and directories.
3946 rm -rf $usr/lib/dmi
3947 rm -rf $rootprefix/var/dmi
3948 rm -rf $rootprefix/etc/dmi
3949 rm -f $usr/lib/libdmi.so
3950 rm -f $usr/lib/libdmici.so
3951 rm -f $usr/lib/libdmimi.so
3952 rm -f $usr/lib/libdmi.so.1
3953 rm -f $usr/lib/libdmici.so.1
3954 rm -f $usr/lib/libdmimi.so.1
3955 rm -f $usr/lib/sparcv9/libdmi.so
3956 rm -f $usr/lib/sparcv9/libdmici.so
3957 rm -f $usr/lib/sparcv9/libdmimi.so
3958 rm -f $usr/lib/sparcv9/libdmi.so.1
3959 rm -f $usr/lib/sparcv9/libdmici.so.1
3960 rm -f $usr/lib/sparcv9/libdmimi.so.1
3961 rm -f $usr/lib/amd64/libdmi.so
3962 rm -f $usr/lib/amd64/libdmici.so
3963 rm -f $usr/lib/amd64/libdmimi.so
3964 rm -f $usr/lib/amd64/libdmi.so.1
3965 rm -f $usr/lib/amd64/libdmici.so.1
3966 rm -f $usr/lib/amd64/libdmimi.so.1
3967 rm -f $usr/sbin/dmi_cmd
3968 rm -f $usr/sbin/dmiget
3969 rm -f $rootprefix/etc/init.d/init.dmi
3970 rm -f $rootprefix/etc/rc0.d/K07dmi
3971 rm -f $rootprefix/etc/rc1.d/K07dmi
3972 rm -f $rootprefix/etc/rc2.d/K07dmi
3973 rm -f $rootprefix/etc/rcS.d/K07dmi
3974 rm -f $rootprefix/etc/rc3.d/S77dmi
3978 # Remove vold
3980 remove_eof_vold()
3982 printf 'Removing vold... '
3984 rm -rf $usr/lib/vold
3985 rm -rf $usr/lib/rmmount
3986 rm -f $usr/lib/fs/hsfs/ident_hsfs.so.1
3987 rm -f $usr/lib/fs/pcfs/ident_pcfs.so.1
3988 rm -f $usr/lib/fs/udfs/ident_udfs.so.1
3989 rm -f $usr/lib/fs/ufs/ident_ufs.so.1
3990 rm -f $usr/sbin/vold
3991 rm -f $usr/kernel/drv/vol
3992 rm -f $usr/kernel/drv/amd64/vol
3993 rm -f $usr/kernel/drv/sparcv9/vol
3994 rm -f $usr/include/rmmount.h
3995 rm -f $usr/include/vol.h
3996 rm -f $rootprefix/etc/vold.conf
3997 rm -f $rootprefix/etc/rmmount.conf
3999 printf '\n'
4003 # Remove the obsolete Mobile IP packages
4005 remove_eof_mobileip() {
4006 typeset -r mip_pkgs='SUNWmipr SUNWmipu'
4007 typeset pkg
4009 printf 'Removing Mobile IP... '
4011 for pkg in $mip_pkgs
4013 if pkginfo $pkgroot -q $pkg; then
4014 printf ' %s' $pkg
4015 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
4017 done
4019 # In case that did not work, do it manually.
4020 if [[ -d $rootprefix/var/sadm/pkg/SUNWmipr ]]; then
4021 rm -f "$rootprefix/etc/inet/mipagent.conf-sample"
4022 rm -f "$rootprefix/etc/inet/mipagent.conf.fa-sample"
4023 rm -f "$rootprefix/etc/inet/mipagent.conf.ha-sample"
4024 rm -f "$rootprefix/etc/init.d/mipagent"
4025 rm -f "$rootprefix/etc/rc0.d/K06mipagent"
4026 rm -f "$rootprefix/etc/rc1.d/K06mipagent"
4027 rm -f "$rootprefix/etc/rc2.d/K06mipagent"
4028 rm -f "$rootprefix/etc/rc3.d/S80mipagent"
4029 rm -f "$rootprefix/etc/rcS.d/K06mipagent"
4030 rm -f "$rootprefix/etc/snmp/conf/mipagent.acl"
4031 rm -f "$rootprefix/etc/snmp/conf/mipagent.reg"
4033 if [[ -d $rootprefix/var/sadm/pkg/SUNWmipu ]]; then
4034 rm -f "$rootprefix/usr/lib/inet/mipagent"
4035 rm -f "$rootprefix/usr/sbin/mipagentconfig"
4036 rm -f "$rootprefix/usr/sbin/mipagentstat"
4038 printf '\n'
4042 # Remove EOF Smartcard framework
4044 remove_eof_smartcard()
4046 # Packages to remove
4047 typeset -r smartcard_pkg='SUNWjcom SUNWkib SUNWocf SUNWocfd SUNWocfh
4048 SUNWocfr SUNWpamsc SUNWscmhdlr'
4049 typeset pkg
4051 printf 'Removing EOF Smartcard... '
4053 for pkg in $smartcard_pkgs
4055 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
4056 rm -rf $rootprefix/var/sadm/pkg/$pkg
4057 grep -vw $pkg $rootprefix/var/sadm/install/contents > \
4058 /tmp/contents.$$
4059 cp /tmp/contents.$$ /var/sadm/install/contents.$$
4060 rm /tmp/contents.$$
4062 done
4065 # Remove smartcard headers, libraries, Old readers and the
4066 # parts delivered from other consolidations
4067 # that no longer work with the ON parts removed.
4069 rm -rf $usr/lib/smartcard \
4070 $usr/share/lib/smartcard \
4071 $usr/include/smartcard.h \
4072 $usr/include/smartcard \
4073 $root/etc/smartcard \
4074 $root/platform/sun4u/kernel/drv/sparcv9/scmi2c
4076 printf 'done.\n'
4079 remove_properties() {
4082 # Remove obsolete smartii setprop from bootenv.rc
4084 srcbootenvrc=$root/boot/solaris/bootenv.rc
4085 tmpbootenvrc=/tmp/tmp.bootenvrc.$$
4087 # Don't touch bootenv.rc unless it contains obsolete property
4088 egrep -s 'target-driver-for-smartii' $srcbootenvrc 2>/dev/null
4089 res=$?
4090 if [ -f $srcbootenvrc -a $res -eq 0 ]; then
4091 egrep -v "target-driver-for-smartii"\
4092 $srcbootenvrc > $tmpbootenvrc 2>/dev/null
4093 cp $tmpbootenvrc $srcbootenvrc
4095 rm -f $tmpbootenvrc
4098 rbac_cleanup()
4100 # This is a copy of the RBAC portions of the SUNWcsr postinstall
4101 # We need to ensure that the RBAC profiles are self-consistent
4102 # as refinements are made that add granularity to the profiles
4104 print "Cleaning up old RBAC profiles... \c"
4105 auth_attr=$rootprefix/etc/security/auth_attr
4106 exec_attr=$rootprefix/etc/security/exec_attr
4108 if [ -f $auth_attr ]; then
4109 sed '/^solaris\.\*/d' $auth_attr > /tmp/a.$$
4110 cp /tmp/a.$$ $auth_attr
4111 rm -f /tmp/a.$$
4114 if [ -f $exec_attr ]; then
4115 sed -e '/^Network Security.*sbin\/ipsec.*/ D' \
4116 -e '/^Network Security.*sbin\/ike.*/ D' \
4117 -e '/^Network Security.*inet\/in\.iked.*/ D' \
4118 -e '/^Network Security.*inet\/cert.*/ D' $exec_attr > /tmp/e.$$
4119 cp /tmp/e.$$ $exec_attr
4120 rm -f /tmp/e.$$
4122 print "\n"
4125 # Remove EOF NIS+
4127 remove_eof_nisplus()
4129 # We don't attempt to remove packages like SUNWnisu, SUNWnisr as they contain
4130 # the binaries and libraries required for NIS and LDAP.
4131 # We do it manually.
4133 print "Removing NIS+ from Solaris... \n"
4135 # directories.
4136 rm -rf $usr/usr/lib/nis
4137 rm -rf $usr/usr/share/lib/locale/com/sun/dhcpmgr/client/SUNWnisplus
4138 rm -rf $root/var/nis
4140 # files and symlinks.
4141 rm -f $root/etc/default/rpc.nisd
4142 rm -f $root/etc/nsswitch.nisplus
4143 rm -f $root/lib/nss_nisplus.so.1
4144 rm -f $root/lib/svc/method/nisplus
4145 rm -f $root/lib/sparcv9/nss_nisplus.so.1
4146 rm -f $root/lib/amd64/nss_nisplus.so.1
4147 rm -f $root/var/svc/profile/ns_nisplus.xml
4148 rm -f $root/var/svc/manifest/network/rpc/nisplus.xml
4149 rm -f $usr/bin/nisaddcred
4150 rm -f $usr/bin/niscat
4151 rm -f $usr/bin/nischgrp
4152 rm -f $usr/bin/nischmod
4153 rm -f $usr/bin/nischown
4154 rm -f $usr/bin/nischttl
4155 rm -f $usr/bin/nisdefaults
4156 rm -f $usr/bin/niserror
4157 rm -f $usr/bin/nisgrep
4158 rm -f $usr/bin/nisgrpadm
4159 rm -f $usr/bin/nisln
4160 rm -f $usr/bin/nisls
4161 rm -f $usr/bin/nismatch
4162 rm -f $usr/bin/nismkdir
4163 rm -f $usr/bin/nispasswd
4164 rm -f $usr/bin/nispath
4165 rm -f $usr/bin/nisprefadm
4166 rm -f $usr/bin/nisrm
4167 rm -f $usr/bin/nisrmdir
4168 rm -f $usr/bin/nistbladm
4169 rm -f $usr/bin/nistest
4170 rm -f $usr/include/rpcsvc/nis_tags.h
4171 rm -f $usr/include/rpcsvc/nis_cache.h
4172 rm -f $usr/include/rpcsvc/nis_cache.x
4173 rm -f $usr/include/rpcsvc/nispasswd.h
4174 rm -f $usr/include/rpcsvc/nispasswd.x
4175 rm -f $usr/include/rpcsvc/nis_callback.h
4176 rm -f $usr/include/rpcsvc/nis_callback.x
4177 rm -f $usr/lib/amd64/nss_nisplus.so.1
4178 rm -f $usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.0
4179 rm -f $usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.1
4180 rm -f $usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so
4181 rm -f $usr/lib/nscd_nischeck
4182 rm -f $usr/lib/nss_nisplus.so.1
4183 rm -f $usr/lib/sparcv9/nss_nisplus.so.1
4184 rm -f $usr/sadm/admin/dhcpmgr/SUNWnisplus.jar
4185 rm -f $usr/sbin/nis_cachemgr
4186 rm -f $usr/sbin/nisbackup
4187 rm -f $usr/sbin/nisinit
4188 rm -f $usr/sbin/nisldapmaptest
4189 rm -f $usr/sbin/nislog
4190 rm -f $usr/sbin/nisrestore
4191 rm -f $usr/sbin/rpc.nisd
4192 rm -f $usr/sbin/rpc.nisd_resolv
4193 rm -f $usr/sbin/rpc.nispasswdd
4194 rm -f $usr/share/lib/locale/com/sun/dhcpmgr/client/SUNWnisplus/ResourceBundle.properties
4197 crypto_cleanup()
4199 # This function will remove no longer needed cryptography
4200 # related packages.
4202 print "SUNWcry, SUNWcryr, SUNWn2cpact.v removal cleanup...\n"
4204 # This clean up of ipsecalgs is not directly related to the EOF
4205 # of SUNWcry and SUWNcryr, but due to mistakes in this file seen
4206 # in earlier builds. The following lines will have no effect on
4207 # most machines.
4209 ipsecalgs=$rootprefix/etc/inet/ipsecalgs
4211 cp $ipsecalgs ${ipsecalgs}.tmp
4213 sed -e 's/_CBC|128\/32-128,8/_CBC|128\/32-448,8/' \
4214 -e 's/AES_CBC|128|/AES_CBC|128\/128-256,64|/' \
4215 $ipsecalgs > ${ipsecalgs}.tmp
4217 mv -f ${ipsecalgs}.tmp $ipsecalgs
4219 # Packages to remove.
4220 typeset -r crypt_pkgs='SUNWcry SUNWcryr SUNWn2cpact.v'
4221 typeset pkg
4224 # First, attempt to remove the packages cleanly if possible.
4225 # Use a custom "admin" file to specify that removal scripts
4226 # in the packages being removed should be run even if they
4227 # will run as root.
4229 typeset -r admfile='/tmp/crypt_eof.$$'
4230 cat > $admfile <<- EOF
4231 mail=
4232 instance=overwrite
4233 partial=nocheck
4234 runlevel=nocheck
4235 idepend=nocheck
4236 rdepend=nocheck
4237 space=nocheck
4238 setuid=nocheck
4239 conflict=nocheck
4240 action=nocheck
4241 basedir=default
4244 printf ' Removing packages...'
4245 for pkg in $crypt_pkgs
4247 if pkginfo $pkgroot -q $pkg; then
4248 printf ' %s' $pkg
4249 pkgrm $pkgroot -n -a $admfile $pkg >/dev/null 2>&1
4251 done
4252 printf '\n'
4254 # SUNWcry/SUNWcryr contents go away, if pkgrm didn't take
4255 # care of them.
4256 # The userland modules, kernel modules and OpenSSL filter libs
4257 rm -f $rootprefix/usr/lib/security/pkcs11_softtoken_extra.so.1
4258 rm -f $rootprefix/usr/lib/security/pkcs11_softtoken_extra.so
4259 rm -f $rootprefix/usr/lib/security/sparcv9/pkcs11_softtoken_extra.so.1
4260 rm -f $rootprefix/usr/lib/security/sparcv9/pkcs11_softtoken_extra.so
4261 rm -f $rootprefix/usr/lib/security/amd64/pkcs11_softtoken_extra.so.1
4262 rm -f $rootprefix/usr/lib/security/amd64/pkcs11_softtoken_extra.so
4264 rm -f $rootprefix/kernel/crypto/aes256
4265 rm -f $rootprefix/kernel/crypto/sparcv9/aes256
4266 rm -f $rootprefix/kernel/crypto/amd64/aes256
4267 rm -f $rootprefix/platform/SUNW,A70/kernel/crypto/sparcv9/aes256
4268 rm -f $rootprefix/platform/SUNW,Netra-CP3010/kernel/crypto/sparcv9/aes256
4269 rm -f $rootprefix/platform/SUNW,Netra-T12/kernel/crypto/sparcv9/aes256
4270 rm -f $rootprefix/platform/SUNW,Netra-T4/kernel/crypto/sparcv9/aes256
4271 rm -f $rootprefix/platform/SUNW,SPARC-Enterprise/kernel/crypto/sparcv9/aes256
4272 rm -f $rootprefix/platform/SUNW,Sun-Blade-1000/kernel/crypto/sparcv9/aes256
4273 rm -f $rootprefix/platform/SUNW,Sun-Blade-1500/kernel/crypto/sparcv9/aes256
4274 rm -f $rootprefix/platform/SUNW,Sun-Blade-2500/kernel/crypto/sparcv9/aes256
4275 rm -f $rootprefix/platform/SUNW,Sun-Fire-15000/kernel/crypto/sparcv9/aes256
4276 rm -f $rootprefix/platform/SUNW,Sun-Fire-280R/kernel/crypto/sparcv9/aes256
4277 rm -f $rootprefix/platform/SUNW,Sun-Fire-480R/kernel/crypto/sparcv9/aes256
4278 rm -f $rootprefix/platform/SUNW,Sun-Fire-880/kernel/crypto/sparcv9/aes256
4279 rm -f $rootprefix/platform/SUNW,Sun-Fire-V215/kernel/crypto/sparcv9/aes256
4280 rm -f $rootprefix/platform/SUNW,Sun-Fire-V240/kernel/crypto/sparcv9/aes256
4281 rm -f $rootprefix/platform/SUNW,Sun-Fire-V250/kernel/crypto/sparcv9/aes256
4282 rm -f $rootprefix/platform/SUNW,Sun-Fire-V440/kernel/crypto/sparcv9/aes256
4283 rm -f $rootprefix/platform/SUNW,Sun-Fire-V445/kernel/crypto/sparcv9/aes256
4284 rm -f $rootprefix/platform/SUNW,Sun-Fire/kernel/crypto/sparcv9/aes256
4285 rm -f $rootprefix/platform/sun4u-us3/kernel/crypto/sparcv9/aes256
4286 rm -f $rootprefix/kernel/crypto/arcfour2048
4287 rm -f $rootprefix/kernel/crypto/sparcv9/arcfour2048
4288 rm -f $rootprefix/kernel/crypto/amd64/arcfour2048
4289 rm -f $rootprefix/platform/sun4u/kernel/crypto/sparcv9/arcfour2048
4290 rm -f $rootprefix/kernel/crypto/blowfish448
4291 rm -f $rootprefix/kernel/crypto/sparcv9/blowfish448
4292 rm -f $rootprefix/kernel/crypto/amd64/blowfish448
4293 rm -f $rootprefix/usr/sfw/lib/libssl_extra.so.0.9.8
4294 rm -f $rootprefix/usr/sfw/lib/libcrypto_extra.so.0.9.8
4296 # SUNWn2cpact.v contents go away, if pkgrm didn't take
4297 # care of them
4298 rm -f $rootprefix/platform/sun4v/kernel/drv/sparcv9/n2cp.esa
4300 # Remove old limited use certificates
4301 rm -f $rootprefix/etc/crypto/certs/SUNW_SunOS_5.11_Limited
4302 rm -f $rootprefix/etc/crypto/certs/SUNWosnetCFLimited
4303 rm -f $rootprefix/etc/crypto/certs/SUNWosnetLimited
4305 print "\n"
4309 # Remove old fips-140 entry from kcf.conf if it is found
4311 cleanup_kcf_fips140()
4314 kcfconf=$rootprefix/etc/crypto/kcf.conf
4315 kcfconftmp=/tmp/kcfconf.tmp.$$
4317 if grep '^fips-140:' $kcfconf >/dev/null ; then
4318 grep -v '^fips-140:' $kcfconf > $kcfconftmp
4319 print "Removing obsolete fips-140 entry from kcf.conf"
4320 cp $kcfconftmp $kcfconf
4321 rm -f $kcfconftmp
4326 # Add metaslot configuration to pkcs11.conf if it doesn't already exist
4328 enable_crypto_metaslot()
4330 pkcs11conf=$rootprefix/etc/crypto/pkcs11.conf
4331 egrep '^metaslot' ${pkcs11conf} > /dev/null 2>& 1
4332 if [ $? != 0 ] ; then
4333 print "Adding cryptographic framework's meta slot feature"
4334 cp $pkcs11conf ${pkcs11conf}.tmp
4335 export metaslot_config=\
4336 "metaslot:metaslot_status=enabled;metaslot_auto_key_migrate=enabled;"\
4337 "metaslot_token=Sun Software PKCS#11 softtoken;"\
4338 "metaslot_slot=Sun Crypto Softtoken"
4339 nawk '/^# End SUNWcsr/ \
4340 { print ENVIRON["metaslot_config"] } \
4341 { print } \
4342 ' ${pkcs11conf} > ${pkcs11conf}.tmp
4343 mv -f ${pkcs11conf}.tmp $pkcs11conf
4344 print "\n"
4348 cleanup_kerberos_mechanisms()
4351 # This checks to see if the old 'gl' and 'do' directories
4352 # for the Kerberos GSS-API mechanisms can be deleted.
4353 # If the mechanism exists in /usr/lib/gss, then the old
4354 # subdirs may be deleted.
4356 print "Cleaning up old Kerberos GSS-API mechanisms...\c"
4358 kerneldir=kernel/misc/kgss
4359 kerneldir_sparc=kernel/misc/kgss/sparcv9
4361 newmech=no;
4362 if [ -f $usr/lib/gss/mech_krb5.so.1 ]; then
4364 # There is a mech in the "new" location, so
4365 # the old stuff can be deleted.
4367 if [ -d $usr/lib/gss/gl ]; then
4368 rm -rf $usr/lib/gss/gl
4370 if [ -d $usr/lib/gss/do ]; then
4371 rm -rf $usr/lib/gss/do
4373 newmech=yes;
4375 if [ -f $usr/lib/sparcv9/gss/mech_krb5.so.1 ]; then
4376 if [ -d $usr/lib/sparcv9/gss/gl ]; then
4377 rm -rf $usr/lib/sparcv9/gss/gl
4379 if [ -d $usr/lib/sparcv9/gss/do ]; then
4380 rm -rf $usr/lib/sparcv9/gss/do
4384 # Cleanup kernel mechanisms from default location
4386 if [ -f $rootprefix/$kerneldir/kmech_krb5 ]; then
4387 if [ -f $rootprefix/$kerneldir/gl_kmech_krb5 ]; then
4388 rm -f $rootprefix/$kerneldir/gl_kmech_krb5
4390 if [ -f $rootprefix/$kerneldir/do_kmech_krb5 ]; then
4391 rm -f $rootprefix/$kerneldir/do_kmech_krb5
4395 # For SPARC, cleanup from 2 locations.
4397 # 1. /kernel/misc/kgss/sparcv9
4399 if [ -f $rootprefix/$kerneldir_sparc/kmech_krb5 ]; then
4400 if [ -f $rootprefix/$kerneldir_sparc/gl_kmech_krb5 ]; then
4401 rm -f $rootprefix/$kerneldir_sparc/gl_kmech_krb5
4403 if [ -f $rootprefix/$kerneldir_sparc/do_kmech_krb5 ]; then
4404 rm -f $rootprefix/$kerneldir_sparc/do_kmech_krb5
4408 # 2. /platform/sun4u/kernel/misc/kgss/sparcv9
4410 kerneldir_sparc=platform/$karch/$kerneldir_sparc
4411 if [ -f $rootprefix/$kerneldir_sparc/kmech_krb5 ]; then
4412 if [ -f $rootprefix/$kerneldir_sparc/gl_kmech_krb5 ]; then
4413 rm -f $rootprefix/$kerneldir_sparc/gl_kmech_krb5
4415 if [ -f $rootprefix/$kerneldir_sparc/do_kmech_krb5 ]; then
4416 rm -f $rootprefix/$kerneldir_sparc/do_kmech_krb5
4420 # Make sure the GSS mechanism configuration file is correct
4422 if [ "$newmech" = "yes" ]; then
4423 gssmechconf=$rootprefix/etc/gss/mech
4425 sed -e 's/gl\/mech_krb5\.so/mech_krb5\.so/' \
4426 -e 's/do\/mech_krb5\.so/mech_krb5\.so/' \
4427 -e 's/gl_kmech_krb5/kmech_krb5/' \
4428 -e 's/do_kmech_krb5/kmech_krb5/'\
4429 $gssmechconf > ${gssmechconf}.tmp
4431 if [ $? -eq 0 ]; then
4432 mv -f ${gssmechconf}.tmp $gssmechconf
4433 else
4434 echo "WARNING: update of $gssmechconf failed."
4435 return 1
4438 print "\n"
4441 mpxiodisableno='^[ ]*mpxio-disable[ ]*=[ ]*"no"[ ]*;'
4442 mpxiodisableyes='^[ ]*mpxio-disable[ ]*=[ ]*"yes"[ ]*;'
4444 fix_up_perms()
4447 # fix up audit permissions
4449 chmod 644 $root/etc/security/audit_control
4450 chmod 644 $root/etc/security/audit_user
4453 # fix up /etc/inet config file permissions
4455 INETFILES="hosts networks netmasks protocols services \
4456 inetd.conf ipaddrsel.conf sock2path ipsecalgs"
4457 for file in ${INETFILES}; do
4458 chmod 644 $root/etc/inet/$file
4459 done
4463 # disable mpxio on fp(7D) ports using fp.conf
4465 disable_mpxio_using_fpconf()
4467 conffile=$rootprefix/kernel/drv/fp.conf
4468 test -f $conffile || return
4469 egrep -s "$mpxiodisableyes" $conffile && return
4471 print "To preserve device names, disabled mpxio on fp(7D) ports by"
4473 if egrep -s "$mpxiodisableno" $conffile; then
4474 tmpfile=/tmp/fp.conf.$$
4475 sed "s/$mpxiodisableno/mpxio-disable=\"yes\";/" $conffile \
4476 > $tmpfile
4477 cp $tmpfile $conffile
4478 rm -f $tmpfile
4479 print "changing the value of mpxio-disable to \"yes\" in" \
4480 "$conffile"
4481 else
4482 echo 'mpxio-disable="yes";' >> $conffile
4483 print "adding mpxio-disable=\"yes\" entry to $conffile"
4488 # enable mpxio in scsi_vhci
4490 enable_mpxio_using_scsivhciconf()
4493 # depending on whether the bfu restored the child's or parent's version
4494 # of scsi_vhci.conf file, we may already have the file with the change
4495 # we need in place. So make the change only if necessary.
4498 conffile=$rootprefix/kernel/drv/scsi_vhci.conf
4499 egrep -s "$mpxiodisableno" $conffile && return
4501 print "To preserve device names, restored your current mpxio" \
4502 "configuration by"
4504 if egrep -s "$mpxiodisableyes" $conffile; then
4505 tmpfile=/tmp/scsi_vhci.conf.$$
4506 sed "s/$mpxiodisableyes/mpxio-disable=\"no\";/" $conffile \
4507 > $tmpfile
4508 cp $tmpfile $conffile
4509 rm -f $tmpfile
4510 print "changing the value of mpxio-disable to \"no\" in" \
4511 "$conffile"
4512 else
4513 echo 'mpxio-disable="no";' >> $conffile
4514 print "adding mpxio-disable=\"no\" entry to $conffile"
4519 # restore the pre-bfu MPxIO on/off setting to the post-bfued configuration
4521 fixup_mpxio()
4523 conffile=$rootprefix/kernel/drv/scsi_vhci.conf
4524 parentconffile=$rootprefix/bfu.parent/kernel/drv/scsi_vhci.conf
4525 childconffile=$rootprefix/bfu.child/kernel/drv/scsi_vhci.conf
4526 ancestorconffile=$rootprefix/bfu.ancestor/kernel/drv/scsi_vhci.conf
4528 # if scsi_vhci.conf doesn't exist return
4529 test -f $conffile || return
4532 # Determine the mpxio setting in the child. If the system was bfued
4533 # before and running with mpxio on by deafult bits, can't rely on the
4534 # mpxio-disable entry in the child's scsi_vhci.conf file as it may
4535 # contain stale left over entries.
4537 mpxio_child=1
4538 if [ -f $ancestorconffile ]; then
4539 if egrep -s "$mpxiodisableyes" $ancestorconffile; then
4541 # prior to the bfu the system was running with
4542 # mpxio off by default bits.
4544 mpxio_child=0
4545 egrep -s "$mpxiodisableno" $childconffile && \
4546 mpxio_child=1
4548 else
4549 egrep -s "$mpxiodisableyes" $childconffile && mpxio_child=0
4552 if egrep -s "$mpxiodisableyes" $parentconffile; then
4553 # these bits require explicit enabling of mpxio at in scsi_vhci
4554 if [ $mpxio_child -eq 1 ]; then
4555 egrep -s "$mpxiodisableyes" \
4556 $rootprefix/kernel/drv/fp.conf || \
4557 enable_mpxio_using_scsivhciconf
4559 else
4561 # these bits have mpxio enabled by default in scsi_vhci.
4562 # if mpxio is disabled in the child, disable mpxio on all
4563 # fp(7D) ports using fp.conf.
4565 [ $mpxio_child -eq 0 ] && disable_mpxio_using_fpconf
4569 fixup_isa_bfu()
4571 aliasfile=$rootprefix/etc/driver_aliases
4572 parentalias=$rootprefix/bfu.parent/etc/driver_aliases
4573 pathtoinst=$rootprefix/etc/path_to_inst
4574 tmppath=/tmp/path_to_inst
4575 isaalias="pciclass,060100"
4577 if [ $target_isa != i386 ]; then
4578 return;
4580 egrep -s "\"\/isa[\"\/]" $pathtoinst && child_pseudo_isa=1
4581 egrep -s "\"$isaalias\"" $parentalias || parent_pseudo_isa=1
4582 if [ "$child_pseudo_isa" != "$parent_pseudo_isa" ]; then
4583 sed -e '/\/isa[\"\/@]/d' <$pathtoinst >$tmppath
4584 mv $tmppath $pathtoinst
4587 # bfu forwards, just return
4588 [[ "$parent_pseudo_isa" != 1 ]] && return
4590 # remove the pciclass,060100 entry for isa when going backwards
4591 egrep -s "\"$isaalias\"" $aliasfile || return
4592 /tmp/bfubin/update_drv -b $root -d -i "$isaalias" isa >/dev/null 2>&1
4596 # Check to see if root in $1 has a mounted boot, and that
4597 # it's mounted at the right place for bfu to handle it.
4599 # Returns 0 (true) if bfu can handle the upgrade; fails if not
4602 boot_is_upgradeable()
4604 ROOT=$1
4605 if [ "$ROOT" = "/" ] ; then ROOT=""; fi
4607 BOOTPARTDEV="$(grep -s -v '^#' ${ROOT}/etc/vfstab | \
4608 grep "[ ]/boot[ ]*pcfs[ ]" | \
4609 awk '{print $1}')"
4611 # find out if, and where, boot is mounted
4613 if [ -n "$BOOTPARTDEV" ] ; then
4614 if [ -n "$ROOT" ] ; then
4616 BOOTMNT=$(mount | grep "$BOOTPARTDEV" | \
4617 awk '{print $1}')
4618 else
4619 BOOTMNT="/boot"
4621 if [ "$BOOTMNT" != ${ROOT}/boot ] ; then
4622 cat << BOOTMOUNTERR
4624 ${ROOT} refers to an x86 boot partition, but it's not mounted
4625 at ${ROOT}/boot.
4627 BOOTMOUNTERR
4628 fail "Mount ${ROOT}s bootpart at ${ROOT}/boot.\n\n"
4632 return 0
4635 # update the realmode boot programs at $1 (root)
4636 # from classic boot psm/stand/bootblks/ufs/i386/installboot.sh
4638 install_boot_i386()
4640 PBOOT=$1
4641 BOOTBLK=$2
4642 DEVICE=$3
4643 if [ ! -f $PBOOT ]; then
4644 echo "$PBOOT: File not found"
4645 return 1
4647 if [ ! -f $BOOTBLK ]; then
4648 echo "$BOOTBLK: File not found"
4649 return 1
4651 if [ ! -c $DEVICE ]; then
4652 echo "$DEVICE: Not a character device"
4653 return 1
4655 if [ ! -w $DEVICE ]; then
4656 echo "$DEVICE: Not writeable"
4657 return 1
4660 # pboot at block 0, label at blocks 1 and 2, bootblk from block 3 on
4661 dd if=$PBOOT of=$DEVICE bs=1b count=1 conv=sync >/dev/null 2>&1
4663 dd if=$BOOTBLK of=$DEVICE bs=1b oseek=3 conv=sync >/dev/null 2>&1
4665 return 0
4668 update_realmode_booters()
4670 ROOT=$1
4672 TMPDIR=/tmp/rmupdate.$$
4673 trap "rm -rf $TMPDIR" EXIT
4675 # go get new versions of boot files into TMPDIR
4677 OLD_PWD=$(pwd)
4678 mkdir $TMPDIR
4679 cd $TMPDIR
4681 # i86pc.boot archive
4682 REQFILES="boot/mdboot boot/strap.com"
4683 $ZCAT $cpiodir/i86pc.boot$ZFIX | cpio -id $REQFILES 2>/dev/null
4684 mv $REQFILES $TMPDIR
4686 # i86pc.usr archive
4687 REQFILES="usr/platform/i86pc/lib/fs/ufs/pboot"
4688 REQFILES="$REQFILES usr/platform/i86pc/lib/fs/ufs/bootblk"
4689 $ZCAT $cpiodir/i86pc.usr$ZFIX | cpio -id $REQFILES 2>/dev/null
4690 mv $REQFILES $TMPDIR
4692 cd $OLD_PWD
4694 grep -s -v '^#' ${ROOT}/etc/vfstab | \
4695 grep "[ ]/boot[ ]*pcfs[ ]" >/dev/null
4697 if [ $? -eq 0 ] ; then
4698 echo 'Updating /boot on x86 boot partition.'
4700 REQFILES="mdboot strap.com"
4701 for f in ${REQFILES}; do
4702 if [ ! -f ${TMPDIR}/$f ]; then
4703 fail "Missing $f, aborting."
4705 done
4707 MDBOOT=${TMPDIR}/mdboot
4708 STRAP=${TMPDIR}/strap.com
4710 LUBIN=/usr/lib/lu
4711 TMP_FDFILE1=${TMPDIR}/fdfile1.$$
4712 LOGFILE=${TMPDIR}/mkfs.log.$$
4713 DDCOPY=${TMPDIR}/.dd_x86_boot_copy
4715 DISKID="$(grep -s -v '^#' ${ROOT}/etc/vfstab | \
4716 grep "[ ]/boot[ ]*pcfs[ ]" |\
4717 awk '{print $1}' | sed -e 's:p0\:boot::g')"
4719 DISKID="$(basename ${DISKID})"
4721 # Obtain the disk table; it will look something like the following:
4723 # * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect
4724 # 130 128 27 28 0 242 9 553 1728 8897472
4726 # Delete all blank lines, and all lines that begin with *,
4727 # leaving only actual fdisk entries that we can scan
4728 # looking for the X86BOOT partition
4730 fdisk -W - /dev/rdsk/${DISKID}p0 | \
4731 grep -v '^*' | grep -v '^$' > ${TMP_FDFILE1}
4733 num=1
4735 while read id act bhead bcyl ehead ecyl rsect numsect
4737 # Ignore entry if not X86 /boot partition
4738 # ID '190' is the X86BOOT partition (see man fdisk(1M))
4740 if [ $id -ne "190" ] ; then
4741 num=$(expr $num + 1)
4742 continue
4745 # Found X86 boot partition - save contents to $DDCOPY
4746 BOOTPART=/dev/rdsk/${DISKID}p${num}
4747 echo "Boot device is <${BOOTPART}>"
4749 ERRMSG="$(dd if=${BOOTPART} of=${DDCOPY} 2>&1)"
4750 if [ $? -ne 0 ] ; then
4751 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4752 fail "Unable to save copy of <${BOOTPART}>."
4755 # mount copy of old /boot partition
4756 LOBOOTDEV=$(lofiadm -a ${DDCOPY} 2>&1)
4757 if [ $? -ne 0 ] ; then
4758 [ -n "${LOBOOTDEV}" ] && echo "${LOBOOTDEV}"
4759 fail "Unable to make lo-device <${DDCOPY}>"
4761 SOURCE_BOOT_DEV="${TMPDIR}/tmpbootdev.$$"
4762 mkdir ${SOURCE_BOOT_DEV}
4763 ERRMSG=$(mount -F pcfs ${LOBOOTDEV} \
4764 ${SOURCE_BOOT_DEV})
4765 if [ $? -ne 0 ] ; then
4766 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4767 fail "Unable to mount lo-device <${LOBOOTDEV}>."
4770 # recreate existing boot partition with updated
4771 # boot files
4773 # umount ${ROOT}'s /boot if mounted
4775 BOOTMOUNTPT=$(mount | grep ${DISKID}p0:boot 2>&1 | \
4776 awk '{print $1;}')
4778 if [ -n "${BOOTMOUNTPT}" ] ; then
4779 echo "unmounting /dev/dsk/${DISKID}p0:boot"
4780 ERRMSG=$(umount \
4781 /dev/dsk/${DISKID}p0:boot 2>&1)
4782 if [ $? -ne 0 ] ; then
4783 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4784 fail "Unable to umount X86 boot device."
4788 echo "Making new pcfs file system on ${DISKID}"
4790 echo y | /usr/lib/fs/pcfs/mkfs -F pcfs \
4791 -o S,s,B=$MDBOOT,b=BOOT,i=$STRAP \
4792 /dev/rdsk/${DISKID}p0:boot >> ${LOGFILE} 2>&1
4793 if [ $? -ne 0 ] ; then
4794 echo "Unable to make pcfs:"
4795 cat ${LOGFILE}
4796 fail ""
4799 echo "Copying x86 boot partition contents back\c"
4800 echo " to new /boot fs."
4802 OLD_PWD=$(pwd)
4804 echo "Remounting freshened /boot partition"
4806 if [ -z "${BOOTMOUNTPT}" ] ; then
4807 # boot ptn wasn't mounted
4808 BOOTMOUNT="/tmp/bootpart"
4809 mkdir ${BOOTMOUNT}
4810 else
4811 BOOTMOUNT=${BOOTMOUNTPT}
4814 ERRMSG=$(mount -F pcfs \
4815 /dev/dsk/${DISKID}p0:boot ${BOOTMOUNT} 2>&1)
4817 if [ $? -ne 0 ] ; then
4818 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4819 fail "Unable to mount X86 boot device."
4822 # copy old /boot contents
4823 cd ${SOURCE_BOOT_DEV}
4824 find . -mount \! -type s -print | \
4825 cpio -pcdum ${BOOTMOUNT} 2>&1 | \
4826 ${LUBIN}/lustripcpioerr
4828 if [ $? -ne 0 ] ; then
4829 fail "Unable to copy boot partition contents."
4832 cd ${OLD_PWD}
4834 # unmount and rm our boot mount, if we created it
4835 if [ -z "${BOOTMOUNTPT}" ] ; then
4836 ERRMSG=$(umount ${BOOTMOUNT} 2>&1)
4837 if [ $? -ne 0 ] ; then
4838 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4839 fail "Unable to umount <$BOOTMOUNT>."
4841 rm -rf ${BOOTMOUNT}
4844 # unmount, un-lofi, and rm SOURCE_BOOT_DEV
4846 ERRMSG=$(umount ${SOURCE_BOOT_DEV} 2>&1)
4847 if [ $? -ne 0 ] ; then
4848 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4849 fail "Cannot umount lo-device <${LOBOOTDEV}>."
4852 ERRMSG=$(lofiadm -d ${DDCOPY} 2>&1)
4853 if [ $? -ne 0 ] ; then
4854 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
4855 fail "Cannot remove lo-device <${LOBOOTDEV}>."
4858 rm -rf ${SOURCE_BOOT_DEV}
4860 done < ${TMP_FDFILE1}
4861 rm ${TMP_FDFILE1} ${LOGFILE} ${DDCOPY}
4863 else
4865 # non boot-partition: use installboot to get pboot and bootblk
4866 echo "Updating /boot on Solaris partition."
4868 if [ -z "${ROOT}" ] ; then SEARCH="/"; else SEARCH="${ROOT}"; fi
4870 ROOTRAWDEV=$(mount | grep "^${SEARCH} on " | \
4871 awk '{print $3}' | sed 's;/dsk;/rdsk;')
4873 if [ -z "${ROOTRAWDEV}" ] ; then
4874 [ -n "${ROOTRAWDEV}" && echo "${ROOTRAWDEV}" ]
4875 fail "${SEARCH} must be a mounted filesystem"
4878 echo "Updating Solaris partition ${ROOTRAWDEV} with installboot"
4879 REQFILES="pboot bootblk"
4880 for f in ${REQFILES}; do
4881 if [ ! -f ${TMPDIR}/$f ]; then
4882 fail "Missing $f, aborting."
4884 done
4885 PBOOT=${TMPDIR}/pboot
4886 BOOTBLK=${TMPDIR}/bootblk
4887 install_boot_i386 $PBOOT $BOOTBLK ${ROOTRAWDEV}
4888 if [ $? -ne 0 ] ; then
4889 fail "Unable to installboot to <${ROOTRAWDEV}>."
4895 print "Verifying archives ..."
4897 for a in generic $allarchs $rootarchs
4899 test -r $cpiodir/$a.root$ZFIX ||
4900 fail "bfu archive $cpiodir/$a.root$ZFIX missing"
4901 done
4903 if [ ! -r $cpiodir/generic.lib$ZFIX -o ! -r $cpiodir/generic.kernel$ZFIX -o \
4904 ! -r $cpiodir/generic.sbin$ZFIX ]; then
4905 old_style_archives="true"
4906 $ZCAT $cpiodir/generic.root$ZFIX | cpio -it 2>/dev/null | \
4907 egrep -s '^etc/zones' && \
4908 fail "bfu archive $cpiodir/generic.{kernel,lib,sbin}$ZFIX" \
4909 "missing;\npossible mkbfu version mismatch: pre-zones" \
4910 "style archives with zones files."
4913 for a in generic $allarchs $usrarchs
4915 test -r $cpiodir/$a.usr$ZFIX ||
4916 fail "bfu archive $cpiodir/$a.usr$ZFIX missing"
4917 done
4919 for root in $rootlist
4921 cd $root || fail "Cannot cd $root"
4922 prologue=${root%/}/bfu.prologue
4923 if [ -f $prologue ]; then
4924 print "Executing $prologue"
4925 $prologue || fail "$prologue failed with code $?"
4927 done
4929 print "Performing basic sanity checks ..."
4931 for dir in $usr $rootlist
4933 test -d $dir || fail "$dir does not exist"
4934 test -w $dir || fail "$dir is not writable"
4935 cd $dir || fail "Cannot cd $dir"
4936 done
4938 RM_32BIT_KERNEL=0;
4939 if [ "$karch" = "sun4u" ] &&
4940 ($ZCAT $cpiodir/sun4u.root$ZFIX | cpio -itv 2>&1 |
4941 grep "^l.*platform/sun4u/kernel/unix -> sparcv9/unix$" > /dev/null);
4942 then
4943 RM_32BIT_KERNEL=1;
4944 if [ "$force_override" = "no" ] &&
4945 (prtconf -F 2>&1 | egrep '(cgthree|bwtwo)' > /dev/null);
4946 then
4947 print "\n\nERROR: You are upgrading to a 64-bit-only OS. " \
4948 "Your frame buffer does not have a 64-bit driver and " \
4949 "will not work after reboot. To proceed you must run " \
4950 "bfu with the -f flag.";
4951 exit;
4955 if [ $plat = "SUNW,Ultra-1" ] && [ ! -f $cpiodir/SUNW,Ultra-1.root$ZFIX ] &&
4956 [ "$force_override" = "no" ];
4957 then
4958 print "\nERROR: These archives do not have Ultra-1 platform support." \
4959 "\nProceeding with this BFU may render this machine unbootable." \
4960 "\nTo proceed anyway, you must run bfu with the -f flag.\n";
4961 exit;
4964 for root in $rootlist
4966 rootprefix=${root%/}
4967 smf_check_repository
4968 done
4970 MINIMUM_OS_REV=10
4973 # Perform additional sanity checks if we are upgrading the live system.
4975 if [ "$rootlist" = "/" ]
4976 then
4978 # Disallow from older releases
4980 os_rev=`uname -r | sed -e s/5.//`
4981 if [ $os_rev -lt $MINIMUM_OS_REV -a "$force_override" = "no" ]; then
4982 fail "Cannot bfu from pre-Solaris $MINIMUM_OS_REV"
4984 if [ ! -x /usr/sbin/svcadm ]; then
4985 fail "This version of bfu cannot run on pre-Greenline " \
4986 "(s10_64) systems"
4990 # Filesystem space checks
4992 set $root 4 $usr 6
4993 while [ $# -gt 0 ]
4995 test "`df -b $1 | tail -1 | nawk '{ print $2 }'`" -ge ${2}000 ||
4996 fail "Less than $2 MB free on $1 -- bfu not safe."
4997 shift 2
4998 done
5000 # Disable kernel module unloading
5002 print "Disabling kernel module unloading ... \c"
5003 test -x /usr/bin/adb || fail "/usr/bin/adb not found: bfu not safe."
5004 echo "moddebug/W20000" | adb -kw /dev/ksyms /dev/mem | grep moddebug
5006 # Load modules and drivers here not to reload them when you access
5007 # /devices or its subdirectories later.
5009 nawk '$1 !~ /^#|^$/ {print $1}' /etc/name_to_major | \
5010 sed -e 's/#.*$//' | while read driver
5012 modload -p drv/${driver} >/dev/null 2>&1
5013 done
5014 ls $cpiodir >>/dev/null # loads elfexec and networking
5016 # exec/intpexec and sys/kaio are needed by lofi
5017 modload -p exec/intpexec >/dev/null 2>&1
5018 modload -p sys/kaio >/dev/null 2>&1
5020 # umount /lib/libc.so.1 if necessary
5021 if [ -n "`mount | grep '^/lib/libc.so.1'`" ]
5022 then
5023 print "Unmounting /lib/libc.so.1 ..."
5024 umount /lib/libc.so.1
5027 PLAT=`/usr/bin/uname -i`
5028 ARCH=`/usr/bin/uname -m`
5029 # umount /platform/$PLAT/lib/libc_psr.so.1 if necessary
5030 if [ -n "`mount | grep "^/platform/$PLAT/lib/libc_psr.so.1"`" ]
5031 then
5032 print "Unmounting /platform/$PLAT/lib/libc_psr.so.1 ..."
5033 umount /platform/$PLAT/lib/libc_psr.so.1
5034 else
5035 # umount /platform/$ARCH/lib/libc_psr.so.1 if necessary
5036 if [ -n "`mount | grep "^/platform/$ARCH/lib/libc_psr.so.1"`" ]
5037 then
5038 print "Unmounting /platform/$ARCH/lib/libc_psr.so.1 ..."
5039 umount /platform/$ARCH/lib/libc_psr.so.1
5043 # umount /platform/$PLAT/lib/sparcv9/libc_psr.so.1 if necessary
5044 if [ -n "`mount | grep "^/platform/$PLAT/lib/sparcv9/libc_psr.so.1"`" ]
5045 then
5046 print "Unmounting /platform/$PLAT/lib/sparcv9/libc_psr.so.1 ..."
5047 umount /platform/$PLAT/lib/sparcv9/libc_psr.so.1
5048 else
5049 # umount /platform/$ARCH/lib/sparcv9/libc_psr.so.1 if necessary
5050 if [ -n "`mount | grep \
5051 "^/platform/$ARCH/lib/sparcv9/libc_psr.so.1"`" ]
5052 then
5053 print "Unmounting \c"
5054 print "/platform/$ARCH/lib/sparcv9/libc_psr.so.1 ..."
5055 umount /platform/$ARCH/lib/sparcv9/libc_psr.so.1
5059 # umount /platform/sun4u-us3/lib/libc_psr.so.1 if necessary
5060 if [ -n "`mount | grep '^/platform/sun4u-us3/lib/libc_psr.so.1'`" ]
5061 then
5062 print "Unmounting /platform/sun4u-us3/lib/libc_psr.so.1 ..."
5063 umount /platform/sun4u-us3/lib/libc_psr.so.1
5066 # umount /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1 if necessary
5067 if [ -n "`mount | grep '^/platform/sun4u-us3/lib/sparcv9/libc_psr.so.1'`" ]
5068 then
5069 print "Unmounting /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1 ..."
5070 umount /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
5074 # The libpiclsbl.so.1 library has been moved from
5075 # /usr/platform/SUNW,Sun-Fire-T200/lib/... to
5076 # /usr/platform/sun4v/lib/... . Other sun4v platforms create
5077 # symbolic link to T200's libpiclsbl.so.1. Therefore check
5078 # if library is present in T200's directory and then remove
5079 # it and the symbolic links.
5080 if [ -a \
5081 $usr/platform/SUNW,Sun-Fire-T200/lib/picl/plugins/libpiclsbl.so.1 ]
5082 then
5083 print "Removing libpiclsbl.so library ..."
5084 find $usr/platform -name libpiclsbl\* -exec rm {} \;
5087 if [ -x /usr/sbin/zoneadm ]; then
5089 # Stop any running zones: the init script will print a
5090 # message if needed.
5092 if [ -x /etc/init.d/zones ]; then
5093 /etc/init.d/zones stop
5094 elif [ -x /lib/svc/method/svc-zones ]; then
5096 # We need all zones to be down before proceeding.
5097 # We can't accomplish this by just disabling the
5098 # zones service, since it might already be disabled.
5099 # So we pretend to be SMF, and invoke the stop method.
5101 # When zones are someday independently managed as
5102 # service instances, this will need to be revised.
5104 export SMF_FMRI="svc:/system/zones:default"
5105 /lib/svc/method/svc-zones stop
5106 unset SMF_FMRI
5109 [ -z `zoneadm list | grep -v global` ] || \
5110 fail "zone(s) failed to halt"
5112 # Determine the installed zones, which we will want to do
5113 # after we're done with the global zone. This is done now
5114 # rather than later in case bfu'ing the global zone causes
5115 # the zone configuration to become unreadable (e.g., via a
5116 # DTD flag day).
5118 bfu_zone_list=$root/.bfu_zone_list
5119 rm -f $bfu_zone_list
5121 zoneadm list -pi | nawk -F: '{
5122 if ($3 == "installed" &&
5123 ($6 == "native" || $6 == "" || $6 == "sn1")) {
5124 printf "%s %s\n", $2, $4
5126 }' > $bfu_zone_list
5130 # save vlans associated with zones to be upgraded
5131 # to the new dladm based format
5133 flowadm_status="old"
5134 if [[ ! -f $root/sbin/flowadm ]] && \
5135 archive_file_exists generic.sbin "sbin/flowadm"; then
5136 flowadm_status="new"
5138 for iftype in hostname hostname6 dhcp
5140 interface_names="`echo /etc/$iftype.*[0-9] 2>/dev/null`"
5141 if [ "$interface_names" != "/etc/iftype.*[0-9]" ]; then
5142 ORIGIFS="$IFS"
5143 IFS="$IFS."
5144 set -- $interface_names
5145 IFS="$ORIGIFS"
5146 while [ $# -ge 2 ]; do
5147 shift
5148 if [ $# -gt 1 -a \
5149 "$2" != "/etc/$iftype" ]; then
5150 while [ $# -gt 1 -a \
5151 "$1" != "/etc/$iftype" ]; do
5152 shift
5153 done
5154 else
5155 host_ifs="$host_ifs $1"
5156 shift
5158 done
5160 done
5162 zones=`zoneadm list -c | grep -v global`
5163 for zone in $zones
5165 zonecfg -z $zone info ip-type | grep exclusive \
5166 >/dev/null
5167 if [ $? -eq 0 ]; then
5168 zif=`zonecfg -z $zone info net | \
5169 grep physical | nawk '{print $2}'`
5170 zone_ifs="$zone_ifs $zif"
5172 done
5175 # Stop sendmail so that mail doesn't bounce during the interval
5176 # where /etc/mail/aliases is (effectively) empty.
5178 # (note that unlike other services here, /etc/init.d/sendmail
5179 # remains post-smf(5) because it is a public interface.)
5181 if [ -r /etc/svc/volatile/repository_door ]; then
5182 print "Disabling sendmail temporarily ..."
5183 svcadm disable -t network/smtp
5184 else
5185 print "Killing sendmail ..."
5186 /etc/init.d/sendmail stop
5189 print "Disabling remote logins ..."
5190 echo "bfu in progress -- remote logins disabled" >/etc/nologin
5193 # Stop syslogd so it doesn't interfere with saving preserved files.
5195 if [ -f /etc/init.d/syslog ]; then
5196 print "Killing syslogd ..."
5197 /etc/init.d/syslog stop
5198 elif [ -r /etc/svc/volatile/repository_door ]; then
5199 print "Disabling syslog temporarily ..."
5200 svcadm disable -t system/system-log
5204 # Stop apache so it doesn't get upset when the entire world changes
5205 # out from underneath it.
5207 if [ -f /etc/init.d/apache ]; then
5208 print "Killing httpd ..."
5209 /etc/init.d/apache stop
5210 elif [ -r /etc/svc/volatile/repository_door ]; then
5211 print "Disabling httpd temporarily ..."
5212 svcadm disable -t network/http
5216 # Kill off fmd so it doesn't get upset when the entire world changes
5217 # out from underneath it.
5219 if [ -f /etc/init.d/savecore ]; then
5220 print "Killing fmd ..."
5221 pkill -x fmd
5222 elif [ -r /etc/svc/volatile/repository_door ]; then
5223 print "Disabling fmd temporarily ..."
5224 svcadm disable -t system/fmd
5228 # Stop nscd so it doesn't interfere with stuff.
5230 if [ -x /etc/init.d/nscd ]; then
5231 print "Killing nscd ..."
5232 /etc/init.d/nscd stop
5233 elif [ -r /etc/svc/volatile/repository_door ]; then
5234 print "Disabling nscd temporarily ..."
5235 svcadm disable -t system/name-service-cache:default
5238 if grep -v "^#" $rootprefix/etc/vfstab | grep boot | \
5239 grep "[ ]pcfs[ ]" >/dev/null 2>&1
5240 then
5241 boot_is_pcfs=yes
5244 smf_new_profiles
5246 else
5248 # Check ${root}/etc/motd for SunOS value to get `uname -r`
5250 os_rev=`head -1 ${root}/etc/motd | sed -e 's/^.*SunOS //' | \
5251 awk '{print $1}' | sed -e s/5.//`
5252 if [ $os_rev -lt $MINIMUM_OS_REV -a "$force_override" = "no" ]; then
5253 fail "Cannot bfu from pre-Solaris $MINIMUM_OS_REV"
5255 if [ ! -x /usr/sbin/svcadm ]; then
5256 fail "This version of bfu cannot run on pre-Greenline " \
5257 "(s10_64) systems"
5261 export PATH=/tmp/bfubin:$PATH
5262 export LD_LIBRARY_PATH=/tmp/bfulib
5264 if [ -h /tmp/bfulib/64 ]
5265 then
5266 ldlib64="LD_LIBRARY_PATH_64=/tmp/bfulib/64"
5267 export LD_LIBRARY_PATH_64=/tmp/bfulib/64
5270 # turn off auxiliary filters, since they can cause objects to be loaded
5271 # from outside of the protected environment.
5272 export LD_NOAUXFLTR=1
5275 # Since we've turned off auxiliary filters, libc_psr will normally not
5276 # be loaded at all. But libc_psr was overriding broken code in libc
5277 # for over a week before the fix for 6324631, so we need to explicitly
5278 # LD_PRELOAD it to allow users to bfu from the broken libc. This can be
5279 # removed once there are no sun4u machines bfued to Nevada bits between
5280 # 9/7/2005 and 9/15/2005.
5282 if [ -f /tmp/bfulib/libc_psr.so.1 ]; then
5283 export LD_PRELOAD_32=/tmp/bfulib/libc_psr.so.1
5286 print "Turning on delayed i/o ..."
5287 fastfs -f $rootlist $usr
5288 fastfs $rootlist $usr
5291 # The "| tee -a $EXTRACT_LOG" following do_extraction() is not pulled into the
5292 # function itself because it interferes with the cpio exit status detection.
5293 # pcfs boot is an exception, since its cpio exit status is expected to be bad,
5294 # so a heuristic must be employed to infer whether or not any errors occurred.
5296 do_extraction() {
5297 compressed_archive=$1
5298 shift
5299 $ZCAT $compressed_archive | cpio -idmucB $* 2>&1 \
5300 || extraction_error "extracting archive $1"
5303 do_pcfs_boot_extraction() {
5304 PCFS_BOOT_LOG=/tmp/bfu-pcfs-boot-log.$$
5305 $ZCAT $1 | cpio -idmucB 2>&1 | grep -v "error.s" | \
5306 grep -v "cpio: Cannot chown()" | \
5307 grep -v "cpio: Error during chown()" | tee $PCFS_BOOT_LOG
5308 cat $PCFS_BOOT_LOG >> $EXTRACT_LOG
5309 egrep -s -v blocks $PCFS_BOOT_LOG
5310 if [ $? -eq 0 ]; then
5311 extraction_error "extracting archive $1 ... see $PCFS_BOOT_LOG"
5312 else
5313 rm -f $PCFS_BOOT_LOG
5318 # Usage: extract_archives (root|usr|lib|sbin|kernel) arch-list
5320 extract_archives() {
5321 base=$1
5322 shift
5323 test $base = usr && cd $usrroot || cd $root
5324 for archive in $*
5326 print "Extracting $archive.$base$ZFIX ... \c" \
5327 | tee -a $EXTRACT_LOG
5328 test -h platform/$archive && rm platform/$archive
5329 if [ $base = root ]; then
5330 exclude="-f dev/fd home proc etc/mnttab"
5333 # We don't want to overwrite the sharetab if
5334 # it is a mount-point. We assume it is a
5335 # mount-point if it is not writable.
5337 if [ -f etc/dfs/sharetab ]; then
5338 if [ ! -w etc/dfs/sharetab ]; then
5339 exclude="$exclude etc/dfs/sharetab"
5343 [ -d system/contract ] &&
5344 exclude="$exclude system/contract"
5345 [ -d system/object ] &&
5346 exclude="$exclude system/object"
5347 [ -f etc/svc/repository.db ] &&
5348 exclude="$exclude etc/svc/repository.db"
5349 [ -e etc/repository_door ] &&
5350 exclude="$exclude etc/repository_door"
5351 [ -f etc/svc/volatile ] &&
5352 exclude="$exclude etc/svc/volatile"
5353 do_extraction $cpiodir/$archive.$base$ZFIX $exclude |
5354 tee -a $EXTRACT_LOG
5355 elif [ $base = usr ]; then
5356 do_extraction $cpiodir/$archive.$base$ZFIX \
5357 -f "usr/openwin" | tee -a $EXTRACT_LOG
5358 else
5359 do_extraction $cpiodir/$archive.$base$ZFIX \
5360 | tee -a $EXTRACT_LOG
5362 done
5363 cd $root
5366 extract_boot_archives() {
5367 base=$1
5368 shift
5369 cd $root
5370 for archive in $*
5372 if [ ! -f $cpiodir/$archive.$base$ZFIX ]; then
5373 continue
5375 print "Extracting $archive.$base$ZFIX ... \c" \
5376 | tee -a $EXTRACT_LOG
5377 if [ $boot_is_pcfs = yes ]; then
5378 do_pcfs_boot_extraction $cpiodir/$archive.$base$ZFIX
5379 else
5380 do_extraction $cpiodir/$archive.$base$ZFIX | \
5381 tee -a $EXTRACT_LOG
5383 $ZCAT $cpiodir/$archive.$base$ZFIX | cpio -it 2>&1 | \
5384 grep "boot/solaris/devicedb/master" >/dev/null 2>&1
5385 if [ "$?" = "0" ]; then
5386 have_realmode=yes
5388 done
5389 cd $root
5393 # Classic boot pboot and bootblk compatibility with old archives
5395 setup_pboot()
5397 NEWPBOOTDIR=$GATE/public/pboot
5398 NEWPBOOT=${NEWPBOOTDIR}/pboot
5399 NEWBOOTBLK=${NEWPBOOTDIR}/bootblk
5400 PBOOTDIR=$usr/platform/$karch/lib/fs/ufs
5401 PBOOT=${PBOOTDIR}/pboot
5402 BOOTBLK=${PBOOTDIR}/bootblk
5404 # they should already be there, but...
5405 if [ -f $NEWPBOOT -a ! -f $PBOOT ]; then
5406 print "Installing pboot from $NEWPBOOTDIR"
5407 cp $NEWPBOOT $PBOOT
5409 if [ -f $NEWBOOTBLK -a ! -f $BOOTBLK ]; then
5410 print "Installing bootblk from $NEWPBOOTDIR"
5411 cp $NEWBOOTBLK $BOOTBLK
5414 if [ -f $NEWPBOOT -a -f $PBOOT ]; then
5415 LATEST=`ls -Lt $PBOOT $NEWPBOOT | head -1`
5416 if [ "$LATEST" = "$NEWPBOOT" ]; then
5417 print "Updating pboot from $NEWPBOOT"
5418 cp $NEWPBOOT $PBOOT
5421 if [ -f $NEWBOOTBLK -a -f $BOOTBLK ]; then
5422 LATEST=`ls -Lt $BOOTBLK $NEWBOOTBLK | head -1`
5423 if [ "$LATEST" = "$NEWBOOTBLK" ]; then
5424 print "Updating bootblk from $NEWBOOTBLK"
5425 cp $NEWBOOTBLK $BOOTBLK
5429 # This function will never be called when upgrading a zfs root,
5430 # so it's safe to assume a value for rootslice here.
5432 if [[ "$rootslice" = /dev/rdsk/* ]]; then
5433 print "Installing boot block."
5434 ( cd $PBOOTDIR ;
5435 install_boot_i386 ./pboot ./bootblk ${rootslice%??}s2 )
5438 # Since /platform/i86pc/boot/solaris/boot.bin is moved
5439 # to /boot/solaris, remove the old one if it really
5440 # exists.
5442 OLDBOOTDIR=${root}/platform/i86pc/boot/solaris
5443 OLDBOOTBIN=${OLDBOOTDIR}/boot.bin
5444 if [ ! -h ${OLDBOOTDIR} -a -f ${OLDBOOTBIN} ] ;
5445 then
5446 print "Removing old boot.bin."
5447 rm -rf ${OLDBOOTBIN}
5452 # Multiboot support
5455 saved_boot_files="
5456 solaris/bootenv.rc
5457 solaris/devicedb/master
5461 # transition from multiboot to dca
5463 check_multi_to_dca_boot()
5465 bootdev=`grep p0:boot $rootprefix/etc/vfstab | \
5466 grep pcfs | nawk '{print $1}'`
5467 if [ "$bootdev" != "" ]; then
5468 is_pcfs_boot=yes
5471 if [ $is_pcfs_boot = yes ]; then
5472 df -h | grep stubboot >/dev/null 2>&1
5473 if [ $? -eq 0 ]; then
5475 # save configurable files from /boot
5476 # before remounting /stubboot.
5477 # files are relative to /boot.
5478 for file in $saved_boot_files
5480 dir="`dirname $rootprefix/stubboot/$file`"
5481 mkdir -p $dir
5482 cp $rootprefix/boot/$file $dir
5483 done
5485 echo "unmount $bootdev at $rootprefix/stubboot"
5486 ERRMSG=$(umount $bootdev 2>&1)
5487 if [ $? -ne 0 ] ; then
5488 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
5489 fail "Unable to umount $bootdev on $rootprefix/stubboot."
5492 # adjust vfstab
5493 sed -e "s/[ ]\/stubboot[ ]/ \/boot /" \
5494 <$rootprefix/etc/vfstab >$rootprefix/etc/vfstab+
5495 mv $rootprefix/etc/vfstab $rootprefix/etc/vfstab-
5496 mv $rootprefix/etc/vfstab+ $rootprefix/etc/vfstab
5498 ERRMSG=$(mount -F pcfs $bootdev $rootprefix/boot 2>&1)
5499 if [ $? -ne 0 ] ; then
5500 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
5501 fail "Unable to mount $bootdev on $rootprefix/boot."
5507 check_dca_to_multiboot()
5509 bootdev=`grep p0:boot $rootprefix/etc/vfstab | \
5510 grep pcfs | nawk '{print $1}'`
5511 if [ "$bootdev" != "" ]; then
5512 is_pcfs_boot=yes
5514 if [ $system_type != dca ]; then
5515 return
5518 # ensure bootpath is in $rootprefix/boot/solaris/bootenv.rc
5519 # It's ok to put a meta device path in there
5520 bootenvrc=$rootprefix/boot/solaris/bootenv.rc
5521 grep "^setprop[ ]*bootpath[ ]" $bootenvrc > /dev/null
5522 if [ $? != 0 ]; then
5523 rootdev=`grep -v "^#" $rootprefix/etc/vfstab | \
5524 grep "[ ]/[ ]" | nawk '{print $1}'`
5525 bootpath=`ls -l $rootdev | nawk '{ print $NF }' |\
5526 sed "s#../../devices##"`
5527 echo "setprop bootpath '$bootpath'" >> $bootenvrc
5530 rm -f $rootprefix/boot/mdboot
5534 # Figure out the boot architecture of the current system:
5535 # 1. If an i86xpv kernel exists, it's a xpv system
5536 # 2. If dboot_image is in unix, it's a dboot system
5537 # 3. Otherwise, if multiboot is present, it's a multiboot system
5538 # 4. Otherwise, it's a pre-multiboot system
5540 # This is called before we lay down the new archives.
5542 check_system_type()
5544 if [ -f $root/platform/i86xpv/kernel/unix ]; then
5545 system_type=xpv
5546 elif [ -x $root/boot/solaris/bin/symdef ] && \
5547 $root/boot/solaris/bin/symdef $root/platform/i86pc/kernel/unix \
5548 dboot_image; then
5549 system_type=directboot
5550 elif [ -x $root/platform/i86pc/multiboot ]; then
5551 system_type=multiboot
5552 else
5553 system_type=dca
5558 # Detect SVM root and return the list of raw devices under the mirror
5560 get_rootdev_list()
5562 if [ -f $rootprefix/etc/lu/GRUB_slice ]; then
5563 dev=`grep '^PHYS_SLICE' $rootprefix/etc/lu/GRUB_slice |
5564 cut -d= -f2`
5565 if [ "$rootfstype" = "zfs" ]; then
5566 fstyp -a "$dev" | grep 'path: ' | grep -v phys_path: |
5567 cut -d"'" -f2 | sed 's+/dsk/+/rdsk/+'
5568 else
5569 echo "$dev"
5571 return
5572 elif [ "$rootfstype" = "zfs" ]; then
5573 rootpool=`df -k ${rootprefix:-/} | tail +2 | cut -d/ -f1`
5574 rootdevlist=`LC_ALL=C zpool iostat -v "$rootpool" | tail +5 |
5575 egrep -v "mirror|spare|replacing" |
5576 sed -n -e '/--/q' -e p | awk '{print $1}'`
5577 else
5578 metadev=`grep -v "^#" $rootprefix/etc/vfstab | \
5579 grep "[ ]/[ ]" | nawk '{print $2}'`
5580 if [[ $metadev = /dev/rdsk/* ]]; then
5581 rootdevlist=`basename "$metadev"`
5582 elif [[ $metadev = /dev/md/rdsk/* ]]; then
5583 metavol=`basename "$metadev"`
5584 rootdevlist=`metastat -p $metavol |\
5585 grep -v "^$metavol[ ]" | nawk '{print $4}'`
5588 for rootdev in $rootdevlist
5590 echo /dev/rdsk/`basename $rootdev`
5591 done
5595 # Done once per transition from classic (dca) to multi boot
5597 setup_stubboot()
5599 bootdev=`grep -v "^#" $rootprefix/etc/vfstab | grep pcfs | \
5600 grep "[ ]/boot[ ]"`
5601 if [[ -n $bootdev ]] ; then
5603 bootdev=`echo "$bootdev" | nawk '{print $1}'`
5604 rbootdev=`echo "$bootdev" | sed -e "s/dev\/dsk/dev\/rdsk/"`
5606 # Remount boot partition as /stubboot, set up new /boot
5607 mkdir -p $rootprefix/stubboot
5609 ERRMSG=$(umount $bootdev 2>&1)
5610 if [ $? -ne 0 ] ; then
5611 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
5612 fail "Unable to umount $bootdev."
5614 ERRMSG=$(mount -F pcfs $bootdev $rootprefix/stubboot 2>&1)
5615 if [ $? -ne 0 ] ; then
5616 [ -n "${ERRMSG}" ] && echo "${ERRMSG}"
5617 fail "Unable to mount $bootdev on $rootprefix/stubboot."
5620 mkdir -p $rootprefix/boot
5621 cp -r $rootprefix/stubboot/* $rootprefix/boot
5623 # adjust /etc/vfstab
5624 sed <$rootprefix/etc/vfstab \
5625 -e "s/[ ]\/boot[ ]/ \/stubboot /" | \
5626 sed -n >$rootprefix/etc/vfstab+ '
5627 /p0:boot/ {
5628 s/[ ]no/ yes/
5633 mv $rootprefix/etc/vfstab $rootprefix/etc/vfstab-
5634 mv $rootprefix/etc/vfstab+ $rootprefix/etc/vfstab
5639 # multiboot: install grub on the boot slice
5641 install_grub()
5643 STAGE1=$rootprefix/boot/grub/stage1
5644 STAGE2=$rootprefix/boot/grub/stage2
5646 if [ -x $rootprefix/boot/solaris/bin/update_grub ]; then
5647 /tmp/bfubin/ksh $rootprefix/boot/solaris/bin/update_grub \
5648 -R $root
5649 elif [ $is_pcfs_boot = no ]; then
5650 get_rootdev_list | while read rootdev
5652 print "Install grub on $rootdev"
5653 PATH=/tmp/bfubin /tmp/bfubin/installgrub \
5654 $STAGE1 $STAGE2 $rootdev
5655 done
5656 else
5657 # copy /boot grub & solaris to /stubboot
5658 cp -r $rootprefix/boot/grub $rootprefix/stubboot/grub
5659 cp -r $rootprefix/boot/solaris $rootprefix/stubboot/solaris
5661 # Adjust grub paths relative to pcfs filesystem
5662 rm -rf $rootprefix/stubboot/boot
5663 mkdir -p $rootprefix/stubboot/boot
5664 mv $rootprefix/stubboot/grub $rootprefix/stubboot/boot
5665 mv $rootprefix/stubboot/solaris $rootprefix/stubboot/boot
5668 # Run installgrub after copying stubboot to avoid overwriting
5669 # /stubboot/boot/grub/stage2, which must stay untouched.
5671 bootdev=`grep -v "^#" $rootprefix/etc/vfstab | grep pcfs | \
5672 grep "[ ]/stubboot[ ]" | nawk '{print $1}'`
5673 rbootdev=`echo "$bootdev" | sed -e "s/dev\/dsk/dev\/rdsk/"`
5674 if [ "$rbootdev" != "" ]; then
5675 print "Install grub on $rbootdev"
5676 PATH=/tmp/bfubin /tmp/bfubin/installgrub $STAGE1 $STAGE2 $rbootdev
5682 # We check for several possibilites of a bootenv.rc line:
5684 # 1. setprop name 'value'
5685 # 2. setprop name "value"
5686 # 3. setprop name value
5688 parse_bootenv_line()
5690 line=$1
5691 value=`echo $line | grep "'" | cut -d\' -f2`
5692 if [ -z "$value" ]; then
5693 value=`echo $line | grep "\"" | cut -d\" -f2`
5694 if [ -z "$value" ]; then
5695 value=`echo $line | cut -d' ' -f3-`
5698 echo $value
5701 update_bootenv()
5703 bootenvrc=$rootprefix/boot/solaris/bootenv.rc
5704 bootenvrc_updated=0
5706 # Note: the big space below is actually a space and tab
5707 boot_file=`grep '^setprop[ ]\{1,\}boot-file\>' $bootenvrc`
5708 if [ -n "$boot_file" ]; then
5709 file=`parse_bootenv_line "$boot_file"`
5710 if [ -n "$file" ]; then
5711 PATH=/tmp/bfubin /tmp/bfubin/bootadm set-menu kernel="$file"
5712 bootenvrc_updated=1
5716 console=`grep '^setprop[ ]\{1,\}console\>' $bootenvrc`
5717 if [ -z "$console" ]; then
5718 console=`grep '^setprop[ ]\{1,\}input-device\>' \
5719 $bootenvrc`
5721 if [ -n "$console" ]; then
5722 cons=`parse_bootenv_line "$console"`
5724 boot_args=`grep '^setprop[ ]\{1,\}boot-args\>' $bootenvrc`
5725 if [ -n "boot_args" ]; then
5726 args=`parse_bootenv_line "$boot_args"`
5728 if [ -n "$cons" ] && [ -n "$args" ]; then
5729 # If args starts with a -B, remove it and add a comma instead
5730 if echo $args | grep '^-B ' >/dev/null; then
5731 new_args=`echo $args | sed 's/^-B //'`
5732 args_line="-B console=$cons,$new_args"
5733 else
5734 args_line="-B console=$cons $args"
5736 elif [ -n "$cons" ]; then
5737 args_line="-B console=$cons"
5738 elif [ -n "$args" ]; then
5739 args_line="$args"
5740 else
5741 args_line=""
5743 if [ -n "$args_line" ]; then
5744 PATH=/tmp/bfubin /tmp/bfubin/bootadm set-menu args="$args_line"
5745 bootenvrc_updated=1
5748 if [ $bootenvrc_updated = 1 ]; then
5749 egrep -v '^setprop[ ]+(boot-file|boot-args)[ ]' $bootenvrc > ${bootenvrc}.new
5750 [ -s ${bootenvrc}.new ] && mv ${bootenvrc}.new $bootenvrc
5754 get_biosdisk()
5756 rootdev=$1
5757 rootphys=`ls -l $rootdev | nawk '{ print $NF }' | \
5758 sed -e "s/\.\.\/\.\.\/devices//" -e "s/:[abcdefgh],raw//"`
5759 rbootdev=`echo "$rootdev" | sed -e "s/s[0-7]/p0/"`
5762 # Use biosdev to get the bios disk number
5764 biosdisk=`biosdev | grep $rootphys | \
5765 nawk '{print $1}' | sed -e "s/0x8//"`
5769 # multiboot: set up initial grub menu
5771 update_grub_menu()
5773 MENU=$rootprefix/boot/grub/menu.lst
5775 grubhd=$1
5777 if [ $archive_type = multiboot ]; then
5778 BOOT_PROG="kernel /platform/i86pc/multiboot"
5779 BOOT_ARCHIVE="module /platform/i86pc/boot_archive"
5780 else
5782 # directboot archives
5784 BOOT_PROG="kernel\$ /platform/i86pc/kernel/\$ISADIR/unix"
5785 BOOT_ARCHIVE="module\$ /platform/i86pc/\$ISADIR/boot_archive"
5789 # The failsafe archives may be different than the boot archives
5791 if [ -x /boot/platform/i86pc/kernel/unix ]; then
5792 BOOT_FAILSAFE_FILE="/boot/platform/i86pc/kernel/unix"
5793 BOOT_FAILSAFE_SUFFIX=""
5794 else
5795 BOOT_FAILSAFE_FILE="/boot/multiboot"
5796 BOOT_FAILSAFE_SUFFIX="kernel/unix"
5800 # Append some useful entries to the existing menu
5802 echo "Update GRUB menu $MENU with entries for $grubhd"
5804 grep ^default $MENU > /dev/null
5805 [ $? = 0 ] || echo "default=0" >> $MENU
5806 grep ^timeout $MENU > /dev/null
5807 [ $? = 0 ] || echo "timeout=10" >> $MENU
5809 echo "#serial --unit=0 --speed=9600" >> $MENU
5810 echo "#terminal serial" >> $MENU
5811 echo "#splashimage=$grubhd/boot/grub/splash.xpm.gz" >> $MENU
5812 echo "title Solaris" >> $MENU
5813 echo " root $grubhd" >> $MENU
5814 echo " ${BOOT_PROG}" >> $MENU
5815 echo " ${BOOT_ARCHIVE}" >> $MENU
5817 echo "GRUB menu entry 'Solaris' boots to eeprom(1m) settings"
5819 if [ -f ${rootprefix}/$BOOT_FAILSAFE_FILE ] &&
5820 [ -f ${rootprefix}/boot/x86.miniroot-safe ] ; then
5822 TTY=`grep "^setprop input-device" \
5823 ${rootprefix}/boot/solaris/bootenv.rc | cut -f 2 -d \'`
5824 if [ -z "${TTY}" ] ; then
5825 TTY=`grep "^setprop console" \
5826 ${rootprefix}/boot/solaris/bootenv.rc | \
5827 cut -f 2 -d \'`
5830 if [ "${TTY}" = "ttya" ] || [ "${TTY}" = "ttyb" ] ; then
5831 FS_CONSOLE="-B console=${TTY}"
5834 cat >>$MENU <<EOF
5835 title Solaris failsafe
5836 root $grubhd
5837 kernel $BOOT_FAILSAFE_FILE $BOOT_FAILSAFE_SUFFIX $FS_CONSOLE -s
5838 module /boot/x86.miniroot-safe
5843 bootadm_f_flag=""
5845 install_failsafe()
5847 if [ "$root" != "/" ] || \
5848 [ -f /boot/x86.miniroot-safe ] || \
5849 [ ! -x ${GATE}/public/bin/update_failsafe ]; then
5851 # Either we're not bfu'ing /, or the failsafe archives were
5852 # already installed, or update_failsafe is not available.
5853 # If the old failsafe archives were multiboot, clear out the
5854 # directboot kernel.
5856 if [ $failsafe_type = multiboot ]; then
5857 rm -f $rootprefix/boot/platform/i86pc/kernel/unix
5858 elif [ $failsafe_type = directboot ]; then
5859 cp /tmp/bfubin/unix \
5860 $rootprefix/boot/platform/i86pc/kernel/unix
5862 else
5863 echo "Updating failsafe archives"
5864 ${GATE}/public/bin/update_failsafe
5866 # Force bootadm to update the failsafe entry
5867 bootadm_f_flag="-f"
5872 # setup_grub_menu is only called when upgrading from a system
5873 # with a dca boot. This cannot happen on systems with zfs root,
5874 # so this function need not take care of the case where the root
5875 # file system type is zfs
5877 setup_grub_menu()
5879 MENU=$rootprefix/boot/grub/menu.lst
5881 get_rootdev_list | while read rootdev
5883 rootphys=`ls -l $rootdev | nawk '{print $NF}' | \
5884 sed -e "s/\.\.\/\.\.\/devices//"`
5885 gslice=`echo "$rootphys" | cut -f 2 -d : | sed s/,raw//`
5886 rootphys=`echo "$rootphys" | sed -e "s/:[abcdefgh],raw//"`
5887 rbootdev=`echo "$rootdev" | sed -e "s/s[0-7]/p0/"`
5890 # Wallow through fdisk to get the active partition number
5891 # Partition numbering is zero-based
5893 part=0
5894 fdisk -W - $rbootdev | grep -v '^*' | grep -v '^$' | \
5895 while read id act bhead bcyl ehead ecyl rsect numsect
5897 # Find solaris partition, either older 130 or 191
5898 if [ $id -eq "191" -o $id -eq "130" ] ; then
5899 break
5901 part=`expr "$part" + 1`
5902 done
5904 get_biosdisk $rootdev
5905 grubhd="(hd${biosdisk},${part},${gslice})"
5908 # update the grub menu if it doesn't exist or
5909 # doesn't have usable boot entries
5911 if [ -f $MENU ]; then
5912 grep -v "^#" $MENU | grep $grubhd >/dev/null 2>&1
5913 if [ $? -eq 1 ]; then
5914 update_grub_menu $grubhd
5916 else
5917 update_grub_menu $grubhd
5919 done
5923 # Build the multiboot boot archive
5925 build_boot_archive()
5928 # We should be able to run bootadm here but that's a
5929 # little more complicated than one would think
5930 #bootadm_args=${rootprefix:+-R $rootprefix}
5931 #PATH=/tmp/bfubin /tmp/bfubin/bootadm update $bootadm_args
5933 cr_args=${rootprefix:+ -R $rootprefix}
5934 if [ -x /tmp/bfubin/create_ramdisk ] ; then
5935 LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \
5936 /tmp/bfubin/ksh \
5937 /tmp/bfubin/create_ramdisk $cr_args
5938 else
5939 LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \
5940 /tmp/bfubin/ksh \
5941 $rootprefix/boot/solaris/bin/create_ramdisk $cr_args
5945 # Disable the boot-archive service on the first boot
5946 # to silence complaints about new files
5947 # svccfg -s system/boot-archive setprop start/exec = true
5949 mkdir -p $rootprefix/bfu.conflicts/lib/svc/method
5950 cp $rootprefix/lib/svc/method/boot-archive \
5951 $rootprefix/bfu.conflicts/lib/svc/method/boot-archive
5952 cat >$rootprefix/lib/svc/method/boot-archive <<"EOF"
5953 #!/sbin/sh
5954 exit 0
5957 cat >$rootprefix/etc/rc2.d/S99postbfu <<EOF
5958 #!/bin/sh
5960 case "\$1" in
5961 'start')
5962 cp /bfu.conflicts/lib/svc/method/boot-archive /lib/svc/method/boot-archive
5963 chmod +x /lib/svc/method/boot-archive
5964 rm -f /etc/rc2.d/S99postbfu
5967 echo "usage: \$0 start"
5968 exit 1
5970 esac
5971 exit 0
5974 chmod +x $rootprefix/etc/rc2.d/S99postbfu
5975 chmod +x $rootprefix/lib/svc/method/boot-archive
5976 chmod +x $rootprefix/bfu.conflicts/lib/svc/method/boot-archive
5980 # Install failsafe archive on a sparc machine if not present.
5981 # Use a well-known server for the archive if we need it.
5983 install_sparc_failsafe()
5985 # check if failsafe already installed
5986 if [ -f $rootprefix/platform/$karch/failsafe ]; then
5987 return
5989 if [ -z "$FAILSAFE_SERVER" ]; then
5990 FAILSAFE_SERVER="netinstall.sfbay"
5992 if [ -z "$FAILSAFE_IMAGE" ]; then
5993 FAILSAFE_IMAGE="export/nv/s/latest"
5995 fs_wos_image="/net/${FAILSAFE_SERVER}/${FAILSAFE_IMAGE}"
5996 fs_archive="${fs_wos_image}/boot/sparc.miniroot"
5997 if [ ! -d $fs_wos_image ] || [ ! -f $fs_archive ]; then
5998 # XXX Remove this fallback to a known good archive once real
5999 # XXX images with boot archives become available.
6000 fs_wos_image="/net/netinstall.sfbay/export/setje/nbs-latest"
6001 fs_archive="${fs_wos_image}/boot/sparc.miniroot"
6003 if [ -d $fs_wos_image ] || [ ! -f $fs_archive ]; then
6004 echo "Installing failsafe archive from $fs_wos_image"
6005 cp $fs_archive $rootprefix/platform/$karch/failsafe
6009 disable_boot_service()
6011 svccfg -s system/boot-archive setprop start/exec = true
6012 cat >$rootprefix/lib/svc/method/boot-archive <<EOF
6013 #!/sbin/sh
6014 . /lib/svc/share/smf_include.sh
6015 . /lib/svc/share/fs_include.sh
6016 exit 0
6020 dir_is_inherited() {
6021 dir=$1
6022 set -- `zonecfg -z $zone info inherit-pkg-dir dir=/$dir`
6023 [ "$3" = "/$dir" ] && return 0 || return 1
6026 check_boot_env()
6028 if [ $multi_or_direct = yes ]; then
6029 if [ $archive_type != $system_type ]; then
6030 install_failsafe
6031 [ $system_type = dca ] && setup_grub_menu
6033 if [ $have_new_bootadm = yes ] ||
6034 ( [ -x /tmp/bfubin/symdef ] &&
6035 [ -x /tmp/bfubin/bootadm ] &&
6036 /tmp/bfubin/symdef /tmp/bfubin/bootadm \
6037 dboot_or_multiboot ); then
6038 if [[ -z $rootprefix ]]; then
6039 PATH=/tmp/bfubin /tmp/bfubin/bootadm \
6040 -m upgrade $bootadm_f_flag
6041 else
6042 PATH=/tmp/bfubin /tmp/bfubin/bootadm \
6043 -m upgrade -R $rootprefix \
6044 $bootadm_f_flag
6046 install_grub
6047 [ $archive_type = directboot ] && update_bootenv
6048 else
6049 install_grub
6050 cat >&2 <<EOF
6052 WARNING: Cannot find new bootadm. If bfu'ing across the multiboot/directboot
6053 boundary, you will need to manually change menu.lst. See
6054 http://www.sun.com/msg/SUNOS-8000-CF for details.
6060 # If we're going backwards, we need to remove the
6061 # symdef binary.
6063 if [ -f $rootprefix/boot/solaris/bin/symdef ] && \
6064 [ $archive_type = multiboot ]
6065 then
6066 rm -f $rootprefix/boot/solaris/bin/symdef \
6067 $rootprefix/boot/solaris/bin/update_grub
6069 elif [ $failsafe_type = multiboot ]; then
6070 rm -f $rootprefix/boot/platform/i86pc/kernel/unix
6071 elif [ $failsafe_type = directboot ]; then
6072 cp /tmp/bfubin/unix \
6073 $rootprefix/boot/platform/i86pc/kernel/unix
6075 build_boot_archive
6076 else
6077 disable_boot_service
6081 mondo_loop() {
6082 typeset pkgroot
6083 typeset pkg
6084 root=$1
6085 zone=$2
6086 if [ $zone != global ]; then
6087 usrroot=$root
6090 # If the archives being installed contain i86pc.boot,
6091 # check to see if it contains strap.com, one of the
6092 # four possibly-required booters. If i86pc.boot does,
6093 # try to upgrade the realmode booters from the current
6094 # archive set.
6096 # Don't bother doing the upgrade for diskless bfu, as the boot
6097 # will be done with floppy or PXE, which must match the build
6098 # anyway (floppy must match or add_install_client must be
6099 # rerun), and in any event we can't touch the boot bits
6100 # for diskless boot from here. Also don't do this for
6101 # any zone but 'global'.
6103 cd $root || fail "Cannot cd $root"
6104 rootprefix=${root%/}
6105 pkgroot=${rootprefix:+-R $rootprefix}
6107 if [ "$karch" = "i86pc" -a "$diskless" = "no" -a "$zone" = "global" ]
6108 then
6109 remove_properties
6110 check_system_type
6111 if boot_is_upgradeable $root && \
6112 [ $archive_type = dca ]; then
6113 check_multi_to_dca_boot
6114 print "\nUpdating realmode boot loaders\n"
6115 update_realmode_booters $root
6116 setup_pboot
6118 if [ $multi_or_direct = yes ]; then
6119 check_dca_to_multiboot
6120 if [ $is_pcfs_boot = yes ]; then
6121 setup_stubboot
6126 # before we save away driver_aliases, remove any obsolete entries
6127 if [ $target_isa = i386 ]; then
6128 # need to remove old pci5853,1 entry for xpv. The correct
6129 # entry going forward is pci5853,1.1 which is now in
6130 # uts/intel/os/driver_aliases
6131 grep '\"pci5853,1\"' $root/etc/driver_aliases > /dev/null 2>&1
6132 if [ "$?" -eq 0 ]; then
6133 /tmp/bfubin/update_drv -b $root -d -i '"pci5853,1"' xpv > /dev/null 2>&1
6137 SECONDS=0 # time each iteration
6139 print "\nSaving configuration files in $rootprefix/bfu.child ... \c"
6140 cd $root
6141 rm -rf bfu.default bfu.restore # historical
6142 rm -rf bfu.child bfu.conflicts
6143 mkdir bfu.child bfu.conflicts
6144 filelist $zone | cpio -pdmu bfu.child || \
6145 fail 'failed to save config files'
6146 test -f etc/motd && mv etc/motd etc/motd.old
6149 # If the var/sadm/system/admin/INST_RELEASE file still exists,
6150 # this system has never been bfu'd before. Therefore, the
6151 # information in var/sadm/install/contents is still valid and
6152 # can be used to determine whether files have been modified
6153 # since installation (the bfu.ancestors directory serves this
6154 # purpose for systems that have already been bfu'd.)
6156 if [ -f var/sadm/system/admin/INST_RELEASE ] ; then
6157 firstbfu=yes
6158 else
6159 firstbfu=no
6163 # bfu'ed systems are not upgradeable; prevent suninstall from
6164 # even *presenting* the upgrade option by removing INST_RELEASE.
6166 rm -f var/sadm/system/admin/INST_RELEASE
6169 # Hacks to work around minor annoyances and make life more pleasant.
6170 # Part 1 of 2: pre-archive-extraction stuff
6174 # Do not remove remove_initd_links, since this makes sure things
6175 # work properly when init scripts are shuffled around.
6177 remove_initd_links
6180 # Remove rc.d scripts and things made superfluous by smf.
6181 # Backwards BFUs will resurrect them from the archives.
6183 smf_cleanup
6186 # New, enabled-by-default services need to be checked for, such
6187 # that their enabled status is not flipped by BFU after their
6188 # initial arrival.
6190 smf_handle_new_services
6193 # Handle unbundled TX conversion if needed
6195 tx_check_update
6197 # Reflect SUNWcsr's pre-install change
6198 if [[ -f $rootprefix/etc/inet/ipnodes && \
6199 ! -h $rootprefix/etc/inet/ipnodes ]]; then
6200 rm -f $rootprefix/etc/inet/ipnodes.hostsmerge
6201 cp -p $rootprefix/etc/inet/ipnodes \
6202 $rootprefix/etc/inet/ipnodes.hostsmerge
6206 # Remove obsolete disassembler module
6208 if [ $target_isa = sparc ]; then
6209 rm -rf $usr/lib/mdb/disasm/*
6210 rm -f $root/kernel/kmdb/sparcv9/sparc
6214 # Remove obsolete Sun-Fire-880 (daktari) FMA Fault Tree directory
6215 # and file. Backwards BFUs will resurrect them from the archives.
6217 if [ $target_isa = sparc ]; then
6218 rm -rf $usr/platform/SUNW,Sun-Fire-880/lib/fm
6222 # Remove old ndpd header (moved to /usr/include per 6509782)
6224 rm -f $usr/include/protocols/ndpd.h
6227 # Remove old FMA dictionary files
6229 rm -f $usr/lib/fm/FMD.dict
6230 rm -f $usr/lib/fm/SUN4U.dict
6231 rm -f $usr/lib/fm/SUNOS.dict
6233 # Remove unused SMF dictionary
6234 rm -f $root/usr/lib/fm/dict/SMF.dict
6235 rm -f $root/usr/lib/locale/C/LC_MESSAGES/SMF.mo
6238 # Remove old FMA .eft files and directories
6240 rm -f $usr/platform/sun4u/lib/fm/eft/pci-sun4u.eft
6241 rm -rf $usr/platform/SUNW,Serverblade1/lib/fm
6242 rm -rf $usr/platform/SUNW,Sun-Fire/lib/fm
6243 rm -rf $usr/platform/SUNW,Sun-Fire-15000/lib/fm
6246 # Remove old FMA LDOMS files
6248 rm -f $usr/platform/sun4v/lib/fm/fmd/libldom.so.1
6249 rm -f $usr/platform/sun4v/lib/fm/fmd/libldom.so
6250 rm -f $usr/platform/sun4v/lib/fm/fmd/llib-lldom
6251 rm -f $usr/platform/sun4v/lib/fm/fmd/llib-lldom.ln
6252 rm -f $usr/platform/sun4v/lib/fm/fmd/sparcv9/libldom.so.1
6253 rm -f $usr/platform/sun4v/lib/fm/fmd/sparcv9/libldom.so
6254 rm -f $usr/platform/sun4v/lib/fm/fmd/sparcv9/llib-lldom.ln
6257 # Remove old topology data
6259 rm -rf $usr/lib/fm/topo
6260 rm -f $usr/platform/*/lib/fm/topo/hc-topology.xml
6261 rm -f $usr/platform/SUNW,Sun-Fire-T200/lib/fm/topo/maps/Sun-Blade-T6300-hc-topology.xml
6264 # Remove old prtopo and obsoleted include file.
6266 rm -f $usr/include/fm/libtopo_enum.h
6267 rm -f $usr/lib/fm/prtopo
6270 # Remove fm driver
6272 rm -f $root/kernel/drv/fm
6273 rm -f $root/kernel/drv/fm.conf
6274 rm -f $root/kernel/drv/amd64/fm
6275 rm -f $root/kernel/drv/sparcv9/fm
6278 # Remove old AMD cpu module, to be replaced by extended cpu.generic
6279 # with AMD-specific support layered on top as a model-specific module.
6280 # Also remove the corresponding mdb and kmdb support. Backwards BFU
6281 # will reintroduce these files.
6282 rm -f $root/platform/i86pc/kernel/cpu/cpu.AuthenticAMD.15
6283 rm -f $root/platform/i86pc/kernel/cpu/amd64/cpu.AuthenticAMD.15
6284 rm -f $root/usr/platform/i86pc/lib/mdb/kvm/cpu.AuthenticAMD.15.so
6285 rm -f $root/usr/platform/i86pc/lib/mdb/kvm/amd64/cpu.AuthenticAMD.15.so
6286 rm -f $root/usr/platform/i86pc/lib/mdb/kvm/cpu.generic.so
6287 rm -f $root/usr/platform/i86pc/lib/mdb/kvm/amd64/cpu.generic.so
6288 rm -f $root/usr/platform/i86pc/lib/mdb/kvm/cpu_ms.AuthenticAMD.15.so
6289 rm -f $root/usr/platform/i86pc/lib/mdb/kvm/amd64/cpu_ms.AuthenticAMD.15.so
6290 rm -f $root/usr/lib/mdb/kvm/cpu.generic.so
6291 rm -f $root/usr/lib/mdb/kvm/amd64/cpu.generic.so
6292 rm -f $root/usr/lib/mdb/kvm/cpu_ms.AuthenticAMD.15.so
6293 rm -f $root/usr/lib/mdb/kvm/amd64/cpu_ms.AuthenticAMD.15.so
6295 # Remove pcbe drivers for AMD
6297 # old: need to remove going forwards:
6299 rm -f $root/usr/kernel/pcbe/pcbe.AuthenticAMD.15
6300 rm -f $root/usr/kernel/pcbe/pcbe.AuthenticAMD.16
6301 rm -f $root/usr/kernel/pcbe/amd64/pcbe.AuthenticAMD.15
6302 rm -f $root/usr/kernel/pcbe/amd64/pcbe.AuthenticAMD.16
6304 # new: need to remove going backwards:
6306 rm -f $root/usr/kernel/pcbe/pcbe.AuthenticAMD
6307 rm -f $root/usr/kernel/pcbe/amd64/pcbe.AuthenticAMD
6309 # Remove cpu.generic from i86xpv platform
6310 rm -f $root/platform/i86xpv/kernel/cpu/cpu.generic
6311 rm -f $root/platform/i86xpv/kernel/cpu/amd64/cpu.generic
6314 # Remove obsolete buildmnttab script. Backwards BFUs will
6315 # resurrect it by extracting it from the archives.
6317 rm -f $root/etc/init.d/buildmnttab
6318 rm -f $root/etc/rcS.d/S70buildmnttab.sh
6321 # Break-up of inetsvc, inetinit & network -- remove both the old
6322 # and new init scripts. The correct ones will be extracted from
6323 # the archives whether bfu'ing backwards or forwards.
6325 # old: need to remove going forwards:
6327 rm -f $root/etc/rc0.d/K42inetsvc
6328 rm -f $root/etc/rc1.d/K42inetsvc
6329 rm -f $root/etc/rcS.d/K42inetsvc
6330 rm -f $root/etc/rcS.d/S29network.sh
6332 # new: need to remove going backwards:
6334 rm -f $root/etc/init.d/domainname
6335 rm -f $root/etc/init.d/inetd
6336 rm -f $root/etc/init.d/named
6337 rm -f $root/etc/init.d/nodename
6338 rm -f $root/etc/rc0.d/K40inetd
6339 rm -f $root/etc/rc0.d/K42named
6340 rm -f $root/etc/rc1.d/K40inetd
6341 rm -f $root/etc/rc1.d/K42named
6342 rm -f $root/etc/rc2.d/S69domainname
6343 rm -f $root/etc/rc2.d/S72named
6344 rm -f $root/etc/rc2.d/S77inetd
6345 rm -f $root/etc/rcS.d/K40inetd
6346 rm -f $root/etc/rcS.d/K42named
6347 rm -f $root/etc/rcS.d/S28network.sh
6348 rm -f $root/etc/rcS.d/S29nodename.sh
6351 # Remove Zones init scripts: they will be extracted properly
6352 # going forwards; after going backwards, they will be gone,
6353 # thus preventing scary warnings on subsequent bfu's.
6355 rm -f $root/etc/init.d/zones
6356 rm -f $root/etc/rc0.d/K01zones
6357 rm -f $root/etc/rc1.d/K01zones
6358 rm -f $root/etc/rc2.d/K01zones
6359 rm -f $root/etc/rc3.d/S99zones
6360 rm -f $root/etc/rcS.d/K01zones
6363 # Remove <inet>6 STREAMS modules; these no longer exist (and
6364 # should never have existed in the first place).
6366 rm -f $root/kernel/strmod/icmp6 \
6367 $root/kernel/strmod/ip6 \
6368 $root/kernel/strmod/tcp6 \
6369 $root/kernel/strmod/udp6
6371 rm -f $root/kernel/strmod/sparcv9/icmp6 \
6372 $root/kernel/strmod/sparcv9/ip6 \
6373 $root/kernel/strmod/sparcv9/tcp6 \
6374 $root/kernel/strmod/sparcv9/udp6
6377 # Remove old ZFS binaries (back when it was three modules)
6379 find $root/kernel/drv -name zpool 2> /dev/null | xargs rm -f
6380 rm -f $root/kernel/drv/zpool.conf
6381 rm -f $root/kernel/drv/zpool.cache
6383 find $root/kernel/drv -name zvol 2> /dev/null | xargs rm -f
6384 rm -f $root/kernel/drv/zvol.conf
6385 rm -rf $root/kernel/devname
6386 rm -f $usr/include/sys/fs/sdev_node.h
6389 # Remove /usr/lib/old_libthread since support for it has
6390 # been removed from the kernel in Solaris 10. If this is
6391 # a backwards BFU, it will all be extracted again by cpio.
6392 rm -rf $usr/lib/old_libthread
6394 # Remove libconfig
6395 rm -f $usr/lib/drv/config_md.so.1
6396 rm -f $usr/include/config_md.h
6397 # remove libssd
6398 rm -f $usr/lib/libssd.a
6399 rm -f $usr/lib/libssd.so
6400 rm -f $usr/lib/libssd.so.1
6401 # remove libap
6402 rm -f $usr/lib/libap_dmd.a
6403 rm -f $usr/lib/libap_dmd.so.1
6404 # remove libintpos
6405 rm -f $usr/lib/libintpos.a
6406 rm -f $usr/lib/libintpos.so.1
6408 # Remove obsolete abi subdirectories
6409 if [ -d $usr/platform/*/lib/abi ]; then
6410 rm -rf $usr/platform/*/lib/abi
6412 rm -rf $usr/lib/gss/abi
6413 rm -rf $usr/lib/krb5/abi
6414 rm -rf $usr/xpg4/lib/abi
6415 rm -rf $usr/ucblib/abi
6418 # Remove old stuff related to libthread now that libthread has
6419 # been folded into libc and libthread_db has been renamed libc_db.
6420 # In addition, all the apptrace's tracing libraries (i.e., abi_*.so*),
6421 # spec2map and spec2trace are no longer needed, should be removed.
6422 rm -f \
6423 $usr/lib/mdb/proc/libthread.so \
6424 $usr/lib/mdb/proc/sparcv9/libthread.so \
6425 $usr/lib/abi/spec2map \
6426 $usr/lib/abi/spec2trace \
6427 $usr/lib/abi/abi_*.so* \
6428 $usr/lib/abi/sparcv9/abi_*.so*
6431 # Remove the old symlink /lib => usr/lib, if necessary.
6432 # /lib is now a real directory in the root filesystem.
6433 # Remove all of the old static libraries and commands now
6434 # that we no longer build them. If this is a backwards
6435 # BFU, all this will all be extracted again by cpio.
6436 rm $root/lib 2>/dev/null
6437 rm -rf $usr/lib/pics
6438 rm -rf $usr/sbin/static
6439 rm -f \
6440 $usr/ccs/lib/libcurses.a \
6441 $usr/ccs/lib/libform.a \
6442 $usr/ccs/lib/libgen.a \
6443 $usr/ccs/lib/libl.a \
6444 $usr/ccs/lib/libmalloc.a \
6445 $usr/ccs/lib/libmenu.a \
6446 $usr/ccs/lib/libpanel.a \
6447 $usr/ccs/lib/libtermcap.a \
6448 $usr/ccs/lib/libtermlib.a \
6449 $usr/ccs/lib/liby.a \
6450 $usr/lib/lib300.a \
6451 $usr/lib/lib300s.a \
6452 $usr/lib/lib4014.a \
6453 $usr/lib/lib450.a \
6454 $usr/lib/libTL.a \
6455 $usr/lib/libadm.a \
6456 $usr/lib/libadt_jni.a \
6457 $usr/lib/libbsdmalloc.a \
6458 $usr/lib/libbsm.a \
6459 $usr/lib/libc.a \
6460 $usr/lib/libc2.a \
6461 $usr/lib/libc2stubs.a \
6462 $usr/lib/libcmd.a \
6463 $usr/lib/libcrypt.a \
6464 $usr/lib/libcrypt_d.a \
6465 $usr/lib/libcrypt_i.a \
6466 $usr/lib/libcurses.a \
6467 $usr/lib/libdevid.a \
6468 $usr/lib/libdevinfo.a \
6469 $usr/lib/libdhcpagent.a \
6470 $usr/lib/libdhcputil.a \
6471 $usr/lib/libdl_stubs.a \
6472 $usr/lib/libefi.a \
6473 $usr/lib/libelf.a \
6474 $usr/lib/libform.a \
6475 $usr/lib/libgen.a \
6476 $usr/lib/libgenIO.a \
6477 $usr/lib/libike.a \
6478 $usr/lib/libinetcfg.a \
6479 $usr/lib/libinetutil.a \
6480 $usr/lib/libintl.a \
6481 $usr/lib/libkstat.a \
6482 $usr/lib/libl.a \
6483 $usr/lib/libldfeature.a \
6484 $usr/lib/libmail.a \
6485 $usr/lib/libmalloc.a \
6486 $usr/lib/libmapmalloc.a \
6487 $usr/lib/libmenu.a \
6488 $usr/lib/libmeta.a \
6489 $usr/lib/libmp.a \
6490 $usr/lib/libnisdb.a \
6491 $usr/lib/libnls.a \
6492 $usr/lib/libnsl.a \
6493 $usr/lib/libnss_compat.a \
6494 $usr/lib/libnss_dns.a \
6495 $usr/lib/libnss_files.a \
6496 $usr/lib/libnss_nis.a \
6497 $usr/lib/libnss_nisplus.a \
6498 $usr/lib/libp/libc.a \
6499 $usr/lib/libpam.a \
6500 $usr/lib/libpanel.a \
6501 $usr/lib/libplot.a \
6502 $usr/lib/librac.a \
6503 $usr/lib/libresolv.a \
6504 $usr/lib/librpcsvc.a \
6505 $usr/lib/libsec.a \
6506 $usr/lib/libsendfile.a \
6507 $usr/lib/libsocket.a \
6508 $usr/lib/libstraddr.a \
6509 $usr/lib/libtermcap.a \
6510 $usr/lib/libtermlib.a \
6511 $usr/lib/libuuid.a \
6512 $usr/lib/libvolmgt.a \
6513 $usr/lib/libvt0.a \
6514 $usr/lib/libw.a \
6515 $usr/lib/liby.a \
6516 $usr/lib/null.a \
6517 $usr/lib/sparcv9/libadt_jni.a \
6518 $usr/lib/sparcv9/libinetutil.a \
6519 $usr/lib/sparcv9/libldfeature.a \
6520 $usr/lib/sparcv9/libsendfile.a \
6521 $usr/platform/sun4u/lib/libwrsmconf.a \
6522 $usr/ucblib/libcurses.a \
6523 $usr/ucblib/libdbm.a \
6524 $usr/ucblib/libtermcap.a \
6525 $usr/ucblib/libucb.a
6528 # Remove other obsolete files, too
6529 rm -f \
6530 $usr/include/table.h \
6531 $usr/include/libgenIO.h \
6532 $usr/include/sys/kd.h \
6533 $usr/lib/llib-lTL \
6534 $usr/lib/llib-lTL.ln
6537 # libc_psr.so.1 and libmd5_psr.so.1 have been moved
6538 # from /usr/platform/*/lib to /platform/*/lib.
6539 # Remove the old files and their containing directories
6540 rm -f $usr/platform/*/lib/libc_psr.so.1
6541 rm -f $usr/platform/*/lib/sparcv9/libc_psr.so.1
6542 rm -f $usr/platform/*/lib/libmd5_psr.so.1
6543 rm -f $usr/platform/*/lib/sparcv9/libmd5_psr.so.1
6544 rmdir $usr/platform/*/lib/sparcv9 2>/dev/null
6545 rmdir $usr/platform/*/lib 2>/dev/null
6548 # libmd5_psr.so.1 and symlinks to it have been replaced
6549 # by libmd_psr.so.1 and thus need to be removed
6550 rm -f $root/platform/*/lib/libmd5_psr.so.1
6551 rm -f $root/platform/*/lib/sparcv9/libmd5_psr.so.1
6554 # Remove obsolete profile libc symlinks
6555 rm -f $usr/lib/libp/libc.so
6556 rm -f $usr/lib/libp/sparcv9/libc.so
6559 # Remove Legacy DR files, now obsolete due to NGDR Phase II putback
6561 STARFIRE_PLAT=platform/SUNW,Ultra-Enterprise-10000
6562 rm -f \
6563 $root/$STARFIRE_PLAT/kernel/drv/dr \
6564 $root/$STARFIRE_PLAT/kernel/drv/dr.conf \
6565 $root/$STARFIRE_PLAT/kernel/misc/drmach \
6566 $root/$STARFIRE_PLAT/kernel/drv/sparcv9/dr \
6567 $root/$STARFIRE_PLAT/kernel/misc/sparcv9/drmach \
6568 $root/$STARFIRE_PLAT/lib/dr_daemon \
6569 $usr/platform/sun4u/include/sys/dr.h \
6570 $usr/platform/sun4u/include/sys/sfdr.h
6572 # Remove obsolete OPL platform links.
6573 rm -f $root/platform/FJSV,SPARC-Enterprise
6574 rm -f $root/platform/SUNW,OPL-Enterprise
6575 rm -f $usr/platform/FJSV,SPARC-Enterprise
6576 rm -f $usr/platform/SUNW,OPL-Enterprise
6578 # Solstice Enterprise Agent(SEA) : mib-II subagent mibiisa
6579 # needs to be disabled during startup. SMA(System Management Agent)
6580 # has the capability to support mib-II requests.
6581 # The correct ones will be extracted from
6582 # the archives whether bfu'ing backwards or forwards.
6584 # old: need to remove going forwards:
6585 rm -f $root/etc/snmp/conf/mibiisa.rsrc
6587 # new: need to remove going backwards:
6588 rm -f $root/etc/snmp/conf/mibiisa.rsrc-
6590 # remove old terminal emulator module:
6591 # (renamed from 'terminal-emulator' to 'tem')
6593 # old: need to remove going forwards:
6594 rm -f $root/kernel/misc/terminal-emulator
6595 rm -f $root/kernel/misc/amd64/terminal-emulator
6597 # new: need to remove going backwards:
6598 rm -f $root/kernel/misc/tem
6599 rm -f $root/kernel/misc/amd64/tem
6600 rm -f $root/kernel/misc/sparcv9/tem
6603 # Remove /dev/mc symlink and /platform/sun4u/kernel/drv/mc-us3.conf
6604 # if any.
6606 if [ -h $root/dev/mc ]; then
6607 rm -f $root/dev/mc
6610 if [ -f $root/platform/sun4u/kernel/drv/mc-us3.conf ]; then
6611 rm -f $root/platform/sun4u/kernel/drv/mc-us3.conf
6615 # Remove the snowbird sbin and include symlinks
6618 if [[ -h $usr/platform/SUNW,Netra-CP2300/sbin ]] ; then
6619 rm -f $usr/platform/SUNW,Netra-CP2300/sbin
6622 if [[ -h $usr/platform/SUNW,Netra-CP2300/include ]] ; then
6623 rm -f $usr/platform/SUNW,Netra-CP2300/include
6626 # If we still have the old lp(7D) driver, remove it and its symlinks
6627 # and header file. (If driver already gone, don't trample new symlinks.)
6629 if [ -f $root/platform/i86pc/kernel/drv/lp -a \
6630 -h $root/dev/lp[012] ]; then
6631 rm -f $root/dev/lp[012]
6633 rm -f $root/platform/i86pc/kernel/drv/lp.conf
6634 rm -f $root/platform/i86pc/kernel/drv/lp
6635 rm -f $root/usr/include/sys/lp.h
6638 # Remove V880 CPU DR files, program cancelled
6640 DAKTARI_PLAT=platform/SUNW,Sun-Fire-880
6641 rm -f \
6642 $root/$DAKTARI_PLAT/kernel/drv/gptwo.conf \
6643 $root/$DAKTARI_PLAT/kernel/drv/sparcv9/bbc \
6644 $root/$DAKTARI_PLAT/kernel/drv/sparcv9/gptwo \
6645 $root/$DAKTARI_PLAT/kernel/misc/sparcv9/sbdp \
6646 $usr/platform/sun4u/include/sys/sbdp.h
6649 # Remove crash(1M), now obsoleted by mdb(1). If this is a backwards
6650 # BFU, it will be extracted again by cpio.
6652 rm -f $root/etc/crash $usr/sbin/crash $usr/sbin/i86/crash \
6653 $usr/sbin/sparcv7/crash $usr/sbin/sparcv9/crash
6656 # Remove kadb(1M), now obsoleted by kmdb(1M)
6658 rm -f $root/platform/*/kadb
6661 # Remove old platform dmod symlinks
6663 for dir in $usr/platform/*/lib/mdb ; do
6664 [[ -h $dir ]] && rm -f $dir
6665 done
6668 # Remove ADB macros
6670 rm -fr $usr/lib/adb
6672 for dir in $usr/platform/*/lib/adb ; do
6673 rm -fr $dir
6674 done
6677 # Remove the SGENV driver from the Sun-Fire directory structure.
6678 # If this is a backwards BFU, it will be extracted again by cpio.
6680 SERENGETI_PLAT=platform/SUNW,Sun-Fire
6681 rm -f $root/$SERENGETI_PLAT/kernel/drv/sgenv.conf \
6682 $root/$SERENGETI_PLAT/kernel/drv/sparcv9/sgenv
6685 # Remove sun4m
6687 rm -rf $root/platform/sun4m
6688 rm -rf $usr/platform/sun4m
6689 if [ $target_isa = sparc ]; then
6690 rm -f $root/kernel/genunix
6692 rm -f $root/kernel/drv/xbox
6693 rm -f $usr/include/sys/comvec.h
6694 rm -f $usr/include/sys/openprom.h
6695 rm -f $usr/include/sys/cg14io.h
6696 rm -f $usr/include/sys/cg14reg.h
6697 rm -f $usr/include/sys/cg8reg.h
6698 rm -f $usr/include/sys/cg8var.h
6701 # Remove perl 5.6.1
6703 if [[ -d $usr/perl5/5.6.1 ]]; then
6704 remove_perl_561
6708 # Clean up legacy versions of the FMA CPU/Mem DE which may be still
6709 # be laying around. This check may be removed when a sufficient time
6710 # has lapsed between the FMA putback as to ensure that no test machines
6711 # still have development FMA bits.
6713 for platdir in $usr/platform/SUNW,* ; do
6714 [[ -h $platdir ]] && continue
6716 rm -f $platdir/lib/fm/fmd/plugins/cpumem-diagnosis.so
6717 rm -f $platdir/lib/fm/fmd/plugins/cpumem-diagnosis.conf
6718 done
6721 # Clean up legacy versions of x4500 FMA modules which may be still
6722 # be laying around. This check may be removed when a sufficient time
6723 # has lapsed between the FMA putback as to ensure that no test machines
6724 # still have development FMA bits.
6726 rm -f $usr/platform/i86pc/lib/fm/topo/plugins/sata.so
6727 rm -f $usr/platform/i86pc/lib/fm/topo/maps/storage-hc-topology.xml
6728 rm -f $usr/platform/i86pc/lib/fm/fmd/plugins/sfx4500-disk.so
6729 rm -f $usr/platform/i86pc/lib/fm/fmd/plugins/sfx4500-disk.conf
6731 # Remove pam_unix
6733 rm -f $usr/lib/security/pam_unix.so.1
6734 rm -f $usr/lib/security/pam_unix.so
6735 rm -f $usr/lib/security/sparcv9/pam_unix.so.1
6736 rm -f $usr/lib/security/sparcv9/pam_unix.so
6739 # Remove pam_projects
6740 rm -f $usr/lib/security/pam_projects.so.1
6741 rm -f $usr/lib/security/pam_projects.so
6742 rm -f $usr/lib/security/64/pam_projects.so.1
6743 rm -f $usr/lib/security/64/pam_projects.so
6746 # Remove libldap.so.3
6748 rm -f $usr/lib/libldap.so.3
6749 rm -f $usr/lib/sparcv9/libldap.so.3
6752 # Remove nss XFN support no longer used by printing
6754 sed -e '/printers:/s/xfn[ ]*//' \
6755 $rootprefix/bfu.child/etc/nsswitch.conf > /tmp/nssw.$$
6756 cp /tmp/nssw.$$ $rootprefix/bfu.child/etc/nsswitch.conf
6757 rm -f /tmp/nssw.$$
6758 rm -f $usr/lib/nss_xfn.so.1
6759 rm -f $usr/lib/sparcv9/nss_xfn.so.1
6762 # Remove FNS/XFN.
6764 if [ -d $rootprefix/etc/fn -o \
6765 -d $usr/include/xfn -o \
6766 -d $usr/lib/fn -o \
6767 -d $rootprefix/var/fn ]; then
6768 remove_eof_fns
6772 # Remove AT&T FACE
6774 if [ -d $usr/oasys -o -d $usr/vmsys ]; then
6775 remove_eof_face
6779 # Remove EOF Smartcard support
6781 if [ -d $usr/lib/smartcard ]; then
6782 remove_eof_smartcard
6786 # Remove DMI
6788 if [ -d $usr/lib/dmi -o \
6789 -d $rootprefix/etc/dmi -o \
6790 -d $rootprefix/var/dmi ]; then
6791 remove_eof_dmi
6795 # Remove Wildcat
6797 if [ -f $rootprefix/platform/SUNW,Sun-Fire-15000/kernel/misc/sparcv9/gptwo_wci -o \
6798 -f $usr/platform/SUNW,Sun-Fire/lib/rsmlib/wrsm.so.1 -o \
6799 -f $rootprefix/platform/sun4u/kernel/drv/wrsmd.conf -o \
6800 -d $rootprefix/etc/wrsm -o \
6801 -f $usr/platform/sun4u/sbin/wrsmstat ]; then
6802 remove_eof_wildcat
6806 # Remove ASET
6808 if [ -d $usr/aset ]; then
6809 remove_eof_aset
6813 # Remove BIND 8, but only if the generic.usr archive doesn't contains
6814 # BIND 8 named server/tools. If this is a backwards bfu, BIND 8 will
6815 # be extracted again by cpio.
6817 if [[ -f $usr/sbin/dnskeygen ]] && ! $ZCAT $cpiodir/generic.usr$ZFIX \
6818 | cpio -it 2>/dev/null | egrep -s '^usr/sbin/ndc' ; then
6819 remove_eof_bind8
6823 # Remove any sendmailvars: line from /etc/nsswitch.conf
6825 sed -e '/^sendmailvars:/d' $rootprefix/bfu.child/etc/nsswitch.conf > \
6826 /tmp/nssw.$$
6827 cp /tmp/nssw.$$ $rootprefix/bfu.child/etc/nsswitch.conf
6828 rm -f /tmp/nssw.$$
6831 # Remove vold
6833 if [ -f $rootprefix/etc/vold.conf -o -d $usr/lib/vold ]; then
6834 remove_eof_vold
6838 # Remove obsolete Mobile IP software
6840 if [[ -f $rootprefix/etc/init.d/mipagent || \
6841 -f $rootprefix/usr/lib/inet/mipagent ]]; then
6842 remove_eof_mobileip
6846 # Remove SUNWcoff package
6848 pkg=SUNWcoff
6849 if [ $target_isa = i386 ]; then
6850 if pkginfo $pkgroot -q $pkg; then
6851 pkgrm $pkgroot -n $pkg >/dev/null 2>&1
6854 # In case that did not work, do it manually.
6855 if [ -d $rootprefix/var/sadm/pkg/$pkg ]; then
6856 rm -rf $rootprefix/var/sadm/pkg/$pkg
6857 rm $rootprefix/kernel/exec/coffexec
6862 # Remove mii private header
6864 rm -f $usr/include/sys/miipriv.h
6867 # Remove GMT* zoneinfo files
6869 rm -f $usr/share/lib/zoneinfo/GMT-12
6870 rm -f $usr/share/lib/zoneinfo/GMT-11
6871 rm -f $usr/share/lib/zoneinfo/GMT-10
6872 rm -f $usr/share/lib/zoneinfo/GMT-9
6873 rm -f $usr/share/lib/zoneinfo/GMT-8
6874 rm -f $usr/share/lib/zoneinfo/GMT-7
6875 rm -f $usr/share/lib/zoneinfo/GMT-6
6876 rm -f $usr/share/lib/zoneinfo/GMT-5
6877 rm -f $usr/share/lib/zoneinfo/GMT-4
6878 rm -f $usr/share/lib/zoneinfo/GMT-3
6879 rm -f $usr/share/lib/zoneinfo/GMT-2
6880 rm -f $usr/share/lib/zoneinfo/GMT-1
6881 rm -f $usr/share/lib/zoneinfo/GMT+1
6882 rm -f $usr/share/lib/zoneinfo/GMT+2
6883 rm -f $usr/share/lib/zoneinfo/GMT+3
6884 rm -f $usr/share/lib/zoneinfo/GMT+4
6885 rm -f $usr/share/lib/zoneinfo/GMT+5
6886 rm -f $usr/share/lib/zoneinfo/GMT+6
6887 rm -f $usr/share/lib/zoneinfo/GMT+7
6888 rm -f $usr/share/lib/zoneinfo/GMT+8
6889 rm -f $usr/share/lib/zoneinfo/GMT+9
6890 rm -f $usr/share/lib/zoneinfo/GMT+10
6891 rm -f $usr/share/lib/zoneinfo/GMT+11
6892 rm -f $usr/share/lib/zoneinfo/GMT+12
6893 rm -f $usr/share/lib/zoneinfo/GMT+13
6895 # Remove stc(7d)-related files
6896 rm -f $usr/include/sys/stcio.h
6897 rm -f $usr/include/sys/stcvar.h
6898 rm -f $usr/include/sys/stcreg.h
6899 rm -f $usr/include/sys/stcconf.h
6900 SUN4U_DRV=platform/sun4u/kernel/drv
6901 rm -f $rootprefix/$SUN4U_DRV/stc.conf
6902 rm -f $rootprefix/$SUN4U_DRV/stc
6903 rm -f $rootprefix/$SUN4U_DRV/sparcv9/stc
6905 # Remove old CPC adb macros.
6906 rm -f $usr/lib/adb/cpc_ctx
6907 rm -f $usr/lib/adb/cpc_event
6908 if [ $target_isa = sparc ]; then
6909 rm -f $usr/lib/adb/sparcv9/cpc_ctx
6910 rm -f $usr/lib/adb/sparcv9/cpc_event
6913 # Remove obsolete DTrace demos
6914 rm -f $usr/demo/dtrace/cputick.d
6916 # Remove flashprom-related files.
6917 if [ $target_isa = sparc ]; then
6918 for x in $FLASHPROMLIST
6920 rm -f $root/$x;
6921 done
6924 # Remove pt_chmod - obsoleted by new /dev filesystem
6925 if [ $zone = global ]; then
6926 rm -f $usr/lib/pt_chmod
6929 if [ $RM_32BIT_KERNEL -eq 1 -a $zone = global ];
6930 then
6931 print "Removing 32-bit commands and kernel binaries ... \c";
6932 rm -rf \
6933 $usr/bin/sparcv7/amt \
6934 $usr/bin/sparcv7/cputrack \
6935 $usr/bin/sparcv7/newtask \
6936 $usr/bin/sparcv7/nohup \
6937 $usr/bin/sparcv7/pargs \
6938 $usr/bin/sparcv7/pcred \
6939 $usr/bin/sparcv7/pfiles \
6940 $usr/bin/sparcv7/pflags \
6941 $usr/bin/sparcv7/pldd \
6942 $usr/bin/sparcv7/plimit \
6943 $usr/bin/sparcv7/pmap \
6944 $usr/bin/sparcv7/ppgsz \
6945 $usr/bin/sparcv7/ppriv \
6946 $usr/bin/sparcv7/prctl \
6947 $usr/bin/sparcv7/preap \
6948 $usr/bin/sparcv7/prex \
6949 $usr/bin/sparcv7/prstat \
6950 $usr/bin/sparcv7/prun \
6951 $usr/bin/sparcv7/ps \
6952 $usr/bin/sparcv7/psig \
6953 $usr/bin/sparcv7/pstack \
6954 $usr/bin/sparcv7/pstop \
6955 $usr/bin/sparcv7/ptime \
6956 $usr/bin/sparcv7/ptree \
6957 $usr/bin/sparcv7/pwait \
6958 $usr/bin/sparcv7/pwdx \
6959 $usr/bin/sparcv7/setuname \
6960 $usr/bin/sparcv7/sort \
6961 $usr/bin/sparcv7/tnfxtract \
6962 $usr/bin/sparcv7/uptime \
6963 $usr/bin/sparcv7/w \
6964 $usr/sbin/sparcv7/intrstat \
6965 $usr/sbin/sparcv7/lockstat \
6966 $usr/sbin/sparcv7/prtconf \
6967 $usr/sbin/sparcv7/swap \
6968 $usr/sbin/sparcv7/sysdef \
6969 $usr/sbin/sparcv7/whodo \
6970 $root/kernel/dacf/consconfig_dacf \
6971 $root/kernel/drv/arp \
6972 $root/kernel/drv/audiocs \
6973 $root/kernel/drv/audioens \
6974 $root/kernel/drv/bofi \
6975 $root/kernel/drv/bpp \
6976 $root/kernel/drv/clone \
6977 $root/kernel/drv/cn \
6978 $root/kernel/drv/conskbd \
6979 $root/kernel/drv/consms \
6980 $root/kernel/drv/dad \
6981 $root/kernel/drv/devinfo \
6982 $root/kernel/drv/ecpp \
6983 $root/kernel/drv/ehci \
6984 $root/kernel/drv/esp \
6985 $root/kernel/drv/fas \
6986 $root/kernel/drv/fcip \
6987 $root/kernel/drv/fcp \
6988 $root/kernel/drv/fp \
6989 $root/kernel/drv/glm \
6990 $root/kernel/drv/hid \
6991 $root/kernel/drv/hme \
6992 $root/kernel/drv/hubd \
6993 $root/kernel/drv/icmp \
6994 $root/kernel/drv/icmp6 \
6995 $root/kernel/drv/ifp \
6996 $root/kernel/drv/ip \
6997 $root/kernel/drv/ip6 \
6998 $root/kernel/drv/ippctl \
6999 $root/kernel/drv/ipsecah \
7000 $root/kernel/drv/ipsecesp \
7001 $root/kernel/drv/isp \
7002 $root/kernel/drv/iwscn \
7003 $root/kernel/drv/keysock \
7004 $root/kernel/drv/le \
7005 $root/kernel/drv/lebuffer \
7006 $root/kernel/drv/llc1 \
7007 $root/kernel/drv/lofi \
7008 $root/kernel/drv/log \
7009 $root/kernel/drv/md \
7010 $root/kernel/drv/mm \
7011 $root/kernel/drv/mpt \
7012 $root/kernel/drv/nca \
7013 $root/kernel/drv/ohci \
7014 $root/kernel/drv/openeepr \
7015 $root/kernel/drv/options \
7016 $root/kernel/drv/pcata \
7017 $root/kernel/drv/pcic \
7018 $root/kernel/drv/pcmem \
7019 $root/kernel/drv/pcram \
7020 $root/kernel/drv/pcs \
7021 $root/kernel/drv/pcser \
7022 $root/kernel/drv/pem \
7023 $root/kernel/drv/pln \
7024 $root/kernel/drv/poll \
7025 $root/kernel/drv/pseudo \
7026 $root/kernel/drv/ptc \
7027 $root/kernel/drv/ptsl \
7028 $root/kernel/drv/qlc \
7029 $root/kernel/drv/random \
7030 $root/kernel/drv/rts \
7031 $root/kernel/drv/sad \
7032 $root/kernel/drv/scsa2usb \
7033 $root/kernel/drv/scsi_vhci \
7034 $root/kernel/drv/sd \
7035 $root/kernel/drv/se \
7036 $root/kernel/drv/ses \
7037 $root/kernel/drv/sgen \
7038 $root/kernel/drv/soc \
7039 $root/kernel/drv/socal \
7040 $root/kernel/drv/spdsock \
7041 $root/kernel/drv/ssd \
7042 $root/kernel/drv/st \
7043 $root/kernel/drv/sy \
7044 $root/kernel/drv/sysmsg \
7045 $root/kernel/drv/tcp \
7046 $root/kernel/drv/tcp6 \
7047 $root/kernel/drv/tl \
7048 $root/kernel/drv/uata \
7049 $root/kernel/drv/udp \
7050 $root/kernel/drv/udp6 \
7051 $root/kernel/drv/ugen \
7052 $root/kernel/drv/usb_ac \
7053 $root/kernel/drv/usb_as \
7054 $root/kernel/drv/usb_mid \
7055 $root/kernel/drv/usbprn \
7056 $root/kernel/drv/usbser_edge \
7057 $root/kernel/drv/usoc \
7058 $root/kernel/drv/wc \
7059 $root/kernel/exec/aoutexec \
7060 $root/kernel/exec/elfexec \
7061 $root/kernel/exec/intpexec \
7062 $root/kernel/fs/autofs \
7063 $root/kernel/fs/cachefs \
7064 $root/kernel/fs/devfs \
7065 $root/kernel/fs/fifofs \
7066 $root/kernel/fs/hsfs \
7067 $root/kernel/fs/lofs \
7068 $root/kernel/fs/mntfs \
7069 $root/kernel/fs/nfs \
7070 $root/kernel/fs/procfs \
7071 $root/kernel/fs/sockfs \
7072 $root/kernel/fs/specfs \
7073 $root/kernel/fs/tmpfs \
7074 $root/kernel/fs/udfs \
7075 $root/kernel/fs/ufs \
7076 $root/kernel/ipp/dlcosmk \
7077 $root/kernel/ipp/dscpmk \
7078 $root/kernel/ipp/flowacct \
7079 $root/kernel/ipp/ipgpc \
7080 $root/kernel/ipp/tokenmt \
7081 $root/kernel/ipp/tswtclmt \
7082 $root/kernel/misc/amsrc1 \
7083 $root/kernel/misc/audiosup \
7084 $root/kernel/misc/busra \
7085 $root/kernel/misc/consconfig \
7086 $root/kernel/misc/dada \
7087 $root/kernel/misc/des \
7088 $root/kernel/misc/fctl \
7089 $root/kernel/misc/fssnap_if \
7090 $root/kernel/misc/gld \
7091 $root/kernel/misc/hidparser \
7092 $root/kernel/misc/hpcsvc \
7093 $root/kernel/misc/ipc \
7094 $root/kernel/misc/kbtrans \
7095 $root/kernel/misc/kgss/do_kmech_krb5 \
7096 $root/kernel/misc/kgss/gl_kmech_krb5 \
7097 $root/kernel/misc/kgssapi \
7098 $root/kernel/misc/klmmod \
7099 $root/kernel/misc/klmops \
7100 $root/kernel/misc/krtld \
7101 $root/kernel/misc/md5 \
7102 $root/kernel/misc/md_hotspares \
7103 $root/kernel/misc/md_mirror \
7104 $root/kernel/misc/md_notify \
7105 $root/kernel/misc/md_raid \
7106 $root/kernel/misc/md_sp \
7107 $root/kernel/misc/md_stripe \
7108 $root/kernel/misc/md_trans \
7109 $root/kernel/misc/mixer \
7110 $root/kernel/misc/mpxio \
7111 $root/kernel/misc/nfs_dlboot \
7112 $root/kernel/misc/nfssrv \
7113 $root/kernel/misc/pcicfg \
7114 $root/kernel/misc/pcihp \
7115 $root/kernel/misc/phx \
7116 $root/kernel/misc/rpcsec \
7117 $root/kernel/misc/rpcsec_gss \
7118 $root/kernel/misc/rsmops \
7119 $root/kernel/misc/scsi \
7120 $root/kernel/misc/seg_drv \
7121 $root/kernel/misc/seg_mapdev \
7122 $root/kernel/misc/sha1 \
7123 $root/kernel/misc/strplumb \
7124 $root/kernel/misc/swapgeneric \
7125 $root/kernel/misc/tlimod \
7126 $root/kernel/misc/ufs_log \
7127 $root/kernel/misc/usba \
7128 $root/kernel/misc/usbser \
7129 $root/kernel/sched/TS \
7130 $root/kernel/sched/TS_DPTBL \
7131 $root/kernel/strmod/6to4tun \
7132 $root/kernel/strmod/arp \
7133 $root/kernel/strmod/atun \
7134 $root/kernel/strmod/authmd5h \
7135 $root/kernel/strmod/authsha1 \
7136 $root/kernel/strmod/bufmod \
7137 $root/kernel/strmod/connld \
7138 $root/kernel/strmod/dedump \
7139 $root/kernel/strmod/drcompat \
7140 $root/kernel/strmod/encr3des \
7141 $root/kernel/strmod/encraes \
7142 $root/kernel/strmod/encrbfsh \
7143 $root/kernel/strmod/encrdes \
7144 $root/kernel/strmod/icmp \
7145 $root/kernel/strmod/ip \
7146 $root/kernel/strmod/ipsecah \
7147 $root/kernel/strmod/ipsecesp \
7148 $root/kernel/strmod/keysock \
7149 $root/kernel/strmod/ldterm \
7150 $root/kernel/strmod/ms \
7151 $root/kernel/strmod/nca \
7152 $root/kernel/strmod/pckt \
7153 $root/kernel/strmod/pfmod \
7154 $root/kernel/strmod/pipemod \
7155 $root/kernel/strmod/ptem \
7156 $root/kernel/strmod/redirmod \
7157 $root/kernel/strmod/rpcmod \
7158 $root/kernel/strmod/rts \
7159 $root/kernel/strmod/tcp \
7160 $root/kernel/strmod/timod \
7161 $root/kernel/strmod/tirdwr \
7162 $root/kernel/strmod/ttcompat \
7163 $root/kernel/strmod/tun \
7164 $root/kernel/strmod/udp \
7165 $root/kernel/strmod/usb_ah \
7166 $root/kernel/strmod/usbkbm \
7167 $root/kernel/strmod/usbms \
7168 $root/kernel/sys/c2audit \
7169 $root/kernel/sys/doorfs \
7170 $root/kernel/sys/inst_sync \
7171 $root/kernel/sys/kaio \
7172 $root/kernel/sys/msgsys \
7173 $root/kernel/sys/nfs \
7174 $root/kernel/sys/pipe \
7175 $root/kernel/sys/pset \
7176 $root/kernel/sys/rpcmod \
7177 $root/kernel/sys/semsys \
7178 $root/kernel/sys/shmsys \
7179 $root/platform/SUNW,Ultra-250/kernel/drv/envctrltwo \
7180 $root/platform/SUNW,Ultra-250/kernel/misc/platmod \
7181 $root/platform/SUNW,Ultra-4/kernel/drv/envctrl \
7182 $root/platform/SUNW,Ultra-4/kernel/misc/platmod \
7183 $root/platform/SUNW,Ultra-5_10/kernel/misc/platmod \
7184 $root/platform/SUNW,Ultra-80/kernel/misc/platmod \
7185 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/cpu/SUNW,UltraSPARC \
7186 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/cpu/SUNW,UltraSPARC-II \
7187 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/cvc \
7188 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/cvcredir \
7189 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/idn \
7190 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/ngdr \
7191 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/pcipsy \
7192 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/rootnex \
7193 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/drv/sbus \
7194 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/misc/ngdrmach \
7195 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/misc/platmod \
7196 $root/platform/SUNW,Ultra-Enterprise-10000/kernel/unix \
7197 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/ac \
7198 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/central \
7199 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/environ \
7200 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/fhc \
7201 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/simmstat \
7202 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/sram \
7203 $root/platform/SUNW,Ultra-Enterprise/kernel/drv/sysctrl \
7204 $root/platform/SUNW,Ultra-Enterprise/kernel/misc/platmod \
7205 $root/platform/sun4u/boot.conf \
7206 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC \
7207 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-II \
7208 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-III \
7209 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-III+ \
7210 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-IIIi \
7211 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-IIe \
7212 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-IIi \
7213 $root/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-IV \
7214 $root/platform/sun4u/kernel/drv/bwtwo \
7215 $root/platform/sun4u/kernel/drv/cgsix \
7216 $root/platform/sun4u/kernel/drv/cgthree \
7217 $root/platform/sun4u/kernel/drv/cpc \
7218 $root/platform/sun4u/kernel/drv/db21554 \
7219 $root/platform/sun4u/kernel/drv/dma \
7220 $root/platform/sun4u/kernel/drv/ebus \
7221 $root/platform/sun4u/kernel/drv/fd \
7222 $root/platform/sun4u/kernel/drv/ledma \
7223 $root/platform/sun4u/kernel/drv/memtest \
7224 $root/platform/sun4u/kernel/drv/pci_pci \
7225 $root/platform/sun4u/kernel/drv/pcipsy \
7226 $root/platform/sun4u/kernel/drv/power \
7227 $root/platform/sun4u/kernel/drv/rootnex \
7228 $root/platform/sun4u/kernel/drv/sbbc \
7229 $root/platform/sun4u/kernel/drv/sbus \
7230 $root/platform/sun4u/kernel/drv/sbusmem \
7231 $root/platform/sun4u/kernel/drv/sf \
7232 $root/platform/sun4u/kernel/drv/simba \
7233 $root/platform/sun4u/kernel/drv/su \
7234 $root/platform/sun4u/kernel/drv/tod \
7235 $root/platform/sun4u/kernel/drv/trapstat \
7236 $root/platform/sun4u/kernel/drv/zs \
7237 $root/platform/sun4u/kernel/drv/zsh \
7238 $root/platform/sun4u/kernel/genunix \
7239 $root/platform/sun4u/kernel/misc/bootdev \
7240 $root/platform/sun4u/kernel/misc/cpr \
7241 $root/platform/sun4u/kernel/misc/forthdebug \
7242 $root/platform/sun4u/kernel/misc/kgss/do_kmech_krb5 \
7243 $root/platform/sun4u/kernel/misc/kgss/gl_kmech_krb5 \
7244 $root/platform/sun4u/kernel/misc/md5 \
7245 $root/platform/sun4u/kernel/misc/obpsym \
7246 $root/platform/sun4u/kernel/misc/pcmcia \
7247 $root/platform/sun4u/kernel/misc/platmod \
7248 $root/platform/sun4u/kernel/misc/vis \
7249 $root/platform/sun4u/kernel/strmod/kb \
7250 $root/platform/sun4u/kernel/sys/cpc \
7251 $root/platform/sun4u/kernel/tod/todmostek \
7252 $root/platform/sun4u/kernel/tod/todstarfire \
7253 $usr/include/v7/sys/mon_clock.h \
7254 $usr/kernel/drv/dump \
7255 $usr/kernel/drv/fssnap \
7256 $usr/kernel/drv/gen_drv \
7257 $usr/kernel/drv/kstat \
7258 $usr/kernel/drv/ksyms \
7259 $usr/kernel/drv/llc2 \
7260 $usr/kernel/drv/lo \
7261 $usr/kernel/drv/lockstat \
7262 $usr/kernel/drv/logindmux \
7263 $usr/kernel/drv/pm \
7264 $usr/kernel/drv/pshot \
7265 $usr/kernel/drv/ptm \
7266 $usr/kernel/drv/pts \
7267 $usr/kernel/drv/rsm \
7268 $usr/kernel/drv/sppp \
7269 $usr/kernel/drv/sppptun \
7270 $usr/kernel/drv/sysevent \
7271 $usr/kernel/drv/tidg \
7272 $usr/kernel/drv/tivc \
7273 $usr/kernel/drv/tmux \
7274 $usr/kernel/drv/tnf \
7275 $usr/kernel/drv/vol \
7276 $usr/kernel/drv/winlock \
7277 $usr/kernel/exec/javaexec \
7278 $usr/kernel/fs/fdfs \
7279 $usr/kernel/fs/namefs \
7280 $usr/kernel/fs/pcfs \
7281 $usr/kernel/sched/FSS \
7282 $usr/kernel/sched/FX \
7283 $usr/kernel/sched/FX_DPTBL \
7284 $usr/kernel/sched/IA \
7285 $usr/kernel/sched/RT \
7286 $usr/kernel/sched/RT_DPTBL \
7287 $usr/kernel/strmod/cryptmod \
7288 $usr/kernel/strmod/lmodb \
7289 $usr/kernel/strmod/lmode \
7290 $usr/kernel/strmod/lmodr \
7291 $usr/kernel/strmod/lmodt \
7292 $usr/kernel/strmod/rlmod \
7293 $usr/kernel/strmod/spppasyn \
7294 $usr/kernel/strmod/spppcomp \
7295 $usr/kernel/strmod/sppptun \
7296 $usr/kernel/strmod/telmod \
7297 $usr/kernel/sys/acctctl \
7298 $usr/kernel/sys/exacctsys \
7299 $usr/kernel/sys/sysacct \
7300 $usr/lib/gss/mech_spnego.so \
7301 $usr/lib/gss/mech_spnego.so.1 \
7302 $usr/lib/mdb/kvm/cpc.so \
7303 $usr/lib/mdb/kvm/genunix.so \
7304 $usr/lib/mdb/kvm/ip.so \
7305 $usr/lib/mdb/kvm/ipc.so \
7306 $usr/lib/mdb/kvm/ipp.so \
7307 $usr/lib/mdb/kvm/isp.so \
7308 $usr/lib/mdb/kvm/krtld.so \
7309 $usr/lib/mdb/kvm/lofs.so \
7310 $usr/lib/mdb/kvm/logindmux.so \
7311 $usr/lib/mdb/kvm/mdb_ks.so \
7312 $usr/lib/mdb/kvm/nca.so \
7313 $usr/lib/mdb/kvm/nfs.so \
7314 $usr/lib/mdb/kvm/ptm.so \
7315 $usr/lib/mdb/kvm/random.so \
7316 $usr/lib/mdb/kvm/sd.so \
7317 $usr/lib/mdb/kvm/sppp.so \
7318 $usr/lib/mdb/kvm/ssd.so \
7319 $usr/lib/mdb/kvm/ufs_log.so \
7320 $usr/lib/mdb/kvm/usba.so \
7321 $usr/lib/sparcv9/gss/mech_spnego.so \
7322 $usr/lib/sparcv9/gss/mech_spnego.so.1 \
7323 $usr/platform/SUNW,Ultra-1 \
7324 $usr/platform/SUNW,Ultra-250/doc \
7325 $usr/platform/SUNW,Ultra-250/lib/flash-update.sh \
7326 $usr/platform/SUNW,Ultra-250/lib/prom \
7327 $usr/platform/SUNW,Ultra-Enterprise-10000/doc \
7328 $usr/platform/SUNW,Ultra-Enterprise-10000/lib/flash-update.sh \
7329 $usr/platform/SUNW,Ultra-Enterprise-10000/lib/prom \
7330 $usr/platform/sun4u/lib/mdb/kvm/unix.so \
7331 $usr/platform/sun4u/lib/prom/SUNW,Ultra-1 > /dev/null 2>&1;
7332 print "done.";
7335 # Remove pre dboot krtld as well as obsolete boot blocks
7337 if [ $zone = global ]; then
7338 rm -rf \
7339 $root/kernel/misc/sparcv9/krtld \
7340 $root/platform/*/ufsboot \
7341 $root/platform/*/lib/fs/*/bootblk \
7342 $usr/platform/*/lib/fs/*/bootblk
7346 # Remove kmdbmod from /kernel
7348 rm -f $root/kernel/misc/sparcv9/kmdbmod
7351 # Remove obsolete drivers/header files as a result of sun4v source
7352 # code reorg
7354 rm -f $root/platform/sun4u/kernel/drv/sparcv9/pci_pci
7355 rm -f $root/platform/sun4u/kernel/misc/sparcv9/pcmcia
7356 rm -f $usr/include/v9/sys/traptrace.h
7357 rm -f $usr/platform/sun4u/include/sys/spitasi.h
7358 rm -f $usr/kernel/pcbe/sparcv9/pcbe.SUNW,UltraSPARC-T1
7361 # Remove hotplug modules
7363 rm -f $root/kernel/misc/pciehpc
7364 rm -f $root/kernel/misc/amd64/pciehpc
7365 rm -f $root/kernel/misc/sparcv9/pciehpc
7366 rm -f $root/kernel/misc/sparcv9/pcishpc
7367 rm -f $root/kernel/misc/sparcv9/pcicfg.e
7370 # Remove old pcie misc module. Also remove new pcie modules for
7371 # backward bfu.
7373 if [ $target_isa = sparc ]; then
7374 rm -f $root/kernel/misc/sparcv9/pcie
7375 rm -f $root/platform/sun4u/kernel/misc/sparcv9/pcie
7376 rm -f $root/platform/sun4v/kernel/misc/sparcv9/pcie
7380 # Remove the IPsec encryption and authentication modules.
7381 # IPsec now uses the Kernel Crypto Framework for crypto.
7383 rm -f $rootprefix/kernel/strmod/encr3des
7384 rm -f $rootprefix/kernel/strmod/encrdes
7385 rm -f $rootprefix/kernel/strmod/encrbfsh
7386 rm -f $rootprefix/kernel/strmod/encraes
7387 rm -f $rootprefix/kernel/strmod/authmd5h
7388 rm -f $rootprefix/kernel/strmod/authsha1
7389 rm -f $rootprefix/kernel/strmod/sparcv9/encr3des
7390 rm -f $rootprefix/kernel/strmod/sparcv9/encrdes
7391 rm -f $rootprefix/kernel/strmod/sparcv9/encrbfsh
7392 rm -f $rootprefix/kernel/strmod/sparcv9/encraes
7393 rm -f $rootprefix/kernel/strmod/sparcv9/authmd5h
7394 rm -f $rootprefix/kernel/strmod/sparcv9/authsha1
7397 # Remove the now-obsolete "nattymod" STREAMS module.
7399 rm -f $rootprefix/kernel/strmod/nattymod
7400 rm -f $rootprefix/kernel/strmod/amd64/nattymod
7401 rm -f $rootprefix/kernel/strmod/sparcv9/nattymod
7404 # Remove obsolete SSA utility, firmware and fcode.
7405 # usr/lib/firmware/ssa contains ssafirmware
7407 rm -rf $usr/lib/firmware/ssa
7408 rm -f $usr/lib/firmware/fc_s/fc_s_fcode
7409 rm -f $usr/sbin/ssaadm
7412 # Remove seg_drv, seg_mapdev driver
7414 rm -f $root/kernel/misc/seg_drv
7415 rm -f $root/kernel/misc/sparcv9/seg_drv
7416 rm -f $usr/include/sys/seg_drv.h
7417 rm -f $root/kernel/misc/seg_mapdev
7418 rm -f $root/kernel/misc/sparcv9/seg_mapdev
7421 # Remove mpxio module
7423 rm -f $root/kernel/misc/sparcv9/mpxio
7426 # Remove mpxio/vhci adb macros.
7428 if [ $target_isa = sparc -a $zone = global ]; then
7429 rm -f $usr/lib/adb/mdi_client
7430 rm -f $usr/lib/adb/sparcv9/mdi_client
7431 rm -f $usr/lib/adb/mdi_pathinfo
7432 rm -f $usr/lib/adb/sparcv9/mdi_pathinfo
7433 rm -f $usr/lib/adb/mdi_phci
7434 rm -f $usr/lib/adb/sparcv9/mdi_phci
7435 rm -f $usr/lib/adb/mdi_vhci
7436 rm -f $usr/lib/adb/sparcv9/mdi_vhci
7437 rm -f $usr/lib/adb/scsi_vhci_pkt
7438 rm -f $usr/lib/adb/sparcv9/scsi_vhci_pkt
7439 rm -f $usr/lib/adb/scsi_vhci_softstate
7440 rm -f $usr/lib/adb/sparcv9/scsi_vhci_softstate
7444 # Remove platform specific dmfe driver ... its common now
7445 if [ $target_isa = sparc ]; then
7446 rm -f $root/platform/sun4u/kernel/drv/sparcv9/dmfe
7447 rm -f $root/platform/sun4u/kernel/drv/dmfe.conf
7451 # Remove EOF sbpro driver and supporting header file
7452 # (Note that .conf file may also appear in /platform)
7454 if [ $target_isa = i386 ]; then
7455 rm -f $root/kernel/drv/sbpro
7456 rm -f $root/kernel/drv/sbpro.conf
7457 rm -f $root/platform/i86pc/kernel/drv/sbpro.conf
7458 rm -f $usr/include/sys/sbpro.h
7462 # Remove obsolete audio bits. The SADA modules are removed as
7463 # no driver uses them any more. We don't ship certain device
7464 # private headers anymore, as well as headers for the now
7465 # obsolete (and never documented) legacy audio driver API.
7467 # But we only remove the SADA modules if we are delivering Boomer
7468 # with the BFU. We don't want BFU to be toxic when used with older
7469 # archives.
7471 rm -f $root/kernel/misc/diaudio
7472 rm -f $root/kernel/misc/sparcv9/diaudio
7475 # Determine whether to emit update_audio notice or not
7477 check_boomer_sys $root && BOOMER_PRESENT_SYS=true
7478 check_boomer_bfu && BOOMER_PRESENT_BFU=true
7479 check_austr_sys $root && AUSTR_PRESENT_SYS=true
7480 check_austr_bfu $root && AUSTR_PRESENT_BFU=true
7482 if $BOOMER_PRESENT_BFU; then
7483 rm -f $usr/include/sys/audiovar.h
7484 rm -f $usr/include/sys/audio/am_src1.h
7485 rm -f $usr/include/sys/audio/am_src2.h
7486 rm -f $usr/include/sys/audio/audio1575.h
7487 rm -f $usr/include/sys/audio/audio810.h
7488 rm -f $usr/include/sys/audio/audioens.h
7489 rm -f $usr/include/sys/audio/audiohd.h
7490 rm -f $usr/include/sys/audio/audioixp.h
7491 rm -f $usr/include/sys/audio/audiots.h
7492 rm -f $usr/include/sys/audio/audiovia823x.h
7493 rm -f $usr/include/sys/audio/audio_4231.h
7494 rm -f $usr/include/sys/audio/audio_apm.h
7495 rm -f $usr/include/sys/audio/audio_mixer.h
7496 rm -f $usr/include/sys/audio/audio_src.h
7497 rm -f $usr/include/sys/audio/audio_support.h
7498 rm -f $usr/include/sys/audio/audio_trace.h
7499 rm -f $root/kernel/misc/amsrc1
7500 rm -f $root/kernel/misc/amsrc2
7501 rm -f $root/kernel/misc/audiosup
7502 rm -f $root/kernel/misc/mixer
7503 rm -f $root/kernel/misc/amd64/amsrc1
7504 rm -f $root/kernel/misc/amd64/amsrc2
7505 rm -f $root/kernel/misc/amd64/audiosup
7506 rm -f $root/kernel/misc/amd64/diaudio
7507 rm -f $root/kernel/misc/amd64/mixer
7508 rm -f $root/kernel/misc/sparcv9/amsrc1
7509 rm -f $root/kernel/misc/sparcv9/amsrc2
7510 rm -f $root/kernel/misc/sparcv9/audiosup
7511 rm -f $root/kernel/misc/sparcv9/mixer
7513 rm -f $usr/sbin/mixerctl
7515 # Cleanup audio devlinks when bfu'ing back to legacy audio bits.
7516 # We also cleanup devlinks the first time when upgrading from legacy
7517 # to Boomer bits in the update_audio script
7519 if $BOOMER_PRESENT_SYS && ! $BOOMER_PRESENT_BFU; then
7520 rm -f $root/dev/mixer*
7521 rm -f $root/dev/sndstat*
7522 rm -f $root/dev/audio*
7523 rm -f $root/dev/dsp*
7524 rm -f $root/dev/sound/*
7526 touch $root/reconfigure
7529 # If updating to a BFU where austr is removed, make sure we
7530 # remove the driver from kernel state, and clean up the binaries.
7532 if $AUSTR_PRESENT_SYS && ! $AUSTR_PRESENT_BFU; then
7533 /tmp/bfubin/rem_drv -b $root austr >/dev/null 2>&1
7534 rm -f $root/kernel/drv/austr
7535 rm -f $root/kernel/drv/austr.conf
7536 rm -f $root/kernel/drv/sparcv9/austr
7537 rm -f $root/kernel/drv/amd64/austr
7541 # Diskless clients have already extracted /usr so don't delete this
7542 # Non-global zones never extracts /usr so don't delete these
7544 if [ $diskless = no -a $zone = global ]; then
7545 rm -f $usr/sbin/stmsboot
7547 rm -f $usr/lib/mdb/kvm/mpxio.so
7548 rm -f $usr/lib/mdb/kvm/sparcv9/mpxio.so
7549 rm -f $usr/lib/mdb/kvm/amd64/mpxio.so
7550 rm -f $usr/lib/mdb/kvm/scsi_vhci.so
7551 rm -f $usr/lib/mdb/kvm/sparcv9/scsi_vhci.so
7552 rm -f $usr/lib/mdb/kvm/amd64/scsi_vhci.so
7554 rm -f $root/lib/mpxio/mpxio
7555 rm -f $root/lib/mpxio/stmsboot_util
7557 rm -f $root/kernel/kmdb/mpxio
7558 rm -f $root/kernel/kmdb/sparcv9/mpxio
7559 rm -f $root/kernel/kmdb/amd64/mpxio
7560 rm -f $root/kernel/kmdb/scsi_vhci
7561 rm -f $root/kernel/kmdb/sparcv9/scsi_vhci
7562 rm -f $root/kernel/kmdb/amd64/scsi_vhci
7565 # Remove rpcib misc module (converted to driver)
7567 rm -f $root/kernel/misc/sparcv9/rpcib
7568 rm -f $root/kernel/drv/sparcv9/rpcib
7571 # Remove drivers & header files for EOL of soc & pln drivers
7572 # as per PSARC/2003/233
7574 rm -f $root/kernel/drv/pln.conf
7575 rm -f $root/kernel/drv/sparcv9/pln
7576 rm -f $root/kernel/drv/sparcv9/soc
7577 rm -f $usr/include/sys/socvar.h
7578 rm -f $usr/include/sys/socmap.h
7579 rm -f $usr/include/sys/soc_cq_defs.h
7580 rm -f $usr/include/sys/socreg.h
7581 rm -f $usr/include/sys/scsi/adapters/plndef.h
7582 rm -f $usr/include/sys/scsi/adapters/plnvar.h
7583 rm -f $usr/include/sys/scsi/adapters/ssaisp.h
7584 rm -f $usr/include/sys/scsi/targets/pln_ctlr.h
7585 rm -f $usr/include/sys/scsi/targets/osesio.h
7588 # PSARC/2003/629 Common Solaris Target Disk Driver
7589 # remove adb macro "scsi_disk" for the x86 platform
7591 if [ $target_isa = i386 ]; then
7592 rm -f $usr/lib/adb/scsi_disk
7595 # Remove CPCv1 API header per PSARC/2004/648
7596 rm -f $usr/include/sys/cpc_event.h
7598 # Remove headers per PSARC/2005/561
7599 rm -f $usr/include/sys/nexusintr.h
7600 rm -f $usr/platform/sun4u/include/sys/nexusintr_impl.h
7601 rm -f $usr/platform/sun4v/include/sys/nexusintr_impl.h
7603 # Remove usr/lib/mail which has moved to etc/mail/cf, but first,
7604 # attempt to migrate any user-added files, which primarily live
7605 # under usr/lib/mail/cf . Blow away the seven files which we
7606 # ship under that directory, then move any that remain to the
7607 # new location, which we will `mkdir -p` just to be safe.
7608 # If the zone in question is non-global, then skip all this.
7610 if [ $zone = "global" ]; then
7611 # -d follow sym-links: make sure it's not a link.
7612 if [ -d $usr/lib/mail -a ! -h $usr/lib/mail ]; then
7613 # Only do this if usr/lib/mail is still a directory;
7614 # bfu'ing backwards does not merit such migration.
7615 rm -f $usr/lib/mail/cf/Makefile
7616 rm -f $usr/lib/mail/cf/main.cf
7617 rm -f $usr/lib/mail/cf/main.mc
7618 rm -f $usr/lib/mail/cf/submit.cf
7619 rm -f $usr/lib/mail/cf/submit.mc
7620 rm -f $usr/lib/mail/cf/subsidiary.cf
7621 rm -f $usr/lib/mail/cf/subsidiary.mc
7622 mkdir -p -m 0755 $root/etc/mail/cf/cf
7623 mv $usr/lib/mail/cf/* $root/etc/mail/cf/cf >/dev/null 2>&1
7625 rm -rf $usr/lib/mail
7628 # local.cf no longer needed with the advent of sendmail -bl
7629 rm -f $root/etc/mail/cf/cf/local.cf
7630 rm -f $root/etc/mail/cf/cf/local.mc
7631 rm -f $root/etc/mail/local.cf
7634 # Remove drivers and header files for EOF of Lance Ethernet
7635 # driver(le) as per PSARC/2003/335.
7637 rm -f $root/kernel/drv/le
7638 rm -f $root/kernel/drv/sparcv9/le
7639 rm -f $root/kernel/drv/lebuffer
7640 rm -f $root/kernel/drv/sparcv9/lebuffer
7641 rm -f $root/platform/sun4u/kernel/drv/ledma
7642 rm -f $root/platform/sun4u/kernel/drv/sparcv9/ledma
7643 rm -f $usr/include/sys/le.h
7644 rm -f $usr/include/sys/lance.h
7645 rm -f $usr/lib/adb/le
7646 rm -f $usr/lib/adb/lestr
7649 # Remove drivers and header files for EOF of ieef driver as
7650 # per PSARC/2003/009
7652 rm -f $root/kernel/drv/ieef
7653 rm -f $root/kernel/drv/ieef.conf
7654 rm -f $usr/include/sys/ieef.h
7655 rm -f $root/boot/solaris/drivers/notisa.010/ieef.bef
7658 # Remove drivers and header files for EOF of elx driver as
7659 # per PSARC/2003/770
7661 rm -f $root/platform/i86pc/kernel/drv/elx
7662 rm -f $root/platform/i86pc/kernel/drv/elx.conf
7663 rm -f $usr/include/sys/elx.h
7664 rm -f $root/boot/solaris/drivers/isa.175/elx.bef
7667 # Remove drivers for EOF of pe driver as per PSARC/2004/051
7669 rm -f $root/kernel/drv/pe
7670 rm -f $root/kernel/drv/pe.conf
7671 rm -f $root/boot/solaris/drivers/isa.125/pe3.bef
7674 # Remove drivers for EOF of Compaq NCR, Compaq SMART2, AMI Mega
7675 # card and /usr/bin/smart2cfg as per PSARC/2003/701 and
7676 # PSARC/2004/207
7678 rm -f $root/kernel/drv/cpqncr
7679 rm -f $root/kernel/drv/cpqncr.conf
7680 rm -f $root/boot/solaris/drivers/notisa.020/cpqncr.bef
7681 rm -f $root/platform/i86pc/kernel/drv/smartii
7682 rm -f $root/platform/i86pc/kernel/drv/smartii.conf
7683 rm -f $usr/bin/smart2cfg
7684 rm -f $root/kernel/drv/mega
7685 rm -f $root/kernel/drv/mega.conf
7686 rm -f $root/boot/solaris/drivers/notisa.010/mega.bef
7687 rm -f $root/kernel/mach/compaq
7688 rm -f $root/kernel/mach/corollary
7691 # Remove driver for EOF of pcelx as per PSARC 2009/662
7693 rm -f $root/kernel/drv/pcelx
7694 rm -f $root/kernel/drv/amd64/pcelx
7695 rm -f $usr/include/sys/pcmcia/pcgld.h
7696 rm -f $usr/include/sys/pcmcia/pcelx.h
7699 # Remove bpp, esp, and dma
7701 rm -f $root/kernel/drv/sparcv9/bpp
7702 rm -f $root/kernel/drv/sparcv9/esp
7703 rm -f $root/platform/sun4u/kernel/drv/sparcv9/dma
7704 rm -f $root/platform/sun4v/kernel/drv/sparcv9/dma
7705 rm -f $usr/include/sys/dmaga.h
7706 rm -f $usr/include/sys/bpp_reg.h
7707 rm -f $usr/include/sys/bpp_var.h
7708 rm -f $usr/include/sys/scsi/adapters/espcmd.h
7709 rm -f $usr/include/sys/scsi/adapters/espreg.h
7710 rm -f $usr/include/sys/scsi/adapters/espvar.h
7713 # Remove eisa nexus driver and header files for EOF of EISA
7714 # support as per PSARC/2003/650
7716 rm -f $root/platform/i86pc/kernel/drv/eisa
7717 rm -f $usr/platform/i86pc/include/sys/eisarom.h
7718 rm -f $usr/platform/i86pc/include/sys/nvm.h
7721 # Remove xmem headers (they moved back to usr/include/sys/fs)
7723 rm -f $usr/include/ia32/sys/fs/xmem.h
7724 rm -f $usr/include/ia32/sys/fs/seg_xmem.h
7725 rm -rf $usr/include/ia32/sys/fs
7728 # Remove junk headers
7730 rm -f $usr/platform/i86pc/include/sys/mcdma.h
7731 rm -f $usr/platform/i86pc/include/sys/xque.h
7734 # Remove obsolete x86 hat layer and associated adb scripts
7736 rm -f $root/platform/i86pc/kernel/mmu/mmu32
7737 rm -f $root/platform/i86pc/kernel/mmu/mmu36
7738 rm -rf $root/platform/i86pc/kernel/mmu
7739 rm -f $usr/lib/adb/hwpp
7740 rm -f $usr/lib/adb/hatppp
7741 rm -f $usr/lib/adb/hat.nxt
7742 rm -f $usr/lib/adb/hwpp.nxt
7745 # Remove drivers for EOF of chs as per PSARC/2005/581
7747 rm -f $root/kernel/drv/chs
7748 rm -f $root/kernel/drv/chs.conf
7749 rm -f $root/boot/solaris/drivers/notisa.020/chs.bef
7752 # Remove drivers & header files for EOF of dbri as per PSARC 2005/582
7754 rm -f $root/kernel/drv/sparcv9/dbri
7755 rm -f $root/usr/include/sys/dbriio.h
7756 rm -f $root/usr/include/sys/mmcodecreg.h
7759 # Remove drivers for EOF of pcscsi as per PSARC/2005/003
7761 rm -f $root/kernel/drv/pcscsi
7762 rm -f $root/kernel/drv/pcscsi.conf
7763 rm -f $root/boot/solaris/drivers/notisa.010/pcscsi.bef
7766 # Remove drivers for EOF of dpt as per PSARC/2003/701
7768 rm -f $root/boot/solaris/drivers/isa.125/dpt.bef
7769 rm -f $root/platform/i86pc/kernel/drv/dpt
7770 rm -f $root/platform/i86pc/kernel/drv/dpt.conf
7771 rm -rf $usr/include/sys/dktp/dpt
7774 # Remove drivers for EOF of mlx driver as per PSARC/2003/701
7776 rm -f $root/boot/solaris/drivers/notisa.010/mlx.bef
7777 rm -f $root/platform/i86pc/kernel/drv/mlx
7778 rm -f $root/platform/i86pc/kernel/drv/mlx.conf
7779 rm -rf $usr/include/sys/dktp/mlx
7782 # Remove snlb
7784 rm -f $root/kernel/misc/snlb
7785 rm -f $root/kernel/misc/amd64/snlb
7786 rm -f $root/usr/include/sys/dktp/dklb.h
7787 rm -f $root/usr/include/sys/dktp/snlb.h
7790 # Remove objmgr
7792 rm -f $root/kernel/drv/objmgr.conf
7793 rm -f $root/kernel/drv/objmgr
7794 rm -f $root/kernel/drv/amd64/objmgr
7795 rm -f $root/usr/include/sys/dktp/objmgr.h
7798 # Remove other unused headers
7800 rm -f $root/usr/include/sys/scsi/impl/pkt_wrapper.h
7801 rm -f $root/usr/include/sys/dktp/hba.h
7802 rm -f $root/usr/include/sys/dktp/cdtypes.h
7803 rm -f $root/usr/include/sys/dktp/scdk.h
7804 rm -f $root/usr/include/sys/dktp/scdkwatch.h
7805 rm -f $root/usr/include/sys/dktp/sctarget.h
7806 rm -f $root/usr/include/sys/dktp/tgcd.h
7807 rm -f $root/usr/include/sys/dktp/tgpassthru.h
7808 rm -f $root/usr/include/sys/dmfe.h
7809 rm -f $root/usr/include/sys/dmfe_impl.h
7812 # Remove Floating Point Emulator for EOF as per PSARC/2003/651
7814 rm -f $root/platform/i86pc/kernel/misc/emul_80387
7817 # Remove 64-bit adp, cadp and cpqhpc
7819 rm -f $root/kernel/drv/amd64/adp
7820 rm -f $root/kernel/drv/amd64/cadp
7821 rm -f $root/kernel/drv/amd64/cpqhpc
7824 # Remove 64-bit i2o_bs, i2o_msg, i2o_scsi, pci_to_i2o, ncrs,
7825 # spwr, bscv, bscbus
7827 rm -f $root/kernel/drv/amd64/i2o_bs
7828 rm -f $root/kernel/misc/amd64/i2o_msg
7829 rm -f $root/kernel/drv/amd64/i2o_scsi
7830 rm -f $root/kernel/drv/amd64/pci_to_i2o
7831 rm -f $root/kernel/drv/amd64/ncrs
7832 rm -f $root/kernel/drv/amd64/spwr
7833 rm -f $root/platform/i86pc/kernel/drv/amd64/bscv
7834 rm -f $root/platform/i86pc/kernel/drv/amd64/bscbus
7836 # Remove obsolete bus mice drivers
7837 rm -f $root/kernel/drv/msm
7838 rm -f $root/platform/i86pc/kernel/drv/amd64/msm
7839 rm -f $root/kernel/drv/logi
7840 rm -f $root/kernel/drv/amd64/logi
7842 # Remove mscsi
7843 rm -f $root/kernel/drv/mscsi
7844 rm -f $root/kernel/drv/mscsi.conf
7845 rm -f $root/platform/i86pc/kernel/drv/amd64/mscsi
7847 # Remove obsolete pfil modules, binaries, and configuration files
7848 rm -f $root/kernel/drv/pfil
7849 rm -f $root/kernel/drv/pfil.conf
7850 rm -f $root/kernel/drv/sparcv9/pfil
7851 rm -f $root/kernel/drv/amd64/pfil
7852 rm -f $root/kernel/strmod/pfil
7853 rm -f $root/kernel/strmod/sparcv9/pfil
7854 rm -f $root/kernel/strmod/amd64/pfil
7855 rm -f $root/usr/sbin/pfild
7857 # Remove nsmb and smbfs modules from old locations
7858 # Also remove new locations of moved stuff for BFU
7859 # from newer to older build ("backward BFU").
7860 # These will be reinstalled from the archive.
7861 # old locations:
7862 rm -f $root/kernel/drv/nsmb
7863 rm -f $root/kernel/drv/amd64/nsmb
7864 rm -f $root/kernel/drv/sparcv9/nsmb
7865 rm -f $root/kernel/fs/smbfs
7866 rm -f $root/kernel/fs/amd64/smbfs
7867 rm -f $root/kernel/fs/sparcv9/smbfs
7868 rm -f $root/kernel/kmdb/nsmb
7869 rm -f $root/kernel/kmdb/smbfs
7870 rm -f $root/kernel/kmdb/amd64/nsmb
7871 rm -f $root/kernel/kmdb/amd64/smbfs
7872 rm -f $root/kernel/kmdb/sparcv9/nsmb
7873 rm -f $root/kernel/kmdb/sparcv9/smbfs
7874 rm -f $usr/kernel/sys/smbfs
7875 rm -f $usr/kernel/sys/amd64/smbfs
7876 rm -f $usr/kernel/sys/sparcv9/smbfs
7877 # new locations:
7878 rm -f $usr/kernel/drv/nsmb
7879 rm -f $usr/kernel/drv/amd64/nsmb
7880 rm -f $usr/kernel/drv/sparcv9/nsmb
7881 rm -f $usr/kernel/fs/smbfs
7882 rm -f $usr/kernel/fs/amd64/smbfs
7883 rm -f $usr/kernel/fs/sparcv9/smbfs
7884 rm -f $usr/kernel/kmdb/nsmb
7885 rm -f $usr/kernel/kmdb/smbfs
7886 rm -f $usr/kernel/kmdb/amd64/nsmb
7887 rm -f $usr/kernel/kmdb/amd64/smbfs
7888 rm -f $usr/kernel/kmdb/sparcv9/nsmb
7889 rm -f $usr/kernel/kmdb/sparcv9/smbfs
7891 # Remove obsolete atomic_prim.h file.
7892 rm -f $usr/include/v9/sys/atomic_prim.h
7895 # Remove sc_nct binary and the corresponding symlink to sc_nct from the
7896 # Montecarlo platform specific directories (Reference: PSARC 2003/606).
7897 # To be specific, the following binary will be removed.
7898 # /platform/SUNW,UltraSPARC-IIe-NetraCT-40/kernel/drv/sparcv9/sc_nct
7899 # Also, the following symlink will be removed.
7900 # /platform/SUNW,UltraSPARC-IIe-NetraCT-60/kernel/drv/sparcv9/sc_nct
7902 if [ -f $root/platform/SUNW,UltraSPARC-IIe-NetraCT-40/kernel/drv/sparcv9/sc_nct ]; then
7903 rm -f $root/platform/SUNW,UltraSPARC-IIe-NetraCT-40/kernel/drv/sparcv9/sc_nct
7904 rm -f $root/platform/SUNW,UltraSPARC-IIe-NetraCT-60/kernel/drv/sparcv9/sc_nct
7908 # In case of bfu to an older release, remove traces of "new"
7909 # Kerberos mechanisms. Kerberos libraries and paths are corrected
7910 # after extraction is complete.
7912 rm -f $root/kernel/misc/kgss/kmech_krb5
7913 rm -f $root/kernel/misc/kgss/sparcv9/kmech_krb5
7914 rm -f $root/platform/$karch/kernel/misc/kgss/sparcv9/kmech_krb5
7916 # Diskless clients have already extracted /usr so don't delete these
7917 # Non-global zones never extracts /usr so don't delete these
7919 if [ $diskless = no -a $zone = global ]; then
7920 rm -f $usr/lib/gss/mech_krb5.so
7921 rm -f $usr/lib/gss/mech_krb5.so.1
7922 rm -f $usr/lib/sparcv9/gss/mech_krb5.so
7923 rm -f $usr/lib/sparcv9/gss/mech_krb5.so.1
7926 # Remove old OpenSSL stuff from SUNWwbint
7927 rm -rf $usr/lib/openssl
7929 #Remove ufs logging module - now merged into ufs module
7930 rm -f $rootprefix/kernel/misc/ufs_log
7931 rm -f $rootprefix/kernel/misc/sparcv9/ufs_log
7933 #Remove ufs_log mdb/kmdb modules - now merged in to ufs module
7934 rm -f $rootprefix/kernel/kmdb/ufs_log
7935 rm -f $rootprefix/kernel/kmdb/sparcv9/ufs_log
7936 rm -f $rootprefix/kernel/kmdb/amd64/ufs_log
7937 rm -f $rootprefix/usr/lib/mdb/kvm/ufs_log.so
7938 rm -f $rootprefix/usr/lib/mdb/kvm/sparcv9/ufs_log.so
7939 rm -f $rootprefix/usr/lib/mdb/kvm/amd64/ufs_log.so
7941 #Remove diskmgtd. If backward BFU, will get re-installed from
7942 #archive.
7943 rm -f $usr/lib/diskmgtd
7946 # Remove old ia64 cruft
7948 if [ $target_isa = i386 ]; then
7949 rm -f $usr/include/sys/ia64_archext.h
7950 rm -f $usr/include/sys/sysia64.h
7951 rm -rf $usr/include/ia64
7955 # Remove machpage-related stuff
7957 rm -f $usr/platform/*/include/vm/mach_page.h
7958 rm -f $usr/lib/adb/machpp
7961 # Remove old cacheos
7963 rm -f $root/etc/init.d/cacheos
7964 rm -f $root/etc/init.d/cacheos.finish
7965 rm -f $root/etc/init.d/cachefs.root
7966 rm -f $root/etc/rcS.d/S35cacheos.sh
7967 rm -f $root/etc/rc2.d/S93cacheos.finish
7968 rm -f $root/etc/rcS.d/S41cachefs.root
7971 # Remove unneeded nfsmapid entries
7973 nfsmapid_cfg
7976 # Nuke the nfsauth headers when we're working with the 'global'
7977 # or a fully populated nonglobal zone. The cpio archive will lay the
7978 # right one to match mountd(1m)'s comm method w/the kernel (via
7979 # kRPC or Doors/XDR).
7981 dir_is_inherited usr 2>/dev/null;
7982 if [ $? = 1 -o $zone = global ]; then
7983 rm -f ${rootprefix}/usr/include/rpcsvc/nfsauth_prot.x
7984 rm -f ${rootprefix}/usr/include/rpcsvc/nfsauth_prot.h
7985 rm -f ${rootprefix}/usr/include/nfs/auth.h
7989 # Move the original manifests aside; later we will restore
7990 # unchanged originals to avoid superfluous re-import on reboot.
7991 # (First blow away the old dir path just to be safe.)
7993 rm -rf $root/$old_mfst_dir
7994 [ -d $root/$new_mfst_dir ] && mv $root/$new_mfst_dir $root/$old_mfst_dir
7997 # Remove obsolete sum.h
7999 rm -f $usr/include/sum.h
8002 # Remove obsolete std.h
8004 rm -f $usr/include/std.h
8007 # Remove obsolete rpc/trace.h
8009 rm -f $usr/include/rpc/trace.h
8012 # Remove acpi_intp module
8014 if [ $target_isa = i386 ]; then
8015 rm -f $root/kernel/misc/acpi_intp
8016 rm -f $root/kernel/misc/amd64/acpi_intp
8020 # Remove nxge module (moved to a generic location to support xVM)
8022 if [ $target_isa = i386 ]; then
8023 rm -f $root/platform/i86pc/kernel/drv/nxge
8024 rm -f $root/platform/i86pc/kernel/drv/amd64/nxge
8025 # We're doing a backward bfu.
8026 rm -f $root/kernel/drv/nxge
8027 rm -f $root/kernel/drv/amd64/nxge
8031 # Remove obsolete librac
8033 rm -f $usr/include/rpc/rac.h
8034 rm -f $usr/lib/llib-lrac
8035 rm -f $usr/lib/llib-lrac.ln
8036 rm -f $usr/lib/amd64/llib-lrac.ln
8037 rm -f $usr/lib/sparcv9/llib-lrac.ln
8038 rm -f $usr/lib/librac.so
8039 rm -f $usr/lib/librac.so.1
8040 rm -f $usr/lib/amd64/librac.so
8041 rm -f $usr/lib/amd64/librac.so.1
8042 rm -f $usr/lib/sparcv9/librac.so
8043 rm -f $usr/lib/sparcv9/librac.so.1
8046 # Remove /kernel/mac. This directory was introduced by
8047 # PSARC/2006/248, and along with this came a syntax change to the
8048 # /etc/aggregation.conf file. After archives have been extracted,
8049 # we check for the existance of the /kernel/mac directory to see if
8050 # we're doing a backward bfu and need to convert the syntax of the
8051 # /etc/aggregation.conf file to its old format.
8053 if [ -d $root/kernel/mac ]; then
8054 from_new_aggrconf=1
8055 rm -rf $root/kernel/mac
8056 else
8057 from_new_aggrconf=0
8060 # Remove libcmd from $root/lib. It has moved back to $usr/lib.
8061 rm -f $root/lib/libcmd.so
8062 rm -f $root/lib/libcmd.so.1
8063 rm -f $root/lib/amd64/libcmd.so
8064 rm -f $root/lib/amd64/libcmd.so.1
8065 rm -f $root/lib/sparcv9/libcmd.so
8066 rm -f $root/lib/sparcv9/libcmd.so.1
8067 rm -f $root/lib/llib-lcmd
8068 rm -f $root/lib/llib-lcmd.ln
8069 rm -f $root/lib/amd64/llib-lcmd.ln
8070 rm -f $root/lib/sparcv9/llib-lcmd.ln
8072 # Remove audit_record_attr. Moved to /usr/lib/security
8073 rm -f $root/etc/security/audit_record_attr
8076 # Remove xmemfs altogether.
8078 rm -f $usr/include/sys/fs/xmem.h
8079 rm -f $usr/include/sys/fs/seg_xmem.h
8080 rm -f $usr/kernel/fs/xmemfs
8081 rm -f $usr/kernel/fs/amd64/xmemfs
8082 rm -rf $usr/lib/fs/xmemfs
8085 # Remove obsolete libmacadm, liblaadm and libwladm. If this is
8086 # a backwards BFU, they will be extracted by cpio.
8088 rm -f $root/lib/libmacadm.so.1
8089 rm -f $root/lib/liblaadm.so.1
8090 rm -f $root/lib/libwladm.so.1
8093 # Remove PCI hotplug devlinks. Their format has changed,
8094 # and the old devlinks will interfere with the new ones.
8096 rm -f $root/dev/cfg/*pci*
8099 # remove the architecture-specific sn1_brand module since it's being
8100 # replaced with platform-specific modules.
8102 rm -f $root/kernel/brand/sparcv9/sn1_brand
8105 # Remove I2O.
8107 rm -f $root/kernel/drv/i2o_bs
8108 rm -f $root/kernel/drv/i2o_bs.conf
8109 rm -f $root/kernel/drv/i2o_scsi
8110 rm -f $root/kernel/drv/i2o_scsi.conf
8111 rm -f $root/kernel/drv/pci_to_i2o
8112 rm -f $root/kernel/drv/pci_to_i2o.conf
8113 rm -f $root/kernel/misc/i2o_msg
8114 rm -f $root/usr/include/sys/i2o/*
8115 rmdir $root/usr/include/sys/i2o/ 2>/dev/null
8118 # Remove px_pci, pxb_plx, pxb_bcm, pcie_pci
8120 rm -f $root/kernel/drv/px_pci.conf
8121 rm -f $root/kernel/drv/sparcv9/px_pci
8122 rm -f $root/kernel/drv/pxb_plx.conf
8123 rm -f $root/kernel/drv/sparcv9/pxb_plx
8124 rm -f $root/kernel/drv/sparcv9/pxb_bcm
8125 rm -f $root/kernel/drv/pcie_pci.conf
8126 rm -f $root/kernel/drv/pcie_pci
8127 rm -f $root/kernel/drv/amd64/pcie_pci
8130 # Remove /usr/ccs/bin dependency files that now live in
8131 # /usr/share/lib/ccs
8133 rm -f $usr/ccs/bin/gprof.callg.blurb
8134 rm -f $usr/ccs/bin/gprof.flat.blurb
8135 rm -f $usr/ccs/bin/nceucform
8136 rm -f $usr/ccs/bin/ncform
8137 rm -f $usr/ccs/bin/nrform
8138 rm -f $usr/ccs/bin/yaccpar
8141 # Remove us driver header.
8143 rm -f $usr/platform/sun4u/include/sys/us_drv.h
8146 # Remove device private and legacy sun headers we don't need
8148 rm -f $usr/include/sys/aflt.h
8149 rm -f $usr/include/sys/bmac.h
8150 rm -f $usr/include/sys/bw2reg.h
8151 rm -f $usr/include/sys/bw2var.h
8152 rm -f $usr/include/sys/cursor_impl.h
8153 rm -f $usr/include/sys/eri.h
8154 rm -f $usr/include/sys/eri_common.h
8155 rm -f $usr/include/sys/eri_mac.h
8156 rm -f $usr/include/sys/eri_msg.h
8157 rm -f $usr/include/sys/eri_phy.h
8158 rm -f $usr/include/sys/i82586.h
8159 rm -f $usr/include/sys/isdnio.h
8160 rm -f $usr/include/sys/mace.h
8161 rm -f $usr/include/sys/memfb.h
8162 rm -f $usr/include/sys/memreg.h
8165 # Remove new files in order to go backward.
8167 rm -f $root/usr/lib/rcm/modules/SUNW_vlan_rcm.so
8168 rm -f $root/usr/lib/rcm/modules/SUNW_aggr_rcm.so
8169 rm -f $root/usr/lib/rcm/modules/SUNW_vnic_rcm.so
8170 rm -f $root/kernel/drv/softmac
8171 rm -f $root/kernel/drv/sparcv9/softmac
8172 rm -f $root/kernel/drv/amd64/softmac
8173 rm -f $root/kernel/drv/iptun.conf
8174 rm -f $root/kernel/drv/iptun
8175 rm -f $root/kernel/drv/sparcv9/iptun
8176 rm -f $root/kernel/drv/amd64/iptun
8177 rm -f $root/kernel/drv/iptunq.conf
8178 rm -f $root/kernel/drv/iptunq
8179 rm -f $root/kernel/drv/sparcv9/iptunq
8180 rm -f $root/kernel/drv/amd64/iptunq
8182 # Remove obsolete tunneling STREAMS modules
8183 rm -f $root/kernel/strmod/6to4tun
8184 rm -f $root/kernel/strmod/sparcv9/6to4tun
8185 rm -f $root/kernel/strmod/amd64/6to4tun
8186 rm -f $root/kernel/strmod/atun
8187 rm -f $root/kernel/strmod/sparcv9/atun
8188 rm -f $root/kernel/strmod/amd64/atun
8189 rm -f $root/kernel/strmod/tun
8190 rm -f $root/kernel/strmod/sparcv9/tun
8191 rm -f $root/kernel/strmod/amd64/tun
8193 # Remove obsolete iptunq
8194 rm -f $root/kernel/drv/iptunq
8195 rm -f $root/kernel/drv/iptunq.conf
8196 rm -f $root/kernel/drv/amd64/iptunq
8197 rm -f $root/kernel/drv/sparcv9/iptunq
8200 # Remove libtopo platform XML files that have been replaced by propmap
8201 # files.
8203 rm -f $root/usr/platform/i86pc/lib/fm/topo/maps/Sun-Fire-*-topology.xml
8206 # Remove old SVVS lo driver and related files. It was renamed to
8207 # svvslo. The renamed files will be extracted using their new names.
8209 rm -f $usr/kernel/drv/lo.conf
8210 rm -f $usr/kernel/drv/lo
8211 rm -f $usr/kernel/drv/sparcv9/lo
8212 rm -f $usr/kernel/drv/amd64/lo
8213 rm -f $usr/include/sys/lo.h
8215 # Remove ucblinks 4.x dev names generator
8216 rm -f $usr/ucb/ucblinks
8217 rm -f $usr/ucblib/ucblinks.awk
8218 rm -f $usr/ucblib/ucblinks.sh
8220 rm -f $root/dev/sd[0-9]*
8221 rm -f $root/dev/rsd[0-9]*
8222 rm -f $root/dev/sr[0-9]*
8223 rm -f $root/dev/rsr[0-9]*
8226 # Remove old amd_iommu driver
8230 # old: need to remove going forwards:
8232 rm -f $root/kernel/drv/amd_iommu
8233 rm -f $root/kernel/drv/amd_iommu.conf
8234 rm -f $root/kernel/drv/amd64/amd_iommu
8237 # new: need to remove going backwards:
8239 rm -f $root/platform/i86pc/kernel/drv/amd_iommu.conf
8240 rm -f $root/platform/i86pc/kernel/drv/amd_iommu
8241 rm -f $root/platform/i86pc/kernel/drv/amd64/amd_iommu
8244 # Remove the UCB headers and lint libraries
8246 rm -rf $usr/ucbinclude
8247 rm -f $usr/ucblib/llib-lcurses
8248 rm -f $usr/ucblib/llib-lcurses.ln
8249 rm -f $usr/ucblib/llib-ldbm
8250 rm -f $usr/ucblib/llib-ldbm.ln
8251 rm -f $usr/ucblib/llib-lrpcsoc
8252 rm -f $usr/ucblib/llib-lrpcsoc.ln
8253 rm -f $usr/ucblib/llib-ltermcap
8254 rm -f $usr/ucblib/llib-ltermcap.ln
8255 rm -f $usr/ucblib/llib-lucb
8256 rm -f $usr/ucblib/llib-lucb.ln
8257 rm -f $usr/ucblib/amd64/llib-lcurses
8258 rm -f $usr/ucblib/amd64/llib-lcurses.ln
8259 rm -f $usr/ucblib/amd64/llib-ldbm
8260 rm -f $usr/ucblib/amd64/llib-ldbm.ln
8261 rm -f $usr/ucblib/amd64/llib-lrpcsoc.ln
8262 rm -f $usr/ucblib/amd64/llib-ltermcap
8263 rm -f $usr/ucblib/amd64/llib-ltermcap.ln
8264 rm -f $usr/ucblib/amd64/llib-lucb
8265 rm -f $usr/ucblib/amd64/llib-lucb.ln
8266 rm -f $usr/ucblib/sparcv9/llib-lcurses
8267 rm -f $usr/ucblib/sparcv9/llib-lcurses.ln
8268 rm -f $usr/ucblib/sparcv9/llib-ldbm
8269 rm -f $usr/ucblib/sparcv9/llib-ldbm.ln
8270 rm -f $usr/ucblib/sparcv9/llib-lrpcsoc.ln
8271 rm -f $usr/ucblib/sparcv9/llib-ltermcap
8272 rm -f $usr/ucblib/sparcv9/llib-ltermcap.ln
8273 rm -f $usr/ucblib/sparcv9/llib-lucb
8274 rm -f $usr/ucblib/sparcv9/llib-lucb.ln
8276 # Remove cgsix
8277 rm -f $root/platform/sun4u/kernel/drv/sparcv9/cgsix
8278 rm -f $usr/include/sys/cg6reg.h
8279 rm -f $usr/include/sys/cg6thc.h
8280 rm -f $usr/include/sys/cg6fbc.h
8281 rm -f $usr/include/sys/cg6tec.h
8282 rm -f $usr/include/sys/ramdac.h
8284 # Remove ucb plotting bits
8285 rm -rf $usr/ucb/aedplot
8286 rm -rf $usr/ucb/atoplot
8287 rm -rf $usr/ucb/bgplot
8288 rm -rf $usr/ucb/crtplot
8289 rm -rf $usr/ucb/dumbplot
8290 rm -rf $usr/ucb/gigiplot
8291 rm -rf $usr/ucb/hp7221plot
8292 rm -rf $usr/ucb/hpplot
8293 rm -rf $usr/ucb/implot
8294 rm -rf $usr/ucb/plot
8295 rm -rf $usr/ucb/plottoa
8296 rm -rf $usr/ucb/t300
8297 rm -rf $usr/ucb/t300s
8298 rm -rf $usr/ucb/t4013
8299 rm -rf $usr/ucb/t450
8300 rm -rf $usr/ucb/tek
8301 rm -rf $usr/ucb/vplot
8304 # Remove legacy pcmcia bits
8306 rm -f $root/kernel/drv/pcmem
8307 rm -f $root/kernel/drv/pcram
8308 rm -f $root/kernel/drv/pem
8309 rm -f $root/kernel/drv/pem.conf
8310 rm -f $root/kernel/drv/amd64/pcmem
8311 rm -f $root/kernel/drv/amd64/pcram
8312 rm -f $root/kernel/drv/amd64/pem
8313 rm -f $root/kernel/drv/sparcv9/pcmem
8314 rm -f $root/kernel/drv/sparcv9/pcram
8315 rm -f $root/kernel/drv/sparcv9/pem
8316 rm -f $root/kernel/drv/stp4020
8317 rm -f $root/kernel/drv/stp4020.conf
8318 rm -f $root/kernel/drv/sparcv9/stp4020
8319 rm -f $root/etc/init.d/pcmcia
8320 rm -f $usr/lib/pcmciad
8321 rm -f $usr/lib/smedia/sm_pcmem.so.1
8322 rm -f $usr/lib/smedia/amd64/sm_pcmem.so.1
8323 rm -f $usr/lib/smedia/sparcv9/sm_pcmem.so.1
8324 rm -f $usr/include/sys/pem.h
8325 rm -f $usr/include/sys/pcmcia/pcramio.h
8326 rm -f $usr/include/sys/pcmcia/pcramvar.h
8329 # The pkg* commands should not be used after this point and before
8330 # archive extraction as libcrypto/libssl may not be available.
8332 # Remove old OpenSSL from /usr/sfw.
8333 if [[ -f $root/lib/libcrypto.so.0.9.8 ]] ||
8334 archive_file_exists generic.lib "lib/libcrypto.so.0.9.8"; then
8336 # SUNWopenssl-libraries
8337 rm -f $root/usr/sfw/lib/libcrypto.so
8338 rm -f $root/usr/sfw/lib/libcrypto.so.0.9.8
8339 rm -f $root/usr/sfw/lib/llib-lcrypto
8340 rm -f $root/usr/sfw/lib/llib-lcrypto.ln
8341 rm -f $root/usr/sfw/lib/libssl.so
8342 rm -f $root/usr/sfw/lib/libssl.so.0.9.8
8343 rm -f $root/usr/sfw/lib/llib-lssl
8344 rm -f $root/usr/sfw/lib/llib-lssl.ln
8345 rm -f $root/usr/sfw/lib/amd64/libcrypto.so
8346 rm -f $root/usr/sfw/lib/amd64/libcrypto.so.0.9.8
8347 rm -f $root/usr/sfw/lib/amd64/llib-lcrypto.ln
8348 rm -f $root/usr/sfw/lib/amd64/libssl.so
8349 rm -f $root/usr/sfw/lib/amd64/libssl.so.0.9.8
8350 rm -f $root/usr/sfw/lib/amd64/llib-lssl.ln
8351 rm -f $root/usr/sfw/lib/sparcv9/libcrypto.so
8352 rm -f $root/usr/sfw/lib/sparcv9/libcrypto.so.0.9.8
8353 rm -f $root/usr/sfw/lib/sparcv9/llib-lcrypto.ln
8354 rm -f $root/usr/sfw/lib/sparcv9/libssl.so
8355 rm -f $root/usr/sfw/lib/sparcv9/libssl.so.0.9.8
8356 rm -f $root/usr/sfw/lib/sparcv9/llib-lssl.ln
8358 # SUNWopenssl-commands
8359 rm -f $root/usr/sfw/bin/CA.pl
8361 # SUNWopenssl-include
8362 rm -rf $root/usr/sfw/include/openssl
8364 # SUNWopenssl-man
8365 # Listing the man pages individually would add about 1000
8366 # lines so it's simpler to pull them out of the package db.
8367 opensslman=$(nawk -F '[ =]'\
8368 '/usr\/sfw\/share\/man.* [fs] .*SUNWopenssl-man/ {print $1}' \
8369 $root/var/sadm/install/contents)
8370 for manpage in $opensslman
8372 rm -f $root/$manpage
8373 done
8376 if [[ $datalink_action = "save" ]]; then
8377 cp -p $datalink_file $datalink_backup
8378 elif [[ $datalink_action = "restore" && -f $datalink_backup ]]; then
8379 mv $datalink_backup $datalink_file
8382 # End of pre-archive extraction hacks.
8384 if [ $diskless = no -a $zone = global ]; then
8385 # extract both /platform and /usr/platform bootblks
8386 # for compatibility with older bootblk delivery
8387 print "Extracting platform $rootfstype modules for boot " \
8388 "block ... \c" | tee -a $EXTRACT_LOG
8389 do_extraction $cpiodir/$karch.root$ZFIX \
8390 'platform/'$karch'/lib/fs/'$rootfstype'/*' | \
8391 tee -a $EXTRACT_LOG
8392 print "Extracting usr/platform $rootfstype modules for boot " \
8393 "block ... \c" | tee -a $EXTRACT_LOG
8394 do_extraction $cpiodir/$karch.usr$ZFIX \
8395 'usr/platform/'$karch'/lib/fs/'$rootfstype'/*' | \
8396 tee -a $EXTRACT_LOG
8397 case $target_isa in
8398 sparc)
8399 if [[ "$rootfstype" = zfs ]]; then
8400 print "Extracting usr/sbin/installboot for " \
8401 "zfs boot block installation ... \c" |
8402 tee -a $EXTRACT_LOG
8403 do_extraction $cpiodir/generic.usr$ZFIX \
8404 'usr/sbin/installboot' | \
8405 tee -a $EXTRACT_LOG
8406 cd $usr/platform/$karch/lib/fs/zfs
8407 get_rootdev_list | while read physlice
8409 print "Installing bootblk on $physlice."
8410 $usr/sbin/installboot -F zfs ./bootblk \
8411 $physlice
8412 done
8413 elif [[ "$rootslice" = /dev/rdsk/* ]]; then
8414 print "Installing boot block on $rootslice."
8415 cd $usr/platform/$karch/lib/fs/ufs
8416 installboot ./bootblk $rootslice
8417 elif [[ "$rootslice" = /dev/md/rdsk/* ]]; then
8418 print "Detected SVM root."
8419 cd $usr/platform/$karch/lib/fs/ufs
8420 get_rootdev_list | while read physlice
8422 print "Installing bootblk on $physlice."
8423 installboot ./bootblk $physlice
8424 done
8427 i386)
8428 print "Extracting grub for boot " \
8429 "block ... \c" | tee -a $EXTRACT_LOG
8430 do_extraction $cpiodir/$karch.boot$ZFIX | \
8431 tee -a $EXTRACT_LOG
8432 $rootprefix/boot/solaris/bin/update_grub -R $root
8435 ;; # unknown ISA
8436 esac
8439 if [ $diskless = yes ]; then
8440 node=${root##*/}
8441 archlist=""
8442 for arch in $allarchs
8444 egrep -s '/export/exec/.*'$arch'/usr/kvm' \
8445 $root/etc/vfstab ||
8446 test -d $root/platform/$arch &&
8447 archlist="$archlist $arch"
8448 done
8449 if [ -z "$old_style_archives" ]; then
8450 extract_archives lib generic
8451 extract_archives sbin generic
8452 extract_archives kernel generic
8454 extract_archives root generic $archlist
8455 if [ $target_isa = i386 ]; then
8456 extract_boot_archives boot $archlist
8457 elif [ $newboot_sparc = yes ]; then
8458 extract_boot_archives boot generic
8460 else
8461 export PATH=/tmp/bfubin
8462 node=`uname -n`
8463 if [ $zone = global ]; then
8464 extract_archives usr generic $usrarchs
8465 if [ -z "$old_style_archives" ]; then
8466 extract_archives lib generic
8467 extract_archives sbin generic
8468 extract_archives kernel generic
8470 extract_archives root generic $rootarchs
8471 if [ $target_isa = i386 ]; then
8473 # The assumption here is that if boot
8474 # archives exist at all, they only exist
8475 # for architectures where we also have
8476 # .root archives.
8478 extract_boot_archives boot $rootarchs
8479 elif [ $newboot_sparc = yes ]; then
8480 extract_boot_archives boot generic
8482 else
8483 dir_is_inherited usr ||
8484 extract_archives usr generic $usrarchs
8485 dir_is_inherited lib ||
8486 extract_archives lib generic
8487 dir_is_inherited sbin ||
8488 extract_archives sbin generic
8489 dir_is_inherited platform &&
8490 extract_archives root generic ||
8491 extract_archives root generic $rootarchs
8495 touch reconfigure
8498 # UltraSparc III platforms have aes module in platform directory
8500 if [ ! -f $root/platform/$plat/kernel/crypto/sparcv9/aes ]; then
8501 rm -f $root/platform/sun4u-us3/kernel/crypto/sparcv9/aes
8502 rm -f $root/platform/sun4u-us3/kernel/crypto/sparcv9/aes256
8506 # remove platform specific rsa module obsoleted by the bignum module
8509 rm -f $root/platform/sun4u/kernel/crypto/sparcv9/rsa
8511 if [ $zone = global ]; then
8512 print "\nRemoving duplicate kernel binaries ..."
8514 # First, find all regular files underneath the */kernel
8515 # directories we extracted, and mark them as older or newer
8516 # than our reference file -- if newer, they were extracted
8517 # during the bfu.
8519 # We then split out the pre-/kernel part from the post-/kernel
8520 # part, sort by post-/kernel part and age (new first), and
8521 # delete old files which have new counterparts.
8523 dirs="$rootprefix/kernel $usr/kernel"
8524 for plat in $archlist $rootarchs $usrarchs; do
8525 dir=$rootprefix/platform/$plat/kernel
8526 [[ -d $dir ]] && dirs="$dirs $dir"
8527 done
8529 age=new
8530 ls -ct $time_ref `find $dirs -type f 2>/dev/null` | uniq |
8531 while read f; do
8532 if [[ $f = $time_ref ]] then
8533 age=old
8534 else
8535 echo $age $f
8537 done |
8538 sed 's@\(.*/kernel\)/@\1 @' | sort -k 3 -k 1 | nawk '
8539 /^new/ { lastname = $3 }
8540 /^old/ { if (lastname == $3) { print $2 "/" $3 } }
8541 ' | while read x; do
8542 echo "rm $x"
8543 rm $x
8544 done
8547 echo
8550 # Change permissions of public IKE certificates and CRLs
8551 # that may have been incorrectly created as private
8552 # PKCS#11 hints files must be left root-only readable.
8553 # Make sure this files starts with "30 82"
8555 for file in `ls $rootprefix/etc/inet/ike/crls/* \
8556 $rootprefix/etc/inet/ike/publickeys/* 2>/dev/null`; do
8557 if od -tx1 -N3 < $file | grep '30 82' >/dev/null 2>&1
8558 then
8559 chmod 644 $file
8561 done
8564 # Remove EOF Crypto packages
8565 crypto_cleanup
8567 # Add uCF's metaslot feature
8568 if [ -f $rootprefix/etc/crypto/pkcs11.conf ] ; then
8569 enable_crypto_metaslot
8572 # Cleanup old Kerberos mechanisms
8573 cleanup_kerberos_mechanisms
8575 # Cleanup old RBAC profiles
8576 rbac_cleanup
8578 # Obsolete GLDv3 /etc/datalink.conf file".
8579 if [[ $zone = global && -f $rootprefix/etc/datalink.conf ]]; then
8580 rm -f $rootprefix/etc/datalink.conf
8583 # Remove EOF NIS+
8584 if [ -d $rootprefix/var/nis -o \
8585 -d $usr/lib/nis ]; then
8586 print "Disabling NIS+ ..."
8587 svcadm disable network/rpc/nisplus
8588 remove_eof_nisplus
8592 # Force xVM privilege fixups to occur on next boot.
8594 rm -f $rootprefix/var/lib/xend/.xvmuser
8596 print "\nRestoring configuration files.\n"
8598 cd $root
8599 rm -rf bfu.ancestor
8600 test -d bfu.parent && mv bfu.parent bfu.ancestor
8601 mkdir bfu.parent
8602 print "Restoring configuration files ... \c" >> $EXTRACT_LOG
8603 filelist $zone | cpio -pdmu bfu.parent 2>>$EXTRACT_LOG || \
8604 extraction_error "restoring configuration files"
8605 if [ $multi_or_direct = no ]; then
8606 if [ $have_realmode = yes ]; then
8607 if [ -d bfu.realmode ]; then
8608 ( cd bfu.realmode ; realmode_filelist | \
8609 cpio -pdmu ../bfu.ancestor 2>/dev/null )
8610 rm -rf bfu.realmode
8612 mkdir bfu.realmode
8613 ( cd bfu.parent ; realmode_filelist | \
8614 cpio -pdmu ../bfu.realmode 2>/dev/null )
8615 else
8616 for file in $realmode_files
8618 rm -rf bfu.parent/$file
8619 done
8623 cd bfu.child
8624 for file in `filelist $zone`
8626 # parent: freshly-BFUed version
8627 # child: pre-BFU version
8628 # ancestor: installed from archives the last time you BFUed
8629 # actual: in the root filesystem at this moment (same as parent)
8631 parent=$rootprefix/bfu.parent/$file
8632 child=$rootprefix/bfu.child/$file
8633 ancestor=$rootprefix/bfu.ancestor/$file
8634 conflicts=$rootprefix/bfu.conflicts/$file
8635 actual=$rootprefix/$file
8637 # if a superfluous-to-local-zones file was blown away, skip it
8638 [ -f $actual ] || continue
8640 # if there's been no change by the BFU, skip it
8641 cmp -s $child $actual && continue
8643 # if the file was not installed by the BFU, skip it
8644 [ -f $parent ] || continue
8646 # if this is a file which should never be updated by BFU,
8647 # preserve the original (child) version
8648 if (echo $preserve_files | grep $file >/dev/null 2>&1)
8649 then
8650 print " preserve: $file"
8651 cp -p $child $actual
8652 continue
8655 # if the file was accepted from the parent on the last BFU,
8656 # then accept it again this time without argument. Or, if
8657 # this is the first bfu after an standard Solaris install
8658 # or upgrade, compare the file to one installed from packages.
8659 # If it hasn't been modified since installation, accept
8660 # the file from the parent.
8661 if [ -f $ancestor ] ; then
8662 if cmp -s $child $ancestor; then
8663 print " update: $file"
8664 continue
8666 elif [ "$firstbfu" = "yes" ] ; then
8667 installedsum=$(grep "^/$file " \
8668 $rootprefix/var/sadm/install/contents |
8669 awk '{ print $8 }')
8670 if [ -n "$installedsum" ] ; then
8671 actualsum=`sum $child | sed 's/ .*//'`
8672 if [ "$installedsum" -eq "$actualsum" ] ; then
8673 print " update: $file"
8674 continue
8679 # if the BFU'ed file is the same as the beginning of the
8680 # pre-BFUed file, assume the user has added lines to the
8681 # end, and restore the pre-BFUed version
8682 if (cmp $child $parent 2>&1) | egrep -s 'EOF on '$parent; then
8683 print " restore: $file"
8684 cp -p $child $actual
8685 continue
8688 # if the new version is the same as it was the last time
8689 # BFU was run, but still different than the pre-BFU version,
8690 # this is an "old" conflict; otherwise, it's a "NEW"
8691 # conflict. Old conflicts can usually be safely ignored.
8692 if cmp -s $parent $ancestor; then
8693 print "old \c"
8694 else
8695 print "NEW \c"
8696 print $file >>$rootprefix/bfu.conflicts/NEW
8699 print "conflict: $file"
8700 (cd $root; print $file | cpio -pdmu bfu.conflicts 2>/dev/null)
8702 # for all conflicts, restore the pre-BFU version and let
8703 # the user decide what to do.
8704 cp -p $child $actual
8705 done
8708 # Add build_class_script_files to NEW
8709 # Don't add the file to bfu.conflict since the private script from
8710 # the pkg takes care of the update.
8712 for bldscript in $build_class_script_files; do
8713 print "NEW \c"
8714 print $bldscript >>$rootprefix/bfu.conflicts/NEW
8715 print "conflict: $bldscript"
8716 done
8718 if [ $zone = global ]; then
8720 # correct permissions using /etc/minor_perm from the parent and
8721 # child, prefer parent.
8723 mperm=$rootprefix/etc/minor_perm
8724 pmperm=$rootprefix/bfu.parent/etc/minor_perm
8725 if [ -f $pmperm ]
8726 then
8727 mperm="$pmperm $mperm"
8731 # Devices with changed permissions should be added here much
8732 # like in i.minorperm. The "ssm" devices are special in that
8733 # they have no /dev links associated with them.
8735 while read minor dev
8736 do (
8737 set -- `fgrep -h "$minor" $mperm` "";
8738 if [ ! -z "$2" ]
8739 then
8740 chmod $2 $rootprefix/dev/$dev 2>/dev/null
8741 chown $3:$4 $rootprefix/dev/$dev 2>/dev/null
8743 ) done <<-EOF
8744 ssm:* ../devices/ssm*:*
8745 cpc:shared ../devices/pseudo/cpc*
8746 icmp:icmp icmp
8747 icmp6:icmp6 icmp6
8748 ip:ip ip
8749 ip6:ip6 ip6
8750 rts:rts rts
8751 keysock:keysock keysock
8752 ipsecah:ipsecah ipsecah
8753 ipsecesp:ipsecesp ipsecesp
8754 spdsock:spdsock spdsock
8755 sad:admin sad/admin
8756 fssnap:ctl fssnapctl
8757 fssnap:* fssnap/*
8758 clone:ce ce
8759 clone:eri eri
8760 clone:ge ge
8761 clone:hme hme
8762 clone:qfe qfe
8763 clone:bge bge
8764 bge:* bge*
8765 clone:dmfe dmfe
8766 dmfe:* dmfe*
8767 clone:dnet dnet
8768 dnet:* dnet*
8769 clone:elxl elxl
8770 elxl:* elxl*
8771 clone:iprb iprb
8772 iprb:* iprb*
8773 clone:spwr spwr
8774 spwr:* spwr*
8775 clone:afe afe
8776 afe:* afe*
8777 clone:mxfe mxfe
8778 mxfe:* mxfe*
8779 clone:rtls rtls
8780 rtls:* rtls*
8781 nsmb:* nsmb*
8784 if [ $target_isa = i386 ] && [[ $rootfstype = zfs || \
8785 $rootslice = /dev/rdsk/* || \
8786 $rootslice = /dev/md/rdsk/* ]]; then
8787 check_boot_env
8791 # update boot archives for new boot sparc
8793 if [ $newboot_sparc = yes ] && \
8794 [[ $rootfstype = zfs || $rootslice = /dev/rdsk/* ||
8795 $rootslice = /dev/md/rdsk/* ]]; then
8796 build_boot_archive
8797 install_sparc_failsafe
8800 # Check for damage due to CR 6379341. This was actually fixed
8801 # back in snv_24, but users BFUing from an S10 build up to
8802 # Nevada can still encounter it.
8803 rzi=$root/etc/zones/index
8804 if [ -f $rzi ]; then
8805 # Look for duplicated UUIDs. If there are any, then
8806 # just wipe them out.
8807 if nawk -F: '
8808 /^\#/ || NF != 4 { print $0; next; }
8810 if (flags[$4])
8811 sub(/:[-0-9a-z]*$/,":");
8812 print $0;
8813 flags[$4]=1;
8815 ' < $rzi > ${rzi}.bfu.$$; then
8816 if cmp -s $rzi ${rzi}.bfu.$$; then
8817 rm -f ${rzi}.bfu.$$
8818 else
8819 chown root:sys ${rzi}.bfu.$$
8820 chmod 644 ${rzi}.bfu.$$
8821 mv ${rzi}.bfu.$$ $rzi
8823 else
8824 rm -f ${rzi}.bfu.$$
8828 if [[ $dlmgmtd_status = new ]]; then
8829 # Upgrade existing /etc/aggregation.conf (or
8830 # /etc/dladm/aggregation.conf) and linkprop.conf
8831 upgrade_aggr_and_linkprop
8832 else
8833 # Move existing /etc/aggregation.conf entries to
8834 # /etc/dladm/aggregation.conf; or, if bfu'ing
8835 # backwards, move aggregation.conf back to /etc
8836 aggr_old=$rootprefix/etc/aggregation.conf
8837 aggr_new=$rootprefix/etc/dladm/aggregation.conf
8838 if [[ $new_dladm = yes ]]; then
8839 if [[ -f $aggr_old ]]; then
8840 # use cat instead of cp/mv to keep
8841 # owner+group of dest
8842 cat $aggr_old > $aggr_new
8843 rm -f $aggr_old
8845 elif [[ -f $aggr_new ]]; then
8846 cp $aggr_new $aggr_old
8847 chgrp sys $aggr_old
8848 rm -rf $rootprefix/etc/dladm
8852 # upgrade hostname and zones based vlans to dladm
8853 if [[ $flowadm_status == "new" ]]; then
8854 upgrade_vlan
8857 # The global zone needs to have its /dev/dld symlink created
8858 # during install so that processes can access it early in boot
8859 # before devfsadm is run. Likewise for /dev/ipmpstub.
8860 if [ ! -L $rootprefix/dev/dld ]; then
8861 ln -s ../devices/pseudo/dld@0:ctl $rootprefix/dev/dld
8863 if [ ! -L $rootprefix/dev/ipmpstub ]; then
8864 ln -s ../devices/pseudo/dlpistub@0:ipmpstub \
8865 $rootprefix/dev/ipmpstub
8869 # Fix up audit & /etc/inet config file permissions
8870 fix_up_perms
8872 # Remove bsmrecord. Renamed to auditrecord.
8873 rm -f $root/usr/sbin/bsmrecord
8875 # Remove old fips-140 entry from kcf.conf
8876 if [ -f $rootprefix/etc/crypto/kcf.conf ] ; then
8877 cleanup_kcf_fips140
8880 print "\nFor each file in conflict, your version has been restored."
8881 print "The new versions are under $rootprefix/bfu.conflicts."
8882 print "\nMAKE SURE YOU RESOLVE ALL CONFLICTS BEFORE REBOOTING.\n"
8883 if [ $multi_or_direct = yes ]; then
8884 print "To install resolved changes required for reboot in the boot"
8885 print "archive, invoke 'bootadm update-archive${cr_args}'\n"
8888 if [ $zone != global ]; then
8889 print "Resolve conflicts in the global zone first. Many of"
8890 print "the conflicts in non-global zones can be resolved by"
8891 print "copying the corresponding file from the global zone.\n"
8892 else
8893 fixup_mpxio
8896 # If we're bfuing backward across PSARC/2006/248, then
8897 # revert the /etc/aggregation.conf to its old format.
8899 if [ -f $rootprefix/etc/aggregation.conf -a \
8900 ! -d $rootprefix/kernel/mac -a \
8901 $from_new_aggrconf = 1 ]; then
8902 revert_aggregation_conf
8906 cd $root
8908 smf_apply_conf
8910 update_policy_conf
8912 tx_check_bkbfu
8914 fixup_isa_bfu
8916 update_aac_conf
8918 update_etc_inet_sock2path
8920 if [ $target_isa = i386 ]; then
8921 update_mptconf_i386
8923 update_etc_mach_i386
8926 if [ $target_isa = i386 ]; then
8927 update_drvclass_i386
8930 if [ $zone != global ]; then
8931 rm -rf $global_zone_only_files $superfluous_nonglobal_zone_files
8934 print "bfu'ed from $cpiodir on `date +%Y-%m-%d`" >>etc/motd
8935 tail +`nawk '/bfu.ed from/ { x=NR }; END { print x+1 }' \
8936 etc/motd.old` etc/motd.old >> etc/motd
8939 # Hacks to work around minor annoyances and make life more pleasant.
8940 # Part 2 of 2: post-archive-extraction stuff
8943 rm -f var/statmon/state # to prevent lockd/statd hangs
8944 for f in etc/auto_* # to make autofs happy
8946 file $f | grep executable >/dev/null || chmod -x $f
8947 done
8949 epilogue=$rootprefix/bfu.epilogue
8950 if [ -f $epilogue ]; then
8951 print "Executing $epilogue"
8952 $epilogue || print "WARNING: $epilogue failed with code $?"
8956 # Emit notice about upgrading the audio sub-system
8958 if $BOOMER_PRESENT_BFU && ! $BOOMER_PRESENT_SYS; then
8959 print
8960 print "NOTICE: you must run the 'update_audio' script (from"
8961 print "${GATE}/public/bin) to complete the upgrade of "
8962 print "the audio sub-system"
8963 print
8966 ((seconds = SECONDS))
8967 ((min = seconds / 60))
8968 ((sec = seconds % 60))
8970 if [ $zone = global ]; then
8971 target=$node
8972 else
8973 target=$zone
8975 printf "Upgrade of $target took ${min}:%02d.\n" $sec
8978 # Do logging in the background so that if the automounter is gone,
8979 # bfu doesn't wedge at this point.
8981 log=$GATE/public/bfu.log
8982 (test -w $log && printf \
8983 "`date +%Y'%'m%d` $node `uname -rv` $karch $cpiodir ${min}:%02d\n" \
8984 $sec >>$log) &
8988 # make sure the time reference is older than anything extracted
8990 test $time_ref_seconds -eq $SECONDS && sleep 1
8992 test $diskless = yes && extract_archives usr generic $allarchs
8994 for root in $rootlist
8996 mondo_loop $root global
8997 lastroot=$root
8998 done
9000 if [ -s "$bfu_zone_list" ]; then
9001 cat "$bfu_zone_list" | while read zone zonepath; do
9002 print "\nNow for zone $zone..."
9003 mondo_loop $zonepath/root $zone
9004 done
9006 rm -f "$bfu_zone_list"
9009 print "Turning off delayed i/o and syncing filesystems ..."
9010 sync
9011 fastfs -s $rootlist $usr
9012 fastfs $rootlist $usr
9013 sync
9014 lockfs -f $rootlist $usr
9016 egrep -s "^error " $EXTRACT_LOG
9017 if [ $? -eq 0 ]; then
9018 print "\nWARNING: archive extraction errors occurred.\n"
9019 print "See $EXTRACT_LOG for details.\n"
9022 lastrootprefix=${lastroot%/}
9024 if [ -t 0 -a -t 1 -a -t 2 ]; then
9025 print "\nEntering post-bfu protected environment (shell: ksh)."
9026 print "Edit configuration files as necessary, then reboot.\n"
9027 cd $lastrootprefix/bfu.conflicts
9028 PS1='bfu# ' ksh -ip
9031 print "Exiting post-bfu protected environment. To reenter, type:"
9032 print LD_NOAUXFLTR=1 LD_LIBRARY_PATH=/tmp/bfulib $ldlib64 PATH=/tmp/bfubin \
9033 /tmp/bfubin/ksh
9035 exit 0