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
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.
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]
23 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
27 #ident "%Z%%M% %I% %E% SMI"
30 # exportfs: compatibility script for SunOs command.
33 USAGE
="Usage: exportfs [-aviu] [-o options] directory"
34 DFSTAB
=/etc
/dfs
/dfstab
38 # Translate from exportfs opts to share opts
42 IFS
=, ; set - $OPTS ; IFS
=" "
44 do case $i in *access
=* ) eval $i ;; esac ; done
45 if [ ! "$access" ] ; then return ; fi
51 rw
=* ) OPTS
="$OPTS$i," ;;
52 ro | rw
) OPTS
="${OPTS}$i=$access," ; ropt
="true" ;;
54 * ) OPTS
="$OPTS$i," ;;
57 if [ ! "$ropt" ] ; then OPTS
="ro=$access,$OPTS" ; fi
58 OPTS
=`echo $OPTS | sed 's/,$//'`
66 PATH
=/usr
/sbin
:/usr
/bin
:$PATH
69 if set -- `getopt aviuo: $*` ; then : ; else bad
; fi
74 -a ) aflg
="true" ; shift ;; # share all nfs
75 -v ) vflg
="true" ; shift ;; # verbose
76 -i ) iflg
="true" ; shift ;; # ignore dfstab opts
77 -u ) uflg
="true" ; shift ;; # unshare
78 -o ) oflg
="true" ; OPTS
=$2 ; shift 2 ;; # option string
84 if [ "$DIR" -o "$iflg" -o "$oflg" ] ; then bad
; fi
86 if [ $vflg ] ; then echo unshareall
-F nfs
; fi
87 /usr
/sbin
/unshareall
-F nfs
89 if [ $vflg ] ; then echo shareall
-F nfs
; fi
90 /usr
/sbin
/shareall
-F nfs
96 0 ) if [ "$iflg" -o "$uflg" -o "$oflg" ] ; then bad
; fi
97 if [ "$vflg" ] ; then echo share
-F nfs
; fi
98 /usr
/sbin
/share
-F nfs
106 if [ "$iflg" -o "$oflg" ] ; then bad
; fi
107 if [ $vflg ] ; then echo unshare
-F nfs
$DIR ; fi
108 /usr
/sbin
/unshare
-F nfs
$DIR
114 if [ $vflg ] ; then echo share
-F nfs
-o $OPTS $DIR ; fi
115 /usr
/sbin
/share
-F nfs
-o $OPTS $DIR
117 CMD
=`grep $DIR'[ ]*$' $DFSTAB`
118 if [ "$CMD" = "" ] ; then
119 echo "exportfs: no entry for $DIR in $DFSTAB" >&2
123 echo "exportfs: supplied options ignored" >&2
126 if [ $vflg ] ; then echo $CMD ; fi