X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=debian%2Fnfs-kernel-server.init;h=e0c51d6b778cbc53599f177f01b2ca8a0ba5b819;hp=4b04fe2906966fb39b19cefa723225bcc0a1f5b1;hb=HEAD;hpb=10cfddc260b77025807906f72c8d98d9fe84a6c5 diff --git a/debian/nfs-kernel-server.init b/debian/nfs-kernel-server.init index 4b04fe2..e0c51d6 100644 --- a/debian/nfs-kernel-server.init +++ b/debian/nfs-kernel-server.init @@ -1,9 +1,10 @@ -#!/bin/sh +#!/bin/bash ### BEGIN INIT INFO # Provides: nfs-kernel-server # Required-Start: $remote_fs nfs-common $portmap $time # Required-Stop: $remote_fs nfs-common $portmap $time +# Should-Start: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Kernel NFS server support @@ -59,12 +60,18 @@ do_mount() { # See how we were called. case "$1" in start) - if [ -f /etc/exports ] + export_files="/etc/exports" + for file in /etc/exports.d/*.exports ; do + if [ -f "$file" ]; then + export_files="$export_files $file" + fi + done + if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' $export_files then do_modprobe nfsd # See if our running kernel supports the NFS kernel server - if ! [ -d /sys/module/nfsd ]; then + if ! grep -E -qs "[[:space:]]nfsd\$" /proc/filesystems; then log_warning_msg "Not starting $DESC: no support in current kernel." exit 0 fi @@ -81,6 +88,16 @@ case "$1" in log_daemon_msg "Starting $DESC" log_progress_msg "nfsd" + + # See if rpcbind is running + $PREFIX/sbin/rpcinfo -p >/dev/null 2>&1 + RET=$? + if [ $RET != 0 ]; then + echo + log_warning_msg "Not starting: portmapper is not running" + exit 0 + fi + start-stop-daemon --start --oknodo --quiet \ --nicelevel $RPCNFSDPRIORITY \ --exec $PREFIX/sbin/rpc.nfsd -- $RPCNFSDCOUNT @@ -100,9 +117,6 @@ case "$1" in } fi - $PREFIX/bin/rpcinfo -u localhost nfs 3 >/dev/null 2>&1 || - RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3" - [ -z "$ClearAddr" ] || echo "nfsd 127.0.0.1 1" >/proc/net/rpc/auth.unix.ip/channel if [ "$NEED_SVCGSSD" = "yes" ]; then