blob: 15476b31d39904bf9ecbc07ea4f5ed6bfe27b682 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nmbd smbd
%%WINBIND%%# PROVIDE: winbindd
# REQUIRE: NETWORKING SERVERS named %%CUPS%%
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable samba:
#
#samba_enable="YES"
#
# or, for fine grain control
#
#nmbd_enable="YES"
#smbd_enable="YES"
%%WINBIND%%#winbindd_enable="YES"
#
. %%RC_SUBR%%
name=samba
rcvar=`set_rcvar`
load_rc_config $name
# Set defaults
samba_config=${samba_config:-"%%SAMBA_CONFIG%%"}
# Config file is required
if [ ! -r ${samba_config} ]; then
warn "${samba_config} is not readable."
case $1 in
force*) : ;;
*) exit 1 ;;
esac
fi
if test -n ${samba_enable:-""} && checkyesno samba_enable; then
nmbd_enable=${nmbd_enable:-"YES"}
smbd_enable=${smbd_enable:-"YES"}
%%WINBIND%% winbindd_enable=${winbindd_enable:-"YES"}
%%WINBIND%% # Check, that winbind is actally configured
%%WINBIND%% if [ ! "`egrep -i '(idmap.*uid|winbind.*uid)' ${samba_config} 2>/dev/null | egrep -v [\#\;]`" ]; then
%%WINBIND%% #warn "Winbind support is not configured"
%%WINBIND%% winbindd_enable="NO"
%%WINBIND%% fi
fi
# Hack until run_rc_command() get rid of exit()
samba_stop() {
pid=$(check_pidfile ${pidfile} ${command})
if [ -z ${pid} ]; then
echo "${name} not running? (check ${pidfile})."
return 1
fi
echo "Stopping ${command}."
kill -${sig_stop:-TERM} ${pid}
[ $? -ne 0 ] && [ -z "$rc_force" ] && return 1
wait_for_pids ${pid}
}
nmbd_precmd() {
# XXX: Never delete winbindd_idmap, winbindd_cache and group_mapping
if [ -d "%%SAMBA_LOCKDIR%%" ]; then
echo "Starting SAMBA: removing stale tdbs :"
for file in connections.tdb locking.tdb messages.tdb \
sessionid.tdb unexpected.tdb brlock.tdb \
namelist.debug
do
rm -vf "%%SAMBA_LOCKDIR%%/$file"
done
fi
}
# nmbd
name=nmbd
rcvar=`set_rcvar`
command="%%PREFIX%%/sbin/${name}"
required_dirs="%%SAMBA_LOCKDIR%%"
pidfile=%%SAMBA_RUNDIR%%/${name}.pid
start_precmd="nmbd_precmd"
stop_cmd="samba_stop"
# Defaults
nmbd_enable=${nmbd_enable:-"NO"}
nmbd_flags=${nmbd_flags:-"-D"}
command_args="-s ${samba_config}"
load_rc_config $name
run_rc_command "$1"
# smbd
name=smbd
rcvar=`set_rcvar`
command="%%PREFIX%%/sbin/${name}"
pidfile=%%SAMBA_RUNDIR%%/${name}.pid
start_precmd=":"
stop_cmd="samba_stop"
# Defaults
smbd_enable=${smbd_enable:-"NO"}
smbd_flags=${smbd_flags:-"-D"}
command_args="-s ${samba_config}"
load_rc_config $name
run_rc_command "$1"
%%WINBIND%%
%%WINBIND%%# winbindd
%%WINBIND%%name=winbindd
%%WINBIND%%rcvar=`set_rcvar`
%%WINBIND%%command="%%PREFIX%%/sbin/${name}"
%%WINBIND%%required_dirs="%%SAMBA_LOCKDIR%%"
%%WINBIND%%pidfile=%%SAMBA_RUNDIR%%/${name}.pid
%%WINBIND%%start_precmd=":"
%%WINBIND%%stop_cmd="samba_stop"
%%WINBIND%%# Defaults
%%WINBIND%%winbindd_enable=${winbindd_enable:-"NO"}
%%WINBIND%%winbindd_flags=${winbindd_flags:-""}
%%WINBIND%%command_args="-s ${samba_config}"
%%WINBIND%%
%%WINBIND%%load_rc_config $name
%%WINBIND%%run_rc_command "$1"
|