diff --git a/nfs-utils.spec b/nfs-utils.spec index 6c477f0..c97d2c6 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser Name: nfs-utils URL: http://sourceforge.net/projects/nfs Version: 1.1.3 -Release: 4%{?dist} +Release: 5%{?dist} Epoch: 1 # group all 32bit related archs @@ -265,6 +265,10 @@ fi %attr(4755,root,root) /sbin/umount.nfs4 %changelog +* Tue Sep 16 2008 Steve Dickson 1.1.3-5 +- Reworked init scripts so service will be able to + stop when some of the checks fail. (bz 462508) + * Thu Aug 28 2008 Steve Dickson 1.1.3-4 - Added in a number of up upstream patches (101 thru 110). diff --git a/nfs.init b/nfs.init index b4f2747..73f42ac 100755 --- a/nfs.init +++ b/nfs.init @@ -14,41 +14,44 @@ . /etc/rc.d/init.d/functions # Source networking configuration. -if [ ! -f /etc/sysconfig/network ]; then - exit 6 -fi - -. /etc/sysconfig/network - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 6 - -[ -x /usr/sbin/rpc.nfsd ] || exit 5 -[ -x /usr/sbin/rpc.mountd ] || exit 5 -[ -x /usr/sbin/exportfs ] || exit 5 - -# Don't fail if /etc/exports doesn't exist; create a bare-bones version and continue. -[ -r /etc/exports ] || \ - { touch /etc/exports && chmod u+rw,g+r,o+r /etc/exports ; } || \ - { echo "/etc/exports does not exist" ; exit 0 ; } - -# Check for and source configuration file otherwise set defaults -[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs - -[ -z "$MOUNTD_NFS_V2" ] && MOUNTD_NFS_V2=default -[ -z "$MOUNTD_NFS_V3" ] && MOUNTD_NFS_V3=default - -# Number of servers to be started by default -[ -z "$RPCNFSDCOUNT" ] && RPCNFSDCOUNT=8 - -# Remote quota server -[ -z "$RQUOTAD" ] && RQUOTAD=`type -path rpc.rquotad` +[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network RETVAL=0 # See how we were called. case "$1" in start) + + # Check that networking is up. + [ "${NETWORKING}" != "yes" ] && exit 6 + + [ -x /usr/sbin/rpc.nfsd ] || exit 5 + [ -x /usr/sbin/rpc.mountd ] || exit 5 + [ -x /usr/sbin/exportfs ] || exit 5 + + # Make sure the rpc.mountd is not already running. + if status rpc.mountd > /dev/null ; then + exit 0 + fi + + # Don't fail if /etc/exports doesn't exist; create a bare-bones + # version and continue. + [ -r /etc/exports ] || \ + { touch /etc/exports && chmod u+rw,g+r,o+r /etc/exports ; } || \ + { echo "/etc/exports does not exist" ; exit 0 ; } + + # Check for and source configuration file otherwise set defaults + [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs + + [ -z "$MOUNTD_NFS_V2" ] && MOUNTD_NFS_V2=default + [ -z "$MOUNTD_NFS_V3" ] && MOUNTD_NFS_V3=default + + # Number of servers to be started by default + [ -z "$RPCNFSDCOUNT" ] && RPCNFSDCOUNT=8 + + # Remote quota server + [ -z "$RQUOTAD" ] && RQUOTAD=`type -path rpc.rquotad` + # Start daemons. [ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd start diff --git a/nfslock.init b/nfslock.init index 5639b12..62f0065 100755 --- a/nfslock.init +++ b/nfslock.init @@ -22,17 +22,20 @@ LOCKDARG="" STATDARG="" [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs -. /etc/sysconfig/network - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 6 - -[ -x /sbin/rpc.statd ] || exit 5 +[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network RETVAL=0 - start() { - if [ ! -f /var/lock/subsys/nfslock ]; then + # Check that networking is up. + [ "${NETWORKING}" = "no" ] && exit 6 + + [ -x /sbin/rpc.statd ] || exit 5 + + # Make sure the rpc.statd is not already running. + if status rpc.statd > /dev/null ; then + exit 0 + fi + rm -f /var/lock/subsys/nfslock # Make sure locks are recovered rm -f /var/run/sm-notify.pid @@ -63,7 +66,6 @@ start() { RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock - fi return $RETVAL } diff --git a/rpcgssd.init b/rpcgssd.init index 4c46c32..5fea5e2 100755 --- a/rpcgssd.init +++ b/rpcgssd.init @@ -12,24 +12,14 @@ . /etc/init.d/functions # Source networking configuration. -if [ ! -f /etc/sysconfig/network ]; then - exit 6 -fi -. /etc/sysconfig/network - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 6 - -[ ! -x /usr/sbin/rpc.gssd ] && exit 5 +[ -f /etc/sysconfig/network ]&& . /etc/sysconfig/network # Check for and source configuration file otherwise set defaults [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs + +# See if we are configured to start [ "${SECURE_NFS}" != "yes" ] && exit 6 -# List of kernel modules to load -[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5" - - # Try to use machine credentials by default RETVAL=0 LOCKFILE=/var/lock/subsys/rpcgssd @@ -37,14 +27,25 @@ prog="rpc.gssd" case "$1" in start|condstart) + # Check that networking is up. + [ "${NETWORKING}" != "yes" ] && exit 6 + [ ! -x /usr/sbin/rpc.gssd ] && exit 5 + # Make sure the daemon is not already running. if status $prog > /dev/null ; then exit 0 fi - rm -f $LOCKFILE + # During condstart need to check again to see + # if we are configured to start + [ "${SECURE_NFS}" != "yes" ] && exit 6 + + rm -f $LOCKFILE echo -n $"Starting RPC gssd: " + # List of kernel modules to load + [ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5" + # Make sure the rpc_pipefs filesystem is available [ "${RPCMTAB}" != "noload" ] && { RPCMTAB=`grep -v '^#' /proc/mounts | \ diff --git a/rpcidmapd.init b/rpcidmapd.init index 2896379..12362d4 100755 --- a/rpcidmapd.init +++ b/rpcidmapd.init @@ -12,15 +12,7 @@ . /etc/init.d/functions # Source networking configuration. -if [ ! -f /etc/sysconfig/network ]; then - exit 6 -fi -. /etc/sysconfig/network - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 6 - -[ ! -x /usr/sbin/rpc.idmapd ] && exit 5 +[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network # Check for and source configuration file otherwise set defaults [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs @@ -31,11 +23,21 @@ prog="rpc.idmapd" case "$1" in start|condstart) + # Check that networking is up. + [ "${NETWORKING}" != "yes" ] && exit 6 + + [ ! -x /usr/sbin/rpc.idmapd ] && exit 5 + # Make sure the daemon is not already running. [ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && { killproc $prog "-SIGHUP" > /dev/null exit 0 } + [ "$1" = "start" ] && { + if status $prog > /dev/null ; then + exit 0 + fi + } rm -f $LOCKFILE echo -n $"Starting RPC idmapd: " @@ -59,8 +61,6 @@ case "$1" in } } - # Make sure the mount worked. - # Start daemon. daemon $prog ${RPCIDMAPDARGS} RETVAL=$? diff --git a/rpcsvcgssd.init b/rpcsvcgssd.init index 91e6cb2..12f0b62 100755 --- a/rpcsvcgssd.init +++ b/rpcsvcgssd.init @@ -12,22 +12,13 @@ . /etc/init.d/functions # Source networking configuration. -if [ ! -f /etc/sysconfig/network ]; then - exit 6 -fi -. /etc/sysconfig/network - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 6 - -[ ! -x /usr/sbin/rpc.svcgssd ] && exit 5 +[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network # Check for and source configuration file otherwise set defaults [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs -[ "${SECURE_NFS}" != "yes" ] && exit 6 -# List of kernel modules to load -[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5" +# See if we are configured to start +[ "${SECURE_NFS}" != "yes" ] && exit 6 RETVAL=0 LOCKFILE=/var/lock/subsys/rpcsvcgssd @@ -35,6 +26,11 @@ prog="rpc.svcgssd" case "$1" in start|condstart) + # Check that networking is up. + [ "${NETWORKING}" != "yes" ] && exit 6 + [ "${SECURE_NFS}" != "yes" ] && exit 6 + [ ! -x /usr/sbin/rpc.svcgssd ] && exit 5 + # Make sure the daemon is not already running. if status $prog > /dev/null ; then exit 0 @@ -42,6 +38,9 @@ case "$1" in rm -f $LOCKFILE echo -n $"Starting RPC svcgssd: " + # List of kernel modules to load + [ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5" + # Make sure the rpc_pipefs filesystem is available [ "${RPCMTAB}" != "noload" ] && {