xref: /illumos-gate/usr/src/cmd/dfs.cmds/unshareall/unshareall.sh (revision 6185db853e024a486ff8837e6784dd290d866112)
17c478bd9Sstevel@tonic-gate#!/sbin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*6185db85Sdougm# Common Development and Distribution License (the "License").
7*6185db85Sdougm# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
22*6185db85Sdougm#	Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*6185db85Sdougm#	Use is subject to license terms.
247c478bd9Sstevel@tonic-gate
257c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.3	*/
267c478bd9Sstevel@tonic-gate# unshareall  -- unshare resources
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateUSAGE="unshareall [-F fsys[,fsys...]]"
297c478bd9Sstevel@tonic-gatefsys=
307c478bd9Sstevel@tonic-gateset -- `getopt F: $*`
317c478bd9Sstevel@tonic-gateif [ $? != 0 ]		# invalid options
327c478bd9Sstevel@tonic-gate	then
337c478bd9Sstevel@tonic-gate	echo $USAGE >&2
347c478bd9Sstevel@tonic-gate	exit 1
357c478bd9Sstevel@tonic-gatefi
367c478bd9Sstevel@tonic-gatefor i in $*		# pick up the options
377c478bd9Sstevel@tonic-gatedo
387c478bd9Sstevel@tonic-gate	case $i in
397c478bd9Sstevel@tonic-gate	-F)  fsys=$2; shift 2;;
407c478bd9Sstevel@tonic-gate	--)  shift; break;;
417c478bd9Sstevel@tonic-gate	esac
427c478bd9Sstevel@tonic-gatedone
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gateif [ $# -gt 0 ]		# accept no arguments
457c478bd9Sstevel@tonic-gatethen
467c478bd9Sstevel@tonic-gate	echo $USAGE >&2
477c478bd9Sstevel@tonic-gate	exit 1
487c478bd9Sstevel@tonic-gatefi
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gateif [ "$fsys" ]		# for each file system ...
517c478bd9Sstevel@tonic-gatethen
527c478bd9Sstevel@tonic-gate	fsys=`echo $fsys|tr ',' ' '`
537c478bd9Sstevel@tonic-gate	for i in $fsys
547c478bd9Sstevel@tonic-gate	do
55*6185db85Sdougm		/usr/sbin/sharemgr stop -P $fsys -a
567c478bd9Sstevel@tonic-gate	done
57*6185db85Sdougmelse			# for every file system ...
58*6185db85Sdougm	/usr/sbin/sharemgr stop -a
59*6185db85Sdougmfi
60*6185db85Sdougm
61