#
# 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
#
#
#
m_usage=$(gettext "solaris10 brand usage:\n\tattach [-a archive | -d directory | -r recv_type]\n\tThe -a archive option specifies an archive name which can be a flar,\n\ttar, pax or cpio archive.\n\tThe -d directory option specifies an existing directory.\n\tThe -r recv_type option specifies the type of archive to be read from\n\tstdin.")
# Clean up on interrupt
{
# umount any mounted file systems
}
# If the attach failed then clean up the ZFS datasets we created.
{
if [[ $EXIT_CODE != $ZONE_SUBPROC_OK && $rm_ds == 1 ]]; then
fi
exit $EXIT_CODE
}
install_media="-"
rm_ds=0
trap trap_cleanup INT
# If we weren't passed at least two arguments, exit now.
ZONENAME="$1"
ZONEPATH="$2"
shift; shift # remove ZONENAME and ZONEPATH from arguments array
unset inst_type
# Other brand attach options are invalid for this brand.
while getopts "a:d:nr:" opt; do
a)
if [[ -n "$inst_type" ]]; then
fi
inst_type="archive"
;;
d)
if [[ -n "$inst_type" ]]; then
fi
inst_type="directory"
# '-d -' means use the existing zonepath.
if [[ "$install_media" == "$ZONEPATH" ]]; then
install_media="-"
fi
;;
n) noexecute=1 ;;
r)
if [[ -n "$inst_type" ]]; then
fi
inst_type="stdin"
;;
exit $ZONE_SUBPROC_USAGE;;
exit $ZONE_SUBPROC_USAGE;;
esac
done
fi
#
# The zone doesn't have to exist when the -n option is used, so do
# this work early.
#
# XXX do the sw validation for solaris10 minimal patch level to ensure
# everything will be ok.
fi
if [[ -z "$inst_type" ]]; then
inst_type="directory"
elif [[ "$install_media" != "-" ]]; then
#
# If we're not using a pre-existing zone directory layout then create
# the zone datasets and mount them.
#
unset DATASET
if (( $? == 0 )); then
if (( $? == 0 )); then
rm_ds=1
else
fi
fi
fi
#
# The zone's datasets are now in place, validate that things
# are setup correctly.
#
if [ ! -d $ZONEROOT ]; then
fi
if [[ $mnted = "no" ]]; then
fi
if [[ -z "$LOGFILE" ]]; then
fi
exec 2>>"$LOGFILE"
log "$m_attach_log" "$LOGFILE"
#
# Perform a final check that this is really a zone image and not an archive of
# a system image which would need p2v. Check for a well-known S10 SMF service
# that shouldn't exist in a zone.
#
fi
zone_logfile="${logdir}/$zonename.attach$$.log"
exit $ZONE_SUBPROC_OK