xref: /dragonfly/etc/rc.d/mountd (revision 9c600e7d)
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.1 2003/07/24 06:35:37 dillon Exp $
6#
7
8# PROVIDE: mountd
9# REQUIRE: NETWORKING mountall beforemountlkm nfsserver rpcbind quota
10# KEYWORD: DragonFly FreeBSD NetBSD
11
12. /etc/rc.subr
13
14name="mountd"
15rcvar=`set_rcvar`
16command="/usr/sbin/${name}"
17required_files="/etc/exports"
18start_precmd="mountd_precmd"
19extra_commands="reload"
20
21mountd_precmd()
22{
23	case ${OSTYPE} in
24	DragonFly)
25		if ! checkyesno rpcbind_enable  && \
26                    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
27                then
28                        force_depend rpcbind || return 1
29                fi
30                # mountd flags will differ depending on rc.conf settings
31                #
32                case ${nfs_server_enable} in
33                [Yy][Ee][Ss])
34                        if checkyesno weak_mountd_authentication; then
35                                mountd_flags="${mountd_flags} -n"
36                        fi
37                        ;;
38		 *)
39                        if checkyesno mountd_enable; then
40                                checkyesno weak_mountd_authentication && mountd_flags="-n"
41                        fi
42                esac
43                ;;
44
45	FreeBSD)
46		if ! checkyesno rpcbind_enable  && \
47		    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
48		then
49			force_depend rpcbind || return 1
50		fi
51
52		# mountd flags will differ depending on rc.conf settings
53		#
54		case ${nfs_server_enable} in
55		[Yy][Ee][Ss])
56			if checkyesno weak_mountd_authentication; then
57				mountd_flags="${mountd_flags} -n"
58			fi
59			;;
60		*)
61			if checkyesno mountd_enable; then
62				checkyesno weak_mountd_authentication && mountd_flags="-n"
63			fi
64		esac
65		;;
66	esac
67	rm -f /var/db/mountdtab
68	( umask 022 ; > /var/db/mountdtab )
69	return 0
70}
71
72load_rc_config $name
73run_rc_command "$1"
74