2N/A#!/bin/ksh -p
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A#
2N/A# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/A. /usr/lib/brand/solaris10/common.ksh
2N/A
2N/Am_usage=$(gettext "solaris10 brand usage: detach [-n].")
2N/A
2N/AEXIT_CODE=$ZONE_SUBPROC_USAGE
2N/A
2N/A# If we weren't passed at least two arguments, exit now.
2N/A(( $# < 2 )) && exit $ZONE_SUBPROC_USAGE
2N/A
2N/AZONENAME=$1
2N/AZONEPATH=$2
2N/A
2N/Ashift; shift # remove ZONENAME and ZONEPATH from arguments array
2N/A
2N/Anoexecute=0
2N/A
2N/A# Other brand detach options are invalid for this brand.
2N/Awhile getopts "n" opt; do
2N/A case $opt in
2N/A n) noexecute=1 ;;
2N/A ?) printf "$m_usage\n"
2N/A exit $ZONE_SUBPROC_USAGE;;
2N/A *) printf "$m_usage\n"
2N/A exit $ZONE_SUBPROC_USAGE;;
2N/A esac
2N/Adone
2N/Ashift $((OPTIND-1))
2N/A
2N/Ainit_zone zone "$ZONENAME" "$ZONEPATH"
2N/Aeval $(bind_legacy_zone_globals zone)
2N/A
2N/Aif (( $noexecute == 1 )); then
2N/A cat /etc/zones/$ZONENAME.xml
2N/A exit $ZONE_SUBPROC_OK
2N/Afi
2N/A
2N/A# All of the hard stuff is done in commmon code.
2N/Adetach_zone zone
2N/A
2N/A# Remove the service tag for this zone.
2N/Adel_svc_tag "$ZONENAME"
2N/A
2N/Aexit $ZONE_SUBPROC_OK