X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=debian%2Fnfs-common.init;h=a8ca61c0a75cf93bd06d1e4b3a44f42e0dc614ca;hb=f38ff5dc81299f5dd1cde112feaf6facd295c231;hp=7cba6795f2227d0fd2686d2e6ba8ff16ed668a71;hpb=5ec394580c68dfe57bc973406391b84b3be6e8af;p=nfs-utils.git diff --git a/debian/nfs-common.init b/debian/nfs-common.init index 7cba679..a8ca61c 100644 --- a/debian/nfs-common.init +++ b/debian/nfs-common.init @@ -2,9 +2,9 @@ ### BEGIN INIT INFO # Provides: nfs-common -# Required-Start: $time +# Required-Start: $portmap $time # Required-Stop: $time -# Default-Start: 2 3 4 5 +# Default-Start: 2 3 4 5 S # Default-Stop: 0 1 6 # Short-Description: NFS support files common to client and server # Description: NFS is a popular protocol for file sharing across @@ -18,6 +18,7 @@ DESC="NFS common utilities" # Read config DEFAULTFILE=/etc/default/nfs-common PREFIX= +NEED_STATD=yes NEED_IDMAPD= NEED_GSSD= PIPEFS_MOUNTPOINT=/var/lib/nfs/rpc_pipefs @@ -28,6 +29,9 @@ fi . /lib/lsb/init-functions +# Exit if required binaries are missing. +[ -x $PREFIX/sbin/rpc.statd ] || exit 0 + # # Parse the fstab file, and determine whether we need idmapd and gssd. (The # /etc/defaults settings, if any, will override our autodetection.) This code @@ -63,11 +67,10 @@ fi # condition in nfs-kernel-server's init script does, which has a value in # itself. # -if [ -f /etc/exports ]; then +if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports; then AUTO_NEED_IDMAPD=yes fi - case "$NEED_IDMAPD" in yes|no) ;; @@ -84,11 +87,6 @@ case "$NEED_GSSD" in ;; esac -# Exit if required binaries are missing. -[ -x $PREFIX/sbin/rpc.statd ] || exit 0 -[ -x /usr/sbin/rpc.idmapd ] || [ "$NEED_IDMAPD" = no ] || exit 0 -[ -x /usr/sbin/rpc.gssd ] || [ "$NEED_GSSD" = no ] || exit 0 - do_modprobe() { if [ -x /sbin/modprobe -a -f /proc/modules ] then @@ -122,14 +120,21 @@ case "$1" in 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 + # up yet). + [ -x /usr/sbin/rpc.idmapd ] || NEED_IDMAPD=no + [ -x /usr/sbin/rpc.gssd ] || NEED_GSSD=no + if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ] then do_modprobe nfs @@ -193,29 +198,35 @@ case "$1" in 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 +235,12 @@ case "$1" in 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 ;;