aboutsummaryrefslogtreecommitdiff
path: root/init.d/netmount
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-09-25 02:29:56 +0000
committerMike Frysinger <vapier@gentoo.org>2007-09-25 02:29:56 +0000
commitf383365493060b3dc429b4b79ef06cfa5e5494d9 (patch)
treefa79fd377a51aa1e27fc05102e4128da5479049d /init.d/netmount
parent450cc13a5c3d080668d46ea16d865459cc9fcec3 (diff)
Do not require portmap in netmount when nolock option is used with nfs mounts and fixup the test so that it actually works.
Diffstat (limited to 'init.d/netmount')
-rwxr-xr-xinit.d/netmount32
1 files changed, 17 insertions, 15 deletions
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
;;