src/brand/p2v
changeset 2391 90c532b69592
parent 2339 aa5954c06b9d
parent 2390 f1c659f5c28e
equal deleted inserted replaced
2389:30ea7b982e91 2391:90c532b69592
    26 
    26 
    27 # NOTE: this script runs in the global zone and touches the non-global
    27 # NOTE: this script runs in the global zone and touches the non-global
    28 # zone, so care should be taken to validate any modifications so that they
    28 # zone, so care should be taken to validate any modifications so that they
    29 # are safe.
    29 # are safe.
    30 
    30 
    31 #
    31 # Restrict executables to /usr/bin and /usr/sbin
    32 # Only change PATH if you give full consideration to GNU or other variants
    32 PATH=/usr/bin:/usr/sbin
    33 # of common commands having different arguments and output.  Setting PATH is
    33 export PATH
    34 # and not using the full path to executables provides a performance improvement
       
    35 # by using the ksh builtin equivalent of many common commands.
       
    36 #
       
    37 export PATH=/usr/bin:/usr/sbin
       
    38 unset LD_LIBRARY_PATH
    34 unset LD_LIBRARY_PATH
    39 
    35 
    40 . /usr/lib/brand/ipkg/common.ksh
    36 . /usr/lib/brand/ipkg/common.ksh
    41 
    37 
    42 # Allows developer to override some things like PATH and PYTHONPATH
    38 # Allows developer to override some things like PATH and PYTHONPATH
   353 shift OPTIND-1
   349 shift OPTIND-1
   354 
   350 
   355 (( $# != 2 )) && exit 1
   351 (( $# != 2 )) && exit 1
   356 
   352 
   357 [[ -n $LOGFILE ]] && exec 2>>$LOGFILE
   353 [[ -n $LOGFILE ]] && exec 2>>$LOGFILE
   358 init_zone zone "$1" "$2"
   354 
   359 eval $(bind_legacy_zone_globals zone)
   355 ZONENAME=$1
       
   356 ZONEPATH=$2
       
   357 ZONEROOT=$ZONEPATH/root
   360 
   358 
   361 e_badinfo=$(gettext "Failed to get '%s' zone resource")
   359 e_badinfo=$(gettext "Failed to get '%s' zone resource")
   362 e_badfile=$(gettext "Invalid '%s' file within the zone")
   360 e_badfile=$(gettext "Invalid '%s' file within the zone")
   363 e_tmpfile=$(gettext "Unable to create temporary file")
   361 e_tmpfile=$(gettext "Unable to create temporary file")
   364 v_mkdirs=$(gettext "Creating mount points")
   362 v_mkdirs=$(gettext "Creating mount points")
   466 is_brand_labeled
   464 is_brand_labeled
   467 brand_labeled=$?
   465 brand_labeled=$?
   468 if (( $brand_labeled == 1 )); then
   466 if (( $brand_labeled == 1 )); then
   469 	# The labeled brand needs to mount the zone's root dataset back onto
   467 	# The labeled brand needs to mount the zone's root dataset back onto
   470 	# ZONEROOT so we can finish processing.
   468 	# ZONEROOT so we can finish processing.
   471 	mount_active_be zone
   469 	mount_active_ds
   472 fi
   470 fi
   473 
   471 
   474 #
   472 #
   475 # Update the image format before running other commands so that they are not
   473 # Update the image format before running other commands so that they are not
   476 # thrown off by having old image metadata.
   474 # thrown off by having old image metadata.
   502 zoneadm -z $ZONENAME mark incomplete || fatal "$e_badupdate"
   500 zoneadm -z $ZONENAME mark incomplete || fatal "$e_badupdate"
   503 log "$v_updatedone"
   501 log "$v_updatedone"
   504 
   502 
   505 [[ -n $OPT_U ]] && unconfigure_zone
   503 [[ -n $OPT_U ]] && unconfigure_zone
   506 
   504 
   507 (( $brand_labeled == 1 )) && mount_active_be zone
   505 (( $brand_labeled == 1 )) && mount_active_ds
   508 
   506 
   509 trap - EXIT
   507 trap - EXIT
   510 vlog "$v_exitgood"
   508 vlog "$v_exitgood"
   511 exit 0
   509 exit 0