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/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.
13 #
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]
19 #
20 # CDDL HEADER END
21 #
22 #
23 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
27 # All Rights Reserved
28 #
29 #
30
31 usage () {
32 if [ -n "$1" ]; then
33 echo "umountall: $1" 1>&2
34 fi
35 echo "Usage:\n\tumountall [-k] [-s] [-F FSType] [-l|-r] [-Z] [-n]" 1>&2
36 echo "\tumountall [-k] [-s] [-h host] [-Z] [-n]" 1>&2
37 exit 2
38 }
39
40 MNTTAB=/etc/mnttab
41
42 # This script is installed as both /sbin/umountall (as used in some
43 # /sbin/rc? and /etc/init.d scripts) _and_ as /usr/sbin/umountall (typically
152 fi
153
154 if [ -n "$FFLAG" -a "$HFLAG" = "h" ]; then # 4
155 usage "Specifying FStype incompatible with -h option"
156 fi
157
158 if [ -n "$HFLAG" -a "$HOST" = "$LOCALNAME" ]; then # 5
159 usage "Specifying local host illegal for -h option"
160 fi
161
162 if [ "$FSType" = "nfs" -a "$LFLAG" = "l" ]; then # 6
163 usage "option -l and FSType nfs are incompatible"
164 fi
165
166 if [ -n "$FFLAG" -a "$FSType" != "nfs" -a -n "$RFLAG" ]; then # 7
167 usage "option -r and FSType ${FSType} are incompatible"
168 fi
169
170 ZONENAME=`zonename`
171
172 # Check and if needed sync the boot archive before unmounting everything.
173 #
174 if [ -z "${RFLAG}${NFLAG}${HFLAG}${FSType}" -a "$ZONENAME" = "global" \
175 -a -x /sbin/bootadm ] ; then
176 /sbin/bootadm -a update_all
177 fi
178
179
180 #
181 # If we are in deferred activation patching, and the caller is
182 # svc.startd, then exit without unmounting any of the remaining
183 # file systems since the call path is from shutdown. Note that
184 # by the time we get here, smf stop methods for nfs, cachefs
185 # etc, will have run.
186 #
187 if [ -f $DEFERRED_ACTIVATION_PATCH_FLAG ] ; then
188 ppid=`ps -o ppid= -p $$` # parent of umountall will be sh
189 # from system()
190
191 ppid=`ps -o ppid= -p $ppid` # parent of sh will be svc.startd
192 COMM=`ps -o comm= -p $ppid`
193 if [ "$COMM" = "$SVC_STARTD" ] ; then
194 exit
195 fi
196 fi
197
198 #
199 # Take advantage of parallel unmounting at this point if we have no
200 # criteria to match and we are in the global zone
|
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/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.
13 #
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]
19 #
20 # CDDL HEADER END
21 #
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
27 # All Rights Reserved
28 #
29 #
30
31 usage () {
32 if [ -n "$1" ]; then
33 echo "umountall: $1" 1>&2
34 fi
35 echo "Usage:\n\tumountall [-k] [-s] [-F FSType] [-l|-r] [-Z] [-n]" 1>&2
36 echo "\tumountall [-k] [-s] [-h host] [-Z] [-n]" 1>&2
37 exit 2
38 }
39
40 MNTTAB=/etc/mnttab
41
42 # This script is installed as both /sbin/umountall (as used in some
43 # /sbin/rc? and /etc/init.d scripts) _and_ as /usr/sbin/umountall (typically
152 fi
153
154 if [ -n "$FFLAG" -a "$HFLAG" = "h" ]; then # 4
155 usage "Specifying FStype incompatible with -h option"
156 fi
157
158 if [ -n "$HFLAG" -a "$HOST" = "$LOCALNAME" ]; then # 5
159 usage "Specifying local host illegal for -h option"
160 fi
161
162 if [ "$FSType" = "nfs" -a "$LFLAG" = "l" ]; then # 6
163 usage "option -l and FSType nfs are incompatible"
164 fi
165
166 if [ -n "$FFLAG" -a "$FSType" != "nfs" -a -n "$RFLAG" ]; then # 7
167 usage "option -r and FSType ${FSType} are incompatible"
168 fi
169
170 ZONENAME=`zonename`
171
172 #
173 # If we are in deferred activation patching, and the caller is
174 # svc.startd, then exit without unmounting any of the remaining
175 # file systems since the call path is from shutdown. Note that
176 # by the time we get here, smf stop methods for nfs, cachefs
177 # etc, will have run.
178 #
179 if [ -f $DEFERRED_ACTIVATION_PATCH_FLAG ] ; then
180 ppid=`ps -o ppid= -p $$` # parent of umountall will be sh
181 # from system()
182
183 ppid=`ps -o ppid= -p $ppid` # parent of sh will be svc.startd
184 COMM=`ps -o comm= -p $ppid`
185 if [ "$COMM" = "$SVC_STARTD" ] ; then
186 exit
187 fi
188 fi
189
190 #
191 # Take advantage of parallel unmounting at this point if we have no
192 # criteria to match and we are in the global zone
|