aboutsummaryrefslogtreecommitdiff
path: root/misc/dahdi/files/dahdi.in
blob: ad50745924f252a93b7470edb9171e125cbe9820 (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
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dahdi
# REQUIRE: NETWORKING
# KEYWORD: shutdown
# BEFORE: asterisk
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# dahdi_enable (bool):			YES/NO (default: NO)
# dahdi_modules (list of strings):	dahdi modules to load at boot (default: dahdi)
#	Valid modules are: dahdi, wct4xxp, wcb4xxp
#
# Example:
#
# dahdi_enable="YES"
# dahdi_modules="wct4xxp"
#

. %%RC_SUBR%%

name="dahdi"
rcvar=`set_rcvar`

start_cmd="dahdi_start"
stop_cmd="dahdi_stop"
load_rc_config $name
: ${dahdi_enable="NO"}
: ${dahdi_modules="dahdi"}

kmod_dir=%%PREFIX%%/lib/dahdi
# reverse list
dahdi_modules_unload=""
for m in ${dahdi_modules}; do
	dahdi_modules_unload="$m ${dahdi_modules_unload}"
done

dahdi_start()
{
	echo -n " ${name}"

	kldconfig -mf ${kmod_dir}
	for m in ${dahdi_modules}; do
		kldload $m || exit 1
	done
	%%PREFIX%%/sbin/dahdi_cfg
}

dahdi_stop()
{
        echo -n " ${name}"
	for m in ${dahdi_modules_unload}; do
		kldunload $m
	done
}

run_rc_command "$1"