New ids_smf_remove
1 #!/usr/bin/ksh
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the License).
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/CDDL.txt
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/CDDL.txt.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets [] replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22 #ident "@(#)ids_smf_remove 1.1 07/10/19 SMI"
23 #
24 #
25 # DO NOT EDIT THIS FILE
26 #
27
28 rc=0
29 MYNAME=`basename $0`
30
31 typeset opt
32
33 while getopts 'z:f:' opt
34 do
35 case "${opt}" in
36 z) ZONE=${OPTARG};;
37 f) FMRI=${OPTARG};;
38 *) echo "ERROR: ${MYNAME} Option ${OPTARG} unknown"
39 echo "Usage: ${MYNAME} -z <zone> -f <FMRI>"
40 exit 1;;
41 esac
42 done
43
44 if [ -z ${ZONE} ]
45 then
46 /usr/bin/printf "ERROR: ${MYNAME} -z <zone> not specified\n"
47 rc=1
48 fi
49
50 if [ -z ${FMRI} ]
51 then
52 /usr/bin/printf "ERROR: ${MYNAME} -f <FMRI> not specified\n"
53 rc=1
54 fi
55
56 [ "${rc}" != 0 ] && exit ${rc}
57
58 if /usr/sbin/zlogin ${ZONE} svcadm disable ${FMRI}
59 then
60 /usr/bin/printf "${FMRI} found in ${ZONE}\n"
61 /usr/bin/printf "${FMRI} disabled in ${ZONE}\n"
62 fi
63
64 if /usr/sbin/zlogin ${ZONE} svccfg delete ${FMRI}
65 then
66 /usr/bin/printf "${FMRI} deleted in ${ZONE}\n"
67 fi
68
69 exit ${rc}