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.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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]
23 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # common shell script functions
30 .
/usr
/lib
/brand
/solaris10
/common.ksh
31 .
/usr
/lib
/brand
/shared
/uninstall.ksh
36 # If we weren't passed at least two arguments, exit now.
37 (( $# < 2 )) && exit $ZONE_SUBPROC_USAGE
52 # check for bad or duplicate options
54 while getopts $options OPT
; do
56 \? ) usage_err
;; # invalid argument
57 : ) usage_err
;; # argument expected
59 opt
=`echo $OPT | sed 's/-\+//'`
60 if [ -n "$options_repeat" ]; then
61 echo $options_repeat |
grep $opt >/dev
/null
64 ( echo $options_seen |
grep $opt >/dev
/null
) &&
66 options_seen
="${options_seen}${opt}"
71 # check for a help request
73 while getopts :$options OPT
; do
81 while getopts :$options OPT
; do
88 shift `expr $OPTIND - 1`
90 [ $# -gt 0 ] && usage_err
95 zoneroot
=$zonepath/root
98 if [[ -n "$opt_n" ]]; then
101 # in '-n' mode we should never return success (since we haven't
102 # actually done anything). so override ZONE_SUBPROC_OK here.
104 ZONE_SUBPROC_OK
=$ZONE_SUBPROC_FATAL
108 # We want uninstall to work in the face of various problems, such as a
109 # zone with no delegated root dataset or multiple active datasets, so we
110 # don't use the common functions. Instead, we do our own work and
111 # are tolerant of errors.
113 uninstall_get_zonepath_ds
114 uninstall_get_zonepath_root_ds
116 # find all the zone BE datasets.
119 /sbin
/zfs list
-H -t filesystem
-o name
-r $ZONEPATH_RDS |
while read fs
; do
120 # only look at filesystems directly below $ZONEPATH_RDS
121 [[ "$fs" != ~
()($ZONEPATH_RDS/+([^
/])) ]] && continue
123 fs_all
[$fs_all_c]=$fs
124 (( fs_all_c
= $fs_all_c + 1 ))
127 destroy_zone_datasets
129 exit $ZONE_SUBPROC_OK