xref: /titanic_52/usr/src/cmd/dfs.cmds/unshareall/unshareall.sh (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
1#!/sbin/sh
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, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
24#	  All Rights Reserved
25
26
27#ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.3	*/
28# unshareall  -- unshare resources
29
30USAGE="unshareall [-F fsys[,fsys...]]"
31fsys=
32set -- `getopt F: $*`
33if [ $? != 0 ]		# invalid options
34	then
35	echo $USAGE >&2
36	exit 1
37fi
38for i in $*		# pick up the options
39do
40	case $i in
41	-F)  fsys=$2; shift 2;;
42	--)  shift; break;;
43	esac
44done
45
46if [ $# -gt 0 ]		# accept no arguments
47then
48	echo $USAGE >&2
49	exit 1
50fi
51
52if [ "$fsys" ]		# for each file system ...
53then
54	fsys=`echo $fsys|tr ',' ' '`
55else			# for every file system ...
56	fsys=`sed 's/^\([^# 	]*\).*/\1/' /etc/dfs/fstypes`
57fi
58
59for i in $fsys
60do
61	for path in `sed -n "s/^\([^ 	]*\)[ 	]*[^ 	]*[ 	]*${i}.*/\1/p" /etc/dfs/sharetab`
62	do
63		/usr/sbin/unshare -F $i $path
64	done
65done
66