X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=debian%2Fnfs-common.init;h=c81edfb552b1b23aa88bb443b1dc60e21db62f41;hb=8bf52a86b3f55781ceafe830ca27f8d294b7251d;hp=80dce3ee70f5b81ec5026254a9b73eaa29e7519e;hpb=55d68ec9d81637f142db3320937f8a2a83716044;p=nfs-utils.git diff --git a/debian/nfs-common.init b/debian/nfs-common.init index 80dce3e..c81edfb 100644 --- a/debian/nfs-common.init +++ b/debian/nfs-common.init @@ -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 ] && grep -q '^ .*/' /etc/exports; then +if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports; then AUTO_NEED_IDMAPD=yes fi - case "$NEED_IDMAPD" in yes|no) ;; @@ -117,12 +120,15 @@ 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 + RET=$? + if [ $RET != 0 ]; then + log_end_msg $RET + exit $RET + fi fi # Don't start idmapd and gssd if we don't have them (say, if /usr is not @@ -141,9 +147,10 @@ case "$1" in log_progress_msg "idmapd" start-stop-daemon --start --oknodo --quiet \ --exec /usr/sbin/rpc.idmapd - if [ $? != 0 ]; then - log_end_msg $? - exit $? + RET=$? + if [ $RET != 0 ]; then + log_end_msg $RET + exit $RET fi fi if [ "$NEED_GSSD" = yes ] @@ -160,9 +167,10 @@ case "$1" in start-stop-daemon --start --oknodo --quiet \ --exec /usr/sbin/rpc.gssd -- $RPCGSSDOPTS - if [ $? != 0 ]; then - log_end_msg $? - exit $? + RET=$? + if [ $RET != 0 ]; then + log_end_msg $RET + exit $RET fi fi fi @@ -178,9 +186,10 @@ case "$1" in log_progress_msg "gssd" start-stop-daemon --stop --oknodo --quiet \ --name rpc.gssd - if [ $? != 0 ]; then - log_end_msg $? - exit $? + RET=$? + if [ $RET != 0 ]; then + log_end_msg $RET + exit $RET fi fi if [ "$NEED_IDMAPD" = yes ] @@ -188,34 +197,42 @@ case "$1" in log_progress_msg "idmapd" start-stop-daemon --stop --oknodo --quiet \ --name rpc.idmapd - if [ $? != 0 ]; then - log_end_msg $? - exit $? + RET=$? + if [ $RET != 0 ]; then + log_end_msg $RET + exit $RET + fi + fi + if [ "$NEED_STATD" = yes ] + then + log_progress_msg "statd" + start-stop-daemon --stop --oknodo --quiet \ + --name rpc.statd + RET=$? + if [ $RET != 0 ]; then + log_end_msg $RET + exit $RET fi fi - log_progress_msg "statd" - start-stop-daemon --stop --oknodo --quiet \ - --name rpc.statd - if [ $? != 0 ]; then - log_end_msg $? - exit $? - 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 +241,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 ;;