]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - etc/redhat/nfs.init
Fix a typo.
[nfs-utils.git] / etc / redhat / nfs.init
index eb95a24b29873d0063dfc8f8de3b1255edac2cd4..c1b98eab3634f96b47c340908d9a9ab61ef08418 100755 (executable)
@@ -29,8 +29,8 @@ fi
 
 # Number of servers to be started up by default
 RPCNFSDCOUNT=8
-# No NFS V3.
-RPCMOUNTDOPTS="--no-nfs-version 3"
+# Default to NFS version 3.
+RPCMOUNTDOPTS=""
 
 # See how we were called.
 case "$1" in
@@ -40,12 +40,25 @@ case "$1" in
        echo -n "Starting NFS quotas: "
        daemon rpc.rquotad
        echo
-       echo -n "Starting NFS mountd: "
-       daemon rpc.mountd $RPCMOUNTDOPTS
-       echo
        echo -n "Starting NFS daemon: "
        daemon rpc.nfsd $RPCNFSDCOUNT
        echo
+
+       # Let's see if we support NFS version 3.
+       /usr/sbin/rpcinfo -u localhost nfs 3 &>/dev/null
+       if [ $? -ne 0 ]; then
+               RPCMOUNTDOPTS="--no-nfs-version 3"
+       fi
+
+       # Let's see if we support NFS over TCP.
+       /usr/sbin/rpcinfo -p localhost | grep nfs | grep tcp &>/dev/null
+       if [ $? -ne 0 ]; then
+               RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-tcp"
+       fi
+
+       echo -n "Starting NFS mountd: "
+       daemon rpc.mountd $RPCMOUNTDOPTS
+       echo
        touch /var/lock/subsys/nfs
        ;;
   stop)