Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 427996
Collapse All | Expand All

(-)a/init.d/netmount.in (-65 / +22 lines)
Lines 4-84 Link Here
4
4
5
description="Mounts network shares according to /etc/fstab."
5
description="Mounts network shares according to /etc/fstab."
6
6
7
need_portmap()
8
{
9
	local opts=
10
	local IFS="
11
"
12
	set -- $(fstabinfo --options --fstype nfs,nfs4)
13
	for opts; do
14
		case ,$opts, in
15
			*,noauto,*|*,nolock,*);;
16
			*) return 0;;
17
		esac
18
	done
19
	return 1
20
}
21
22
need_idmap()
23
{
24
	local opts=
25
	local IFS="
26
"
27
	set -- $(fstabinfo --options --fstype nfs4)
28
	for opts; do
29
		case ,$opts, in
30
			*,noauto,*|*,nolock,*);;
31
			*) return 0;;
32
		esac
33
	done
34
	return 1
35
}
36
37
depend()
7
depend()
38
{
8
{
39
	# Only have portmap as a dependency if there is a nfs mount in fstab
40
	# that is set to mount at boot
41
	local pmap=
42
	if need_portmap; then
43
		pmap="rpc.statd"
44
		[ -x @SYSCONFDIR@/init.d/rpcbind ] \
45
			&& pmap="$pmap rpcbind" \
46
			|| pmap="$pmap portmap"
47
	fi
48
49
	# Only have rpc.idmapd as a dependency if there is a nfs4 mount in fstab
50
	# that is set to mount at boot
51
	if need_idmap; then
52
		pmap="$pmap rpc.idmapd"
53
	fi
54
55
	config /etc/fstab
9
	config /etc/fstab
56
	need net $pmap
10
	need net
57
	use afc-client amd autofs openvpn
11
	use afc-client amd autofs openvpn
58
	use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
12
	use dns
59
	keyword -jail -prefix -vserver
13
	keyword -jail -prefix -vserver
60
}
14
}
61
15
62
start()
16
start()
63
{
17
{
64
	local myneed= myuse= pmap="portmap" nfsmounts=
65
	[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"
66
67
	local x= fs= rc=
18
	local x= fs= rc=
68
	for x in $net_fs_list $extra_net_fs_list; do
19
	for x in $net_fs_list $extra_net_fs_list; do
69
		case "$x" in
20
		case "$x" in
70
			nfs|nfs4)
21
			nfs|nfs4)
71
			# If the nfsmount script took care of the nfs
22
			# We do not handle NFS file systems here, because NFS
72
			# filesystems, then there's no point in trying
23
			# requires daemons on the client side, so we allow nfs-utils
73
			# them twice
24
			# to handle that.
74
			service_started nfsmount && continue
25
			continue
75
76
			# Only try to mount NFS filesystems if portmap was
77
			# started. This is to fix "hang" problems for new
78
			# users who do not add portmap to the default runlevel.
79
			if need_portmap && ! service_started "$pmap"; then
80
				continue
81
			fi
82
			;;
26
			;;
83
		esac
27
		esac
84
		fs="$fs${fs:+,}$x"
28
		fs="$fs${fs:+,}$x"
Lines 103-109 stop() Link Here
103
	. "$RC_LIBEXECDIR"/sh/rc-mount.sh
47
	. "$RC_LIBEXECDIR"/sh/rc-mount.sh
104
48
105
	for x in $net_fs_list $extra_net_fs_list; do
49
	for x in $net_fs_list $extra_net_fs_list; do
106
		fs="$fs${fs:+,}$x"
50
		case "$x" in
51
			nfs|nfs4)
52
				continue
53
				;;
54
			*)
55
				fs="$fs${fs:+,}$x"
56
				;;
57
		esac
107
	done
58
	done
108
	if [ -n "$fs" ]; then
59
	if [ -n "$fs" ]; then
109
		umount -at $fs || eerror "Failed to simply unmount filesystems"
60
		umount -at $fs || eerror "Failed to simply unmount filesystems"
Lines 112-118 stop() Link Here
112
	eindent
63
	eindent
113
	fs=
64
	fs=
114
	for x in $net_fs_list $extra_net_fs_list; do
65
	for x in $net_fs_list $extra_net_fs_list; do
115
		fs="$fs${fs:+|}$x"
66
		case "$x" in
67
			nfs|nfs4)
68
				continue
69
				;;
70
			*)
71
				fs="$fs${fs:+|}$x"
72
				;;
73
		esac
116
	done
74
	done
117
	[ -n "$fs" ] && fs="^($fs)$"
75
	[ -n "$fs" ] && fs="^($fs)$"
118
	do_unmount umount ${fs:+--fstype-regex} $fs --netdev
76
	do_unmount umount ${fs:+--fstype-regex} $fs --netdev
119
- 

Return to bug 427996