1*ab5dfd5eS#!/bin/ksh -p 2*ab5dfd5eS# 3*ab5dfd5eS# CDDL HEADER START 4*ab5dfd5eS# 5*ab5dfd5eS# The contents of this file are subject to the terms of the 6*ab5dfd5eS# Common Development and Distribution License (the "License"). 7*ab5dfd5eS# You may not use this file except in compliance with the License. 8*ab5dfd5eS# 9*ab5dfd5eS# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*ab5dfd5eS# or http://www.opensolaris.org/os/licensing. 11*ab5dfd5eS# See the License for the specific language governing permissions 12*ab5dfd5eS# and limitations under the License. 13*ab5dfd5eS# 14*ab5dfd5eS# When distributing Covered Code, include this CDDL HEADER in each 15*ab5dfd5eS# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*ab5dfd5eS# If applicable, add the following below this CDDL HEADER, with the 17*ab5dfd5eS# fields enclosed by brackets "[]" replaced with your own identifying 18*ab5dfd5eS# information: Portions Copyright [yyyy] [name of copyright owner] 19*ab5dfd5eS# 20*ab5dfd5eS# CDDL HEADER END 21*ab5dfd5eS# 22*ab5dfd5eS# 23*ab5dfd5eS# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24*ab5dfd5eS# Use is subject to license terms. 25*ab5dfd5eS# 26*ab5dfd5eS 27*ab5dfd5eS# 28*ab5dfd5eS# This preuninstall hook removes the service tag for the zone. 29*ab5dfd5eS# We need this in a preuninstall hook since once the zone state is 30*ab5dfd5eS# changed to 'incomplete' (which happens before we run the uninstall hook) 31*ab5dfd5eS# then the zone gets a new UUID and we can no longer figure out which 32*ab5dfd5eS# service tag instance to delete. 33*ab5dfd5eS# 34*ab5dfd5eS 35*ab5dfd5eS# 36*ab5dfd5eS# common shell script functions 37*ab5dfd5eS# 38*ab5dfd5eS. /usr/lib/brand/solaris10/common.ksh 39*ab5dfd5eS 40*ab5dfd5eS# If we weren't passed at least two arguments, exit now. 41*ab5dfd5eS(( $# < 2 )) && exit $ZONE_SUBPROC_USAGE 42*ab5dfd5eS 43*ab5dfd5eSZONENAME=$1 44*ab5dfd5eSZONEPATH=$2 45*ab5dfd5eS 46*ab5dfd5eSshift 2 47*ab5dfd5eS 48*ab5dfd5eS# 49*ab5dfd5eS# This hook will see the same options as the uninstall hook, so make sure 50*ab5dfd5eS# we accept these even though all but -n are ignored. 51*ab5dfd5eS# 52*ab5dfd5eSoptions="FhHnv" 53*ab5dfd5eSnop="" 54*ab5dfd5eS 55*ab5dfd5eS# process options 56*ab5dfd5eSOPTIND=1 57*ab5dfd5eSwhile getopts :$options OPT ; do 58*ab5dfd5eScase $OPT in 59*ab5dfd5eS F ) ;; 60*ab5dfd5eS h|H ) exit $ZONE_SUBPROC_OK ;; 61*ab5dfd5eS n ) nop="echo" ;; 62*ab5dfd5eS v ) ;; 63*ab5dfd5eSesac 64*ab5dfd5eSdone 65*ab5dfd5eSshift `expr $OPTIND - 1` 66*ab5dfd5eS 67*ab5dfd5eS[ $# -gt 0 ] && exit $ZONE_SUBPROC_OK 68*ab5dfd5eS 69*ab5dfd5eS# Remove the service tag for this zone. 70*ab5dfd5eS$nop del_svc_tag "$ZONENAME" 71*ab5dfd5eS 72*ab5dfd5eSexit $ZONE_SUBPROC_OK 73