freebsd-ports/misc/dahdi-kmod/files/dahdi.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

80 lines
1.3 KiB
Bash

#!/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
%%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"