From f383365493060b3dc429b4b79ef06cfa5e5494d9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 25 Sep 2007 02:29:56 +0000 Subject: [PATCH] Do not require portmap in netmount when nolock option is used with nfs mounts and fixup the test so that it actually works. --- ChangeLog | 5 +++++ init.d/netmount | 32 +++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27251303..92aaa489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2 + 24 Sep 2007; Mike Frysinger : + + Do not require portmap in netmount when nolock option is used with nfs + mounts and fixup the test so that it actually works. + 24 Sep 2007; Roy Marples : Fix pppd metric, #193574 thanks to Martin Väth. diff --git a/init.d/netmount b/init.d/netmount index c0f3e9f8..7ead6d9e 100755 --- a/init.d/netmount +++ b/init.d/netmount @@ -4,30 +4,32 @@ description="Mounts network shares according to /etc/fstab." -have_nfs() { - local IFS=\n x= +need_portmap() { + local mnt opts ret IFS=" +" set -- $(fstabinfo --fstype nfs,nfs4) - for x in "$@" ; do - ! fstabinfo --options "${x}" | grep -q noauto && return 0 + for mnt in "$@" ; do + case ,$(fstabinfo --options "${mnt}"), in + *,noauto,*|*,nolock,*) ;; + *) return 0;; + esac done return 1 } depend() { - local myneed= myuse= pmap="portmap" nfsmounts= x - [ -x /etc/init.d/rpcbind ] && pmap="rpcbind" - - # Only have Portmap as a dependency if there is a nfs mount in fstab that + # Only have portmap as a dependency if there is a nfs mount in fstab that # is set to mount at boot - if have_nfs ; then - myneed="${myneed} ${pmap}" - else - myuse="${myuse} ${pmap}" + local pmap="" + if need_portmap ; then + [ -x /etc/init.d/rpcbind ] \ + && pmap="rpcbind" \ + || pmap="portmap" fi config /etc/fstab - need net ${myneed} - use afc-client amd autofs dns nfs nfsmount ${myuse} + need net ${pmap} + use afc-client amd autofs dns nfs nfsmount portmap rpcbind } start() { @@ -45,7 +47,7 @@ start() { # Only try to mount NFS filesystems if portmap was started. # This is to fix "hang" problems for new users who do not # add portmap to the default runlevel. - if have_nfs && ! service_started "${pmap}" ; then + if need_portmap && ! service_started "${pmap}" ; then continue fi ;;