1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00
freebsd-ports/misc/zaptel/files/zaptel.in
Maxim Sobolev 371c080feb Allow list of modules to be loaded at startup to be configured via
zaptel_kmod_load rc.conf variable.

PR:		ports/115739
Submitted by:	Adam Jacob Muller <adam@adam.gs>
2008-08-15 18:48:56 +00:00

65 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: zaptel
# REQUIRE: NETWORKING
# KEYWORD: shutdown
# BEFORE: asterisk
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# zaptel_enable (bool): Set to NO by default.
# Set it to YES to enable zaptel.
#
. %%RC_SUBR%%
kmod_dir=%%PREFIX%%/lib/zaptel
name="zaptel"
rcvar=${name}_enable
start_cmd="zaptel_start"
stop_cmd="zaptel_stop"
load_rc_config $name
: ${zaptel_enable="NO"}
: ${zaptel_kmod_load="zaptel.ko qozap.ko tau32pci.ko wcfxo.ko wcfxs.ko wct1xxp.ko wct4xxp.ko wcte11xp.ko wcte12xp.ko"}
# Reverse list
zaptel_kmod_unload=""
for kmod in ${zaptel_kmod_load}
do
zaptel_kmod_unload="${kmod} ${zaptel_kmod_unload}"
done
zaptel_start()
{
echo -n " ${name}"
for kmod in ${zaptel_kmod_load}
do
if [ -e ${kmod_dir}/${kmod} ]
then
kldload ${kmod_dir}/${kmod} || exit 1
fi
done
%%PREFIX%%/bin/ztcfg
}
zaptel_stop()
{
echo -n " ${name}"
for kmod in ${zaptel_kmod_unload}
do
if [ -e ${kmod_dir}/${kmod} ]
then
kldunload ${kmod}
fi
done
}
run_rc_command "$1"