src/brand/poststate
changeset 2390 f1c659f5c28e
parent 2235 1f446820dcb0
equal deleted inserted replaced
2235:1f446820dcb0 2390:f1c659f5c28e
    19 #
    19 #
    20 # CDDL HEADER END
    20 # CDDL HEADER END
    21 #
    21 #
    22 
    22 
    23 #
    23 #
    24 # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    24 # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
    25 #
    25 #
    26 
    26 
    27 . /usr/lib/brand/ipkg/common.ksh
    27 . /usr/lib/brand/ipkg/common.ksh
    28 
    28 
    29 # States
    29 # States
    46 ZONEPATH=$2
    46 ZONEPATH=$2
    47 state=$3
    47 state=$3
    48 cmd=$4
    48 cmd=$4
    49 ALTROOT=$5
    49 ALTROOT=$5
    50 
    50 
    51 typeset zone
       
    52 init_zone zone "$ZONENAME" "$ZONEPATH"
       
    53 eval $(bind_legacy_zone_globals zone)
       
    54 
       
    55 # If we're not halting the zone, then just return.
    51 # If we're not halting the zone, then just return.
    56 if [ $cmd -eq 4 ]; then
    52 if [ $cmd -eq 4 ]; then
    57 	is_brand_labeled	# Note: return value is C-style, not shell-style
    53 	is_brand_labeled
    58 	if (( $? == 0 )); then
    54 	if (( $? == 0 )); then
    59 		# Leave the active boot environment mounted after halting (this
    55 		# Leave the active dataset mounted after halting (this might be
    60 		# might be a different dataset than what was mounted).
    56 		# a different dataset than what was mounted).
    61 		mount_active_be -c zone
    57 		mount_active_ds
    62 	else
    58 	else
    63 		# Umount dataset on the root.
    59 		# Umount dataset on the root.
    64 		unmount_be zone
    60 		zoneroot="$ZONEPATH/root"
       
    61 		umount $zoneroot || printf "$f_zfs_unmount" "$zoneroot"
    65 	fi
    62 	fi
    66 fi
    63 fi
    67 
    64 
    68 exit $ZONE_SUBPROC_OK
    65 exit $ZONE_SUBPROC_OK