6535942 bfu and acr don't tolerate non-native zones other than 'lx'
authordp
Mon, 02 Apr 2007 15:52:18 -0700
changeset 3948 b8d304c37bf9
parent 3947 ed1a1295c374
child 3949 2a9ed1f05369
6535942 bfu and acr don't tolerate non-native zones other than 'lx'
usr/src/tools/scripts/acr.sh
usr/src/tools/scripts/bfu.sh
--- a/usr/src/tools/scripts/acr.sh	Mon Apr 02 12:11:24 2007 -0700
+++ b/usr/src/tools/scripts/acr.sh	Mon Apr 02 15:52:18 2007 -0700
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #ident	"%Z%%M%	%I%	%E% SMI"
@@ -91,7 +91,7 @@
 # This file is left over (on purpose) by BFU so that in a post-BFU environment
 # we know which zones BFU processed.
 #
-local_zone_info_file=$root/.bfu_local_zone_info
+bfu_zone_list=$root/.bfu_zone_list
 
 get_cr_archive() {
 	compressed_archive=$archivedir/conflict_resolution.gz
@@ -321,16 +321,17 @@
 }
 
 #
-# If we're post-BFU, then BFU should have left us a file listing
-# which zones it processed.  If we're not post-BFU, just process
-# all installed zones.
+# If we're post-BFU, then BFU should have left us a file listing which zones it
+# processed.  If we're not post-BFU, just process all installed native and
+# Sn-1 zones.
 #
 if [ $bfu_alt_reality = "false" ]; then
 	zoneadm list -pi | nawk -F: '{
-		if ($3 == "installed" && $6 != "lx") {
+		if ($3 == "installed" &&
+		    ($6 == "native" || $6 == "" || $6 == "sn1")) {
 			printf "%s %s\n", $2, $4
 		}
-	}' > $local_zone_info_file
+	}' > $bfu_zone_list
 fi
 
 #
@@ -341,8 +342,8 @@
 if [ -s $root/bfu.conflicts/NEW ]; then
 	need_resolve=true
 else
-	if [ -s $local_zone_info_file ]; then
-		cat $local_zone_info_file | while read zone zonepath; do
+	if [ -s $bfu_zone_list ]; then
+		cat $bfu_zone_list | while read zone zonepath; do
 			if [ -s $zonepath/root/bfu.conflicts/NEW ] ; then
 				need_resolve=true
 			fi
@@ -363,8 +364,8 @@
 if [ $root != "/" ]; then
 	printf "\nSkipping non-global zones (root is not /)"
 else
-	if [ -s $local_zone_info_file ]; then
-		cat $local_zone_info_file | while read zone zonepath; do
+	if [ -s $bfu_zone_list ]; then
+		cat $bfu_zone_list | while read zone zonepath; do
 			printf "\nProcessing zone $zone:\t"
 			acr_a_root $zonepath/root $zone
 		done
--- a/usr/src/tools/scripts/bfu.sh	Mon Apr 02 12:11:24 2007 -0700
+++ b/usr/src/tools/scripts/bfu.sh	Mon Apr 02 15:52:18 2007 -0700
@@ -227,13 +227,13 @@
 
 #
 # Third list: files extracted from generic.root but which belong in the global
-# zone only: they are superfluous (and some even harmful) in local zones.
+# zone only: they are superfluous (and some even harmful) in nonglobal zones.
 #
 # (note: as /etc/init.d scripts are converted to smf(5) "Greenline" services,
 # they (and their /etc/rc?.d hardlinks) should be removed from this list when
 # they are added to smf_obsolete_rc_files, below)
 #
-superfluous_local_zone_files="
+superfluous_nonglobal_zone_files="
 	dev/dsk
 	dev/fd
 	dev/pts
@@ -403,7 +403,7 @@
 fail() {
 	print "$*" >& 2
 	print "bfu aborting" >& 2
-	rm -f "$local_zone_info_file"
+	rm -f "$bfu_zone_list"
 	exit 1
 }
 
@@ -1950,7 +1950,7 @@
 
 if [ -x /usr/bin/ppriv ]; then
 	# We prefer to use ppriv, as it is a more accurate test, and also
-	# has the benefit of preventing use from within a local zone.
+	# has the benefit of preventing use from within a nonglobal zone.
 	ppriv $$ | grep -w "E: all" > /dev/null 2>&1 || \
 	    fail "bfu requires all privileges"
 else
@@ -2012,7 +2012,7 @@
 	rootlist=$root
 
 	[[ -f $root/etc/system ]] || \
-	    fail "$root/etc/system not found; local zone target not allowed"
+	    fail "$root/etc/system not found; nonglobal zone target not allowed"
 
 	if [ -f $root/boot/platform/i86pc/kernel/unix ]; then
 		failsafe_type=directboot
@@ -3975,14 +3975,15 @@
 		# the zone configuration to become unreadable (e.g., via a
 		# DTD flag day).
 		#
-		local_zone_info_file=$root/.bfu_local_zone_info
-		rm -f $local_zone_info_file
+		bfu_zone_list=$root/.bfu_zone_list
+		rm -f $bfu_zone_list
 
 		zoneadm list -pi | nawk -F: '{
-			if ($3 == "installed") {
+			if ($3 == "installed" &&
+			    ($6 == "native" || $6 == "" || $6 == "sn1")) {
 				printf "%s %s\n", $2, $4
 			}
-		}' > $local_zone_info_file
+		}' > $bfu_zone_list
 	fi
 
 	#
@@ -6431,7 +6432,7 @@
 
 	#
 	# Nuke the nfsauth headers when we're working with the 'global'
-	# or a fully populated local zone. The cpio archive will lay the
+	# or a fully populated nonglobal zone. The cpio archive will lay the
 	# right one to match mountd(1m)'s comm method w/the kernel (via
 	# kRPC or Doors/XDR).
 	#
@@ -6944,7 +6945,7 @@
 	update_policy_conf
 
 	if [ $zone != global ]; then
-		rm -rf $global_zone_only_files $superfluous_local_zone_files
+		rm -rf $global_zone_only_files $superfluous_nonglobal_zone_files
 	fi
 
 	print "bfu'ed from $cpiodir on `date +%Y-%m-%d`" >>etc/motd
@@ -7002,21 +7003,15 @@
 	lastroot=$root
 done
 
-if [ -s "$local_zone_info_file" ]; then
-	cat "$local_zone_info_file" | while read zone zonepath; do
-		#
-		# Ignore linux zones
-		#
-		if [ -z `grep "brand=\"lx\"" /etc/zones/$zone.xml` ]; then
-			print "\nNow for zone $zone..."
-			mondo_loop $zonepath/root $zone
-		fi
+if [ -s "$bfu_zone_list" ]; then
+	cat "$bfu_zone_list" | while read zone zonepath; do
+		print "\nNow for zone $zone..."
+		mondo_loop $zonepath/root $zone
 	done
 
 	#
-	# Normally we would clean up $local_zone_info_file but instead
-	# we leave it behind for ACR to locate and use inside the BFU
-	# alternate reality environment.
+	# Normally we would clean up $bfu_zone_list but instead we leave it
+	# behind for ACR to locate and use inside the BFU alternate reality.
 	#
 fi