mkinitrd - add tool and infrastructure for initrd
[dragonfly.git] / etc / rc.d / mountd
1 #!/bin/sh
2 #
3 # $NetBSD: mountd,v 1.11 2002/01/31 01:26:06 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/mountd,v 1.9 2002/10/12 10:31:31 schweikh Exp $
5 # $DragonFly: src/etc/rc.d/mountd,v 1.6 2005/11/19 21:47:32 swildner Exp $
6 #
7
8 # PROVIDE: mountd
9 # REQUIRE: NETWORKING mountcritremote nfsserver rpcbind quota
10 # KEYWORD: shutdown
11
12 . /etc/rc.subr
13
14 name="mountd"
15 rcvar=`set_rcvar`
16 command="/sbin/${name}"
17 pidfile="/var/run/${name}.pid"
18 required_files="/etc/exports"
19 start_precmd="mountd_precmd"
20 extra_commands="reload"
21
22 mountd_precmd()
23 {
24         if ! checkyesno rpcbind_enable  && \
25             ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
26         then
27                 force_depend rpcbind || return 1
28         fi
29
30         # mountd flags will differ depending on rc.conf settings
31         #
32         if checkyesno nfs_server_enable; then
33                 if checkyesno weak_mountd_authentication; then
34                         rc_flags="${mountd_flags} -n"
35                 fi
36         else
37                 if checkyesno mountd_enable; then
38                         checkyesno weak_mountd_authentication && rc_flags="-n"
39                 fi
40         fi
41
42         rm -f /var/db/mountdtab
43         ( umask 022 ; > /var/db/mountdtab )
44         return 0
45 }
46
47 load_rc_config $name
48 run_rc_command "$1"