xref: /freebsd/libexec/rc/rc.d/mountd (revision 732a02b4e77866604a120a275c082bb6221bd2ff)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: mountd
7# REQUIRE: NETWORKING rpcbind quota
8# KEYWORD: nojail shutdown
9
10. /etc/rc.subr
11
12name="mountd"
13desc="Service remote NFS mount requests"
14rcvar="mountd_enable"
15command="/usr/sbin/${name}"
16pidfile="/var/run/${name}.pid"
17required_files="/etc/exports"
18start_precmd="mountd_precmd"
19extra_commands="reload"
20
21mountd_precmd()
22{
23	force_depend rpcbind || return 1
24
25	# mountd flags will differ depending on rc.conf settings
26	#
27	if checkyesno nfs_server_enable ; then
28		if checkyesno weak_mountd_authentication; then
29			rc_flags="${mountd_flags} -n"
30		fi
31	else
32		if checkyesno mountd_enable; then
33			checkyesno weak_mountd_authentication && rc_flags="-n"
34		fi
35	fi
36
37	if checkyesno zfs_enable; then
38		rc_flags="${rc_flags} /etc/exports /etc/zfs/exports"
39	fi
40
41	rm -f /var/db/mountdtab
42	( umask 022 ; > /var/db/mountdtab ) ||
43	    err 1 'Cannot create /var/db/mountdtab'
44}
45
46load_rc_config $name
47run_rc_command "$1"
48