blob: 91ad7afcc1386068a223bb627f56269719b3bfd6 (
plain)
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
|
#!/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
# - dahdi_transcode
# - wcb4xxp
# - wcfxo
# - wct4xxp
# - wctc4xxp
# - wctdm
# - wctdm24xxp
# - wcte11xp
# - wcte12xp
#
# Example:
#
# dahdi_enable="YES"
# dahdi_modules="wct4xxp"
#
. /etc/rc.subr
name="dahdi"
rcvar=dahdi_enable
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
for m in ${dahdi_modules}; do
dahdi_modules_unload="$m ${dahdi_modules_unload}"
done
dahdi_start()
{
echo "Starting ${name}."
# load kernel modules
kldconfig -mf ${kmod_dir}
for m in ${dahdi_modules}; do
kldload $m || exit 1
done
# configure devfs
devfs rule apply path 'dahdi/*' mode 0664 user root group dahdi
# run configuration utilities
/bin/sleep 5
%%PREFIX%%/sbin/dahdi_cfg
if [ -r %%PREFIX%%/etc/fxotune.conf ]; then
echo "Starting fxotune."
%%PREFIX%%/sbin/fxotune -s
fi
}
dahdi_stop()
{
echo -n " ${name}"
for m in ${dahdi_modules_unload}; do
kldunload $m
done
}
run_rc_command "$1"
|