Author: baggins                      Date: Tue Mar 20 15:12:50 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added more options
- fixed reload
- better status
- support NFSv4 by default
- moved idmapd and svcgssd to separate init scripts

---- Files affected:
SOURCES:
   nfs.init (1.37 -> 1.38) 

---- Diffs:

================================================================
Index: SOURCES/nfs.init
diff -u SOURCES/nfs.init:1.37 SOURCES/nfs.init:1.38
--- SOURCES/nfs.init:1.37       Wed Mar 14 15:28:37 2007
+++ SOURCES/nfs.init    Tue Mar 20 16:12:44 2007
@@ -15,9 +15,15 @@
 # Get network config
 . /etc/sysconfig/network
 
-# Get service config
+# Get service configs
+[ -f /etc/sysconfig/nfslock ] && . /etc/sysconfig/nfslock
 [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd
 
+[ -n "$NFSv1" ] || NFSv1="yes"
+[ -n "$NFSv2" ] || NFSv2="yes"
+[ -n "$NFSv3" ] || NFSv3="yes"
+[ -n "$NFSv4" ] || NFSv4="yes"
+
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; 
then
@@ -28,49 +34,38 @@
        exit 0
 fi
 
+if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
+       [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && 
exit 0
+fi
+
 start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/nfs ]; then
-               if [ -x /sbin/pidof ]; then
-                       if [ -z "`/sbin/pidof portmap`" ]; then
-                               nls "Error: portmap isn't running"
-                               exit 0
-                       fi
+               if ! grep -q nfsd /proc/mounts ; then
+                       modprobe -s nfsd > /dev/null 2>&1
+                       run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t 
nfsd nfsd /proc/fs/nfsd
                fi
 
-               if ! is_yes "$NFS4" ; then
-                       RPCMOUNTOPTIONS="$RPCMOUNTOPTIONS --no-nfs-version 4"
+               # Set the ports lockd should listen on
+               if [ -n "$LOCKD_TCPPORT" ]; then
+                       /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT 
>/dev/null 2>&1
                fi
+               if [ -n "$LOCKD_UDPPORT" ]; then
+                       /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT 
>/dev/null 2>&1
+               fi
+
+               for vers in 1 2 3 4 ; do
+                       is_yes $(eval echo \$NFSv$vers) || \
+                               RPCMOUNTOPTIONS="$RPCMOUNTOPTIONS 
--no-nfs-version $vers"
+               done
 
                # Start daemons.
-               modprobe -s nfsd > /dev/null 2>&1
-               if [ "$(kernelverser)" -ge "002006" ]; then
-                   grep -q nfsd /proc/filesystems && \
-                   ! grep -q nfsd /proc/mounts && \
-                       run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t 
nfsd nfsd /proc/fs/nfsd
-               fi
                msg_starting "NFS exportfs"
                daemon /usr/sbin/exportfs -r
-               msg_starting "NFS mountd"
-               daemon rpc.mountd $RPCMOUNTOPTIONS
-               if is_yes "$NFS4" ; then
-                   if (grep -q rpc_pipefs /proc/filesystems); then
-                       ! grep -q rpc_pipefs /proc/mounts && \
-                           run_cmd "Mounting /var/lib/nfs/rpc_pipefs 
filesystem" mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
-                       if [ ! -f /var/lock/subsys/idmapd ]; then
-                           msg_starting "NFS idmapd"
-                           daemon rpc.idmapd $RPCIDMAPOPTIONS
-                           [ $? = 0 ] && touch /var/lock/subsys/idmapd
-                       fi
-                       if [ ! -f /var/lock/subsys/svcgssd ]; then
-                           msg_starting "NFS svcgssd"
-                           daemon rpc.svcgssd $RPCSVCGSSOPTIONS
-                           [ $? = 0 ] && touch /var/lock/subsys/svcgssd
-                       fi
-                   fi
-               fi
                msg_starting "NFS daemon"
                daemon rpc.nfsd $RPCNFSDCOUNT
+               msg_starting "NFS mountd"
+               daemon rpc.mountd $RPCMOUNTOPTIONS
                touch /var/lock/subsys/nfs
        else
                msg_already_running "NFS daemon"
@@ -84,20 +79,6 @@
                killproc rpc.mountd
                msg_stopping "NFS daemon"
                killproc nfsd -QUIT
-               if is_yes "$NFS4" ; then
-                       if (grep -q rpc_pipefs /proc/filesystems); then
-                           if [ ! -f /var/lock/subsys/svcgssd ]; then
-                               msg_stopping "NFS svcgssd"
-                               killproc rpc.svcgssd
-                               rm -f /var/lock/subsys/svcgssd
-                           fi
-                           if [ -f /var/lock/subsys/idmapd -a ! -f 
/var/lock/subsys/nfsfs ]; then
-                               msg_stopping "NFS idmapd"
-                               killproc rpc.idmapd
-                               rm -f /var/lock/subsys/idmapd
-                           fi
-                       fi
-               fi
                msg_stopping "NFS"
                daemon /usr/sbin/exportfs -au
                rm -f /var/lock/subsys/nfs
@@ -123,7 +104,7 @@
        if [ -f /var/lock/subsys/nfs ]; then
                msg_reloading "NFS"
                busy
-               /usr/sbin/exportfs
+               /usr/sbin/exportfs -r
                [ $? -ne 0 ] && RETVAL=7
                [ $RETVAL -eq 0 ] && ok || died
        else
@@ -148,6 +129,11 @@
        fi
        ;;
   status)
+       echo "Configured NFS exports:"
+       grep -v "^#" /etc/exports
+       echo "Active NFS exports:"
+       /usr/sbin/exportfs
+       echo
        status rpc.mountd
        RETVAL=$?
        status nfsd
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/nfs.init?r1=1.37&r2=1.38&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to