From f383365493060b3dc429b4b79ef06cfa5e5494d9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 25 Sep 2007 02:29:56 +0000 Subject: Do not require portmap in netmount when nolock option is used with nfs mounts and fixup the test so that it actually works. --- init.d/netmount | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'init.d/netmount') 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 ;; -- cgit v1.2.3