#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
# NOTE: this script runs in the global zone and touches the non-global
# zone, so care should be taken to validate any modifications so that they
# are safe.
#
# Only change PATH if you give full consideration to GNU or other variants
# of common commands having different arguments and output.
#
unset LD_LIBRARY_PATH
# Allows developer to override some things like PATH and PYTHONPATH
set -A save_args "$0" "$@"
# Clean up on failure
{
fi
vlog "Exiting with exit code $EXIT_CODE"
exit $EXIT_CODE
}
#
# Comment out most of the old mounts since they are either unneeded or
# likely incorrect within a zone. Specific mounts can be manually
# reenabled if the corresponding device is added to the zone.
#
{
error "$e_badfile" "/etc/vfstab"
return
fi
return
fi
nawk '{
if (substr($1, 0, 1) == "#") {
print $0
} else if ($1 == "fd" || $1 == "/proc" || $1 == "swap" ||
$1 == "ctfs" || $1 == "objfs" || $1 == "sharefs" ||
$4 == "nfs" || $4 == "lofs") {
print $0
} else {
print "#", $0
modified=1
}
}
END {
if (modified == 1) {
printf("# Modified by p2v ")
exit 0
}
exit 1
if (( $? == 0 )); then
if [[ ! -f $ZONEROOT/etc/vfstab.pre_p2v ]]; then
fi
fi
}
#
# Delete or disable SMF services.
#
{
#
# Fix network services if shared stack.
#
NETPHYSDEF="svc:/network/physical:default"
NETPHYSNWAM="svc:/network/physical:nwam"
>>$SMF_UPGRADE" </dev/null
"echo /usr/sbin/svcadm disable $NETPHYSNWAM \
>>$SMF_UPGRADE" </dev/null
# Disable routing svcs.
>>$SMF_UPGRADE" </dev/null
fi
#
# Disable well-known services that don't run in a zone.
#
do
# Disable the svc.
done
}
#
# Remove well-known pkgs that do not work inside a zone.
#
{
do
if (( $? != 0 )); then
continue
fi
done
}
#
# Parse the command line options.
#
while getopts "v" opt
do
v) # Used by vlog()
OPT_V="-v"
;;
*) fail_usage ""
;;
esac
done
shift OPTIND-1
# If fixing up the image fails, force an uninstall.
eval $(bind_legacy_zone_globals zone)
#
# failure should unmount the zone if necessary;
#
#
# Do some validation on the paths we'll be accessing
#
# If these paths exist, they must be directories. If they don't exist,
# they will be created below.
# Now do the work to update the zone.
# Before booting the zone we may need to create a few mnt points, just in
# case they don't exist for some reason.
#
# Whenever we reach into the zone while running in the global zone we
# need to validate that none of the interim directories are symlinks
# that could cause us to inadvertently modify the global zone.
fi
fi
fi
fi
fi
fi
fi
fi
# Check for zones inside of image.
if (( $? != 0 )); then
error "$e_badinfo" "stacktype"
fi
# Note that we're doing this before update-on-attach has run.
#
# Mount the zone so that we can do all of the updates needed on the zone.
#
#
# Any errors in these functions are not considered fatal. The zone can be
# be fixed up manually afterwards and it may need some additional manual
# cleanup in any case.
#
# cleanup SMF services
# remove invalid pkgs
# If anything below here fails, a subsequent attach can likely fix it up.
#
# This is unintuitive: The call to 'zoneadm unmount' tears down the scratch
# zone. Upon completion of 'zoneadm unmount' the zone is in the same state
# that it would be in after 'zoneadm sysboot'. That is, brands other than
# labeled have the complete active ZBE mounted on the zone root.
#
if is_brand_labeled; then
# The labeled brand needs to mount the zone's root dataset back onto
# ZONEROOT so we can finish processing.
fi
#
# Change the pkg variant from global zone to non-global zone. This assumes
# that the caller has already:
# - updated the image format
# - refreshed the catalog in the zone's image
# - set the pkg image property use-system-repo=true
#
trap - EXIT
exit $ZONE_SUBPROC_OK