Package: nfs-utils
Version: 1:1.1.1-3
Severity: minor
Tags: patch

Hi,

the attached patch changes the nfs-utils init.d scripts to allow daemons which are not necessary in a NFSv4-only environment to be disabled through /etc/default/{nfs-common,nfs-kernel-server} options.

--
David Härdeman
diff -ur ./nfs-utils-1.1.1.orig/debian/nfs-common.default ./nfs-utils-1.1.1/debian/nfs-common.default
--- ./nfs-utils-1.1.1.orig/debian/nfs-common.default	2007-10-27 13:09:12.000000000 +0200
+++ ./nfs-utils-1.1.1/debian/nfs-common.default	2007-10-27 13:34:17.000000000 +0200
@@ -3,6 +3,9 @@
 # for the NEED_ options are "yes" and "no".
 
 # Options for rpc.statd.
+# Do you want to start the statd daemon? It is needed for NFSv3 and NFSv2.
+NEED_STATD=
+
 #   Should rpc.statd listen on a specific port? This is especially useful
 #   when you have a port-based firewall. To use a fixed port, set this
 #   this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
@@ -14,3 +17,4 @@
 
 # Do you want to start the gssd daemon? It is required for Kerberos mounts.
 NEED_GSSD=
+
diff -ur ./nfs-utils-1.1.1.orig/debian/nfs-common.init ./nfs-utils-1.1.1/debian/nfs-common.init
--- ./nfs-utils-1.1.1.orig/debian/nfs-common.init	2007-10-27 13:09:12.000000000 +0200
+++ ./nfs-utils-1.1.1/debian/nfs-common.init	2007-10-27 13:33:45.000000000 +0200
@@ -18,6 +18,7 @@
 # Read config
 DEFAULTFILE=/etc/default/nfs-common
 PREFIX=
+NEED_STATD=
 NEED_IDMAPD=
 NEED_GSSD=
 PIPEFS_MOUNTPOINT=/var/lib/nfs/rpc_pipefs
@@ -67,6 +68,13 @@
     AUTO_NEED_IDMAPD=yes
 fi
 
+case "$NEED_STATD" in
+    yes|no)
+        ;;
+    *)
+        NEED_STATD=yes
+	;;
+esac
 
 case "$NEED_IDMAPD" in
     yes|no)	
@@ -117,12 +125,14 @@
   start)
 	log_daemon_msg "Starting $DESC"
 
-	log_progress_msg "statd"
-	start-stop-daemon --start --oknodo --quiet \
-	    --exec $PREFIX/sbin/rpc.statd -- $STATDOPTS
-	if [ $? != 0 ]; then
-	    log_end_msg $?
-	    exit $?
+	if [ "$NEED_STATD" = yes ]; then
+	    log_progress_msg "statd"
+	    start-stop-daemon --start --oknodo --quiet \
+	        --exec $PREFIX/sbin/rpc.statd -- $STATDOPTS
+	    if [ $? != 0 ]; then
+	        log_end_msg $?
+	        exit $?
+	    fi
 	fi
 
 	# Don't start idmapd and gssd if we don't have them (say, if /usr is not
@@ -193,29 +203,35 @@
                 exit $?
             fi
 	fi
-	log_progress_msg "statd"
-	start-stop-daemon --stop --oknodo --quiet \
-	    --name rpc.statd
-	if [ $? != 0 ]; then
-            log_end_msg $?
-            exit $?
-        fi
+	if ["$NEED_STATD" = yes ]
+	then
+	    log_progress_msg "statd"
+	    start-stop-daemon --stop --oknodo --quiet \
+	        --name rpc.statd
+	    if [ $? != 0 ]; then
+                log_end_msg $?
+                exit $?
+            fi
+	fi
 	do_umount $PIPEFS_MOUNTPOINT 2>/dev/null || true
 	log_end_msg 0
 	;;
 
   status)
-	if ! pidof rpc.statd >/dev/null
+	if [ "$NEED_STATD" = yes ]
 	then
-	    echo "rpc.statd not running"
-	    exit 3
+	    if ! pidof rpc.statd >/dev/null
+	    then
+	        echo "rpc.statd not running"
+	        exit 3
+	    fi
 	fi
 
 	if [ "$NEED_GSSD" = yes ]
 	then
             if ! pidof rpc.gssd >/dev/null
 	    then
-		echo "rpc.statd running, but rpc.gssd halted"
+		echo "rpc.gssd not running"
 		exit 3
 	    fi
 	fi
@@ -224,12 +240,12 @@
 	then
             if ! pidof rpc.idmapd >/dev/null
 	    then
-		echo "rpc.statd running, but rpc.idmapd halted"
+		echo "rpc.idmapd not running"
 		exit 3
 	    fi
 	fi
 
-	echo "rpc.statd running"
+	echo "all daemons running"
 	exit 0
 	;;
 
diff -ur ./nfs-utils-1.1.1.orig/debian/nfs-kernel-server.default ./nfs-utils-1.1.1/debian/nfs-kernel-server.default
--- ./nfs-utils-1.1.1.orig/debian/nfs-kernel-server.default	2007-10-27 13:09:12.000000000 +0200
+++ ./nfs-utils-1.1.1/debian/nfs-kernel-server.default	2007-10-27 13:45:12.000000000 +0200
@@ -5,6 +5,10 @@
 RPCNFSDPRIORITY=0
 
 # Options for rpc.mountd.
+# Do you want to start the mountd daemon? It is only required for NFSv2/NFSv3.
+# Valid alternatives are "yes" and "no"; the default is "yes".
+NEED_MOUNTD=
+
 # If you have a port-based firewall, you might want to set up
 # a fixed port here using the --port option. For more information, 
 # see rpc.mountd(8) or http://wiki.debian.org/?SecuringNFS
diff -ur ./nfs-utils-1.1.1.orig/debian/nfs-kernel-server.init ./nfs-utils-1.1.1/debian/nfs-kernel-server.init
--- ./nfs-utils-1.1.1.orig/debian/nfs-kernel-server.init	2007-10-27 13:09:12.000000000 +0200
+++ ./nfs-utils-1.1.1/debian/nfs-kernel-server.init	2007-10-27 13:48:31.000000000 +0200
@@ -27,6 +27,7 @@
 RPCNFSDCOUNT=8
 RPCNFSDPRIORITY=0
 RPCMOUNTDOPTS=
+NEED_MOUNTD=yes
 NEED_SVCGSSD=no
 RPCSVCGSSDOPTS=
 PROCNFSD_MOUNTPOINT=/proc/fs/nfsd
@@ -114,12 +115,14 @@
 			fi
 		fi
 
-		log_progress_msg "mountd"
-		start-stop-daemon --start --oknodo --quiet \
-		    --exec $PREFIX/sbin/rpc.mountd -- $RPCMOUNTDOPTS
-		if [ $? != 0 ]; then
-			log_end_msg $?
-			exit $?
+		if [ "$NEED_MOUNTD" != "no" ]; then
+			log_progress_msg "mountd"
+			start-stop-daemon --start --oknodo --quiet \
+			    --exec $PREFIX/sbin/rpc.mountd -- $RPCMOUNTDOPTS
+			if [ $? != 0 ]; then
+				log_end_msg $?
+				exit $?
+			fi
 		fi
 
 		log_end_msg 0
@@ -130,15 +133,17 @@
 
   stop)
 	log_daemon_msg "Stopping $DESC"
-	
-	log_progress_msg "mountd"
-	start-stop-daemon --stop --oknodo --quiet \
-	    --name rpc.mountd --user 0
-	if [ $? != 0 ]; then
-		log_end_msg $?
-		exit $?
+
+	if [ "$NEED_MOUNTD" != "no" ]; then
+		log_progress_msg "mountd"
+		start-stop-daemon --stop --oknodo --quiet \
+		    --name rpc.mountd --user 0
+		if [ $? != 0 ]; then
+			log_end_msg $?
+			exit $?
+		fi
 	fi
-	        
+
 	if [ "$NEED_SVCGSSD" = "yes" ]; then
 		log_progress_msg "svcgssd"
 		start-stop-daemon --stop --oknodo --quiet \

Reply via email to