aboutsummaryrefslogtreecommitdiff
path: root/net/samba4-devel/files/samba4.in
blob: 5d7d74691ec4bf1ee0a494b48de3f343568c2ac7 (plain) (blame)
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
51
52
53
54
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: samba4
# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
#samba4_enable="YES"
#
# Configuration file can be set with:
#samba4_config="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%"
#

. /etc/rc.subr

name="samba4"
rcvar=$(set_rcvar)

load_rc_config "${name}"

# Defaults
samba4_enable=${samba4_enable:=NO}
samba4_flags=${samba4_flags=--daemon}
samba4_config_default="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%"
samba4_config=${samba4_config=${samba4_config_default}}
samba4_configfile_arg=${samba4_config:+--configfile="${samba4_config}"}			#"
testparm_command="%%PREFIX%%/bin/testparm --suppress-prompt --verbose ${samba4_configfile_arg}"
# Fetch parameters from configuration file
samba4_lockdir=$(${testparm_command} --parameter-name='lock directory' 2>/dev/null)
# Runtime options
restart_precmd="samba4_checkconfig"
command="%%PREFIX%%/sbin/${name}"
command_args=${samba4_configfile_arg}
# Requirements
required_files="${samba4_config}"
required_dirs="${samba4_lockdir}"

samba4_checkconfig() {
    echo -n "Performing sanity check on Samba configuration: "
    if ${testparm_command} >/dev/null 2>&1; then
	echo "OK"
    else
	echo "FAILED"
	return 1
    fi
}

run_rc_command "$1"