#
# 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
#
#
#
# Allows developers to override some things like PATH and PYTHONPATH
m_usage=$(gettext "\n install [-h]\n install [-m manifest] [-c profile.xml | dir]\n install {-a archive|-d path} {-p|-u} [-U] [-s|-v] [-c profile.xml | dir]")
print "$m_inetrrupt"
exit $EXIT_CODE
}
vlog "Exiting with exit code $EXIT_CODE"
exit $EXIT_CODE
}
trap trap_cleanup INT
# Used by start_log()
set -A save_args "$0" "$@"
manifest=""
profile_dir=""
ZONENAME=""
ZONEPATH=""
# Setup i18n output
TEXTDOMAIN="SUNW_OST_OSCMD"
export TEXTDOMAIN
unset install_archive
unset source_dir
unset silent_mode
unset verbose_mode
unset sc_config
unset OPT_C
unset temp_manifest
unset temp_scprofile
unset update_all
while getopts "a:c:d:hm:pR:suUvz:" opt; do
a) # We're expecting a path to an archive
if [[ ! -f $OPTARG ]]; then
# If old style 'pub=uri' parameter then error.
if (( $? == 0 )); then
fi
fi
install_archive="-a $OPTARG";;
d) source_dir="-d $OPTARG";;
h) fail_usage "";;
p) preserve_zone="-p";;
s) silent_mode=1;;
u) unconfig_zone="-u";;
U) update_all="-U";;
v) verbose_mode="-v";;
*) fail_usage "";;
esac
done
print -u2 "Brand error: No zone path or name"
exit $ZONE_SUBPROC_USAGE
fi
zone=
eval $(bind_legacy_zone_globals zone)
fi
# Configuration profile file must have .xml suffix
fi
# An image install can't use both -a AND -d...
[[ -n "$install_archive" && -n "$source_dir" ]] &&
fail_usage "$f_incompat_options" "-a" "-d"
# The install can't be both verbose AND silent...
[[ -n $silent_mode && -n $verbose_mode ]] && \
fail_usage "$f_incompat_options" "-s" "-v"
# The install can't both preserve and unconfigure
[[ -n $unconfig_zone && -n $preserve_zone ]] && \
fail_usage "$f_incompat_options" "-u" "-p"
# AI zone manifest option isn`t allowed when installing from a system image.
if [[ -n "$install_archive" || -n "$source_dir" ]]; then
[[ -n "$manifest" ]] && fail_usage \
"$f_incompat_options" "-a|-d" "-m"
fi
# p2v options aren't allowed when installing from a repo.
if [[ -z $install_archive && -z $source_dir ]]; then
fail_usage "$f_incompat_options" "default" "-p|-u|-U"
fi
#
# Look for the 'entire' incorporation's FMRI in the current image; due to users
# doing weird machinations with their publishers, we strip off the publisher
# from the FMRI if it is present.
# It's ok to not find entire in the current image, since this means the user
# can install pre-release development bits for testing purposes.
#
#
# If we're installing from an image, branch off to that installer.
# Set up ZFS dataset hierarchy for the zone root dataset.
#
if [[ -n $install_archive || -n $source_dir ]]; then
EXIT_CODE=$?
exit $EXIT_CODE
fi
if [[ $? -ne 0 ]]; then
fi
# Use default AI zone manifest if none is given
if [[ ! -n $manifest ]]; then
fi
#
# Add packages to AI zone manifest for TX zones if appropriate.
# Add entire package if installed in GZ
# The environment variable AIM_MANIFEST contains the file where all the
# aimanifest changes will be made. The load operation loads that manifest
# into the working file. The add operation adds the entries to the
# working file.
#
if [[ -z $temp_manifest ]]; then
print "$f_mktemp"
fi
export AIM_MANIFEST=$temp_manifest
if [[ $? -ne 0 ]]; then
print "$f_aimanifest_load"
fi
if [ $? != 0 ]; then
print "$f_nolabel"
elif [ $primary = "primary=yes" ]; then
else
fi
if [[ $? -ne 0 ]]; then
print "$f_aimanifest_add"
fi
fi
if [[ -n $entire_fmri ]]; then
pkg:///$entire_fmri
if [[ $? -ne 0 ]]; then
print "$f_aimanifest_add"
fi
fi
fi
#
# Before installing the zone, set up ZFS dataset for the zone root dataset,
# will create them. Sets EXIT_CODE if datasets are created.
#
#
# If unconfig service is online, then call auto-install with the default
# profile or with the caller supplied profile.
# If unconfig service is offline or doesn't exist, then don't pass
# any profile to auto-install since this will cause SCI tool to start in
# zone on boot. Previous sysconfig method handled below after install.
#
-m "$manifest"
if [[ -n $sc_config ]]; then
# Do not quote $OPT_C as it should be "-c <something>"
else
fi
fi
#
# Run auto-install, saving the output in the log file. Tricks are needed
# so that we can check the exit value from auto-install rather than the exit
# value from tee.
#
vlog "$m_ai_running" "${aicmd[*]}"
if [[ -n $temp_manifest ]]; then
fi
if [[ -n $temp_scprofile ]]; then
fi
log "\n$m_mannote\n"
#
# If unconfig service is offline or doesn't exist, then use
# previous sysconfig method since that is still being used by the
# zone. Copy sysidcfg file if given, but only copy if it isn't the
# new SC file enable_sci.xml. The enable_sci.xml file causes
# sysid to generate warnings in a zone.
#
if [[ $SC_ONLINE != "online" ]]; then
if [[ -n $sc_config ]] && [[ $sc_config != \
"/usr/share/auto_install/sc_profiles/enable_sci.xml" ]]; then
fi
fi
#
# packages are installed in the zone. Set up links in the zone to the
# global zone files -- this will provide default versions from the global
# zone, which can be modified by the zone, breaking the link.
if [ -d $i ]; then
else
fi
fi
done
fi
log "$m_postnote\n"
log "$m_postnote2\n"
else
fi
trap - EXIT
exit $ZONE_SUBPROC_OK