summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/mountd
blob: 6f82601799f5d1e070830938996b8d94bd381c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: mountd
# REQUIRE: NETWORKING nfsserver rpcbind quota
# KEYWORD: nojail shutdown

. /etc/rc.subr

name="mountd"
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/exports"
start_precmd="mountd_precmd"
extra_commands="reload"

mountd_precmd()
{
	if ! checkyesno rpcbind_enable  && \
	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
	then
		force_depend rpcbind || return 1
	fi

	# mountd flags will differ depending on rc.conf settings
	#
	if checkyesno nfs_server_enable ; then
		if checkyesno weak_mountd_authentication; then
			rc_flags="${mountd_flags} -n"
		fi
	else
		if checkyesno mountd_enable; then
			checkyesno weak_mountd_authentication && rc_flags="-n"
		fi
	fi

	if checkyesno zfs_enable; then
		rc_flags="${rc_flags} /etc/exports /etc/zfs/exports"
	fi

	rm -f /var/db/mountdtab
	( umask 022 ; > /var/db/mountdtab )
	return 0
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud