diff options
author | Tony Vroon <chainsaw@gentoo.org> | 2011-09-02 09:38:44 +0000 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2011-09-02 09:38:44 +0000 |
commit | b6fdbcc133e92c231b75869f18826ef2b89f5145 (patch) | |
tree | 022d0372fb2c94e842c2107ae863f28f09ccb3c3 | |
parent | Stable on alpha, bug #380475 (diff) | |
download | gentoo-2-b6fdbcc133e92c231b75869f18826ef2b89f5145.tar.gz gentoo-2-b6fdbcc133e92c231b75869f18826ef2b89f5145.tar.bz2 gentoo-2-b6fdbcc133e92c231b75869f18826ef2b89f5145.zip |
Version bump. Newly updated autoconfig functionality by Jaco Kroon closes bug #374177.
(Portage version: 2.1.10.11/cvs/Linux x86_64)
-rw-r--r-- | net-misc/dahdi-tools/ChangeLog | 9 | ||||
-rw-r--r-- | net-misc/dahdi-tools/dahdi-tools-2.5.0.ebuild | 52 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.conf2 | 40 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.init2 | 225 |
4 files changed, 325 insertions, 1 deletions
diff --git a/net-misc/dahdi-tools/ChangeLog b/net-misc/dahdi-tools/ChangeLog index 8f8720cc7433..dcd307150c42 100644 --- a/net-misc/dahdi-tools/ChangeLog +++ b/net-misc/dahdi-tools/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-misc/dahdi-tools # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dahdi-tools/ChangeLog,v 1.14 2011/09/02 09:03:33 chainsaw Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dahdi-tools/ChangeLog,v 1.15 2011/09/02 09:38:44 chainsaw Exp $ + +*dahdi-tools-2.5.0 (02 Sep 2011) + + 02 Sep 2011; Tony Vroon <chainsaw@gentoo.org> +dahdi-tools-2.5.0.ebuild, + +files/dahdi-autoconf.conf2, +files/dahdi-autoconf.init2: + Version bump. Newly updated autoconfig functionality by Jaco Kroon closes bug + #374177. 02 Sep 2011; Tony Vroon <chainsaw@gentoo.org> -dahdi-tools-2.1.0.2.ebuild, -files/dahdi-tools-2.1.0.2-asneeded.patch, -dahdi-tools-2.2.0-r1.ebuild, diff --git a/net-misc/dahdi-tools/dahdi-tools-2.5.0.ebuild b/net-misc/dahdi-tools/dahdi-tools-2.5.0.ebuild new file mode 100644 index 000000000000..4e36b01cf4f4 --- /dev/null +++ b/net-misc/dahdi-tools/dahdi-tools-2.5.0.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dahdi-tools/dahdi-tools-2.5.0.ebuild,v 1.1 2011/09/02 09:38:44 chainsaw Exp $ + +EAPI=3 + +inherit base + +DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi" +HOMEPAGE="http://www.asterisk.org" +SRC_URI="http://downloads.digium.com/pub/telephony/dahdi-tools/releases/${P}.tar.gz + mirror://gentoo/gentoo-dahdi-tools-patchset-0.2.tar.bz2" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="ppp" + +DEPEND="dev-libs/newt + ppp? ( net-dialup/ppp ) + net-misc/dahdi + !net-misc/zaptel + >=sys-kernel/linux-headers-2.6.35 + virtual/libusb:0" +RDEPEND="${DEPEND}" + +EPATCH_SUFFIX="diff" +PATCHES=( "${WORKDIR}/dahdi-tools-patchset" ) + +src_compile() { + default_src_compile + emake tests || die "Failed compiling test utilities" + if use ppp; then + emake -C ppp || die "Failed compiling ppp plugin" + fi +} + +src_install() { + emake DESTDIR="${D}" install || die "Failed to install binaries" + if use ppp; then + emake DESTDIR="${D}" -C ppp install || die "Failed to install ppp plugin" + fi + emake DESTDIR="${D}" config || die "Failed to install configuration files" + + dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen + dosbin hdlcverify timertest + + # install init scripts + newinitd "${FILESDIR}"/dahdi.init2 dahdi + newinitd "${FILESDIR}"/dahdi-autoconf.init2 dahdi-autoconf + newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf +} diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.conf2 b/net-misc/dahdi-tools/files/dahdi-autoconf.conf2 new file mode 100644 index 000000000000..a46545231911 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.conf2 @@ -0,0 +1,40 @@ +# Global settings +# Set this to your country code. +DAHDI_ZONE=za +DAHDI_ECHOCAN=oslec # mg2,jpah,kb1,sec,sec2 (there may be more, we recommend oslec) + +# Settings for analog +#Analog signal types, one of: +# ks - KewlStart (recommended, default) +# ls - LoopStart +# gs - GroundStart + +# Signalling to be used on FXO ports +DAHDI_FXO_SIGNALLING=ks + +# Signalling to be used on FXS ports +DAHDI_FXS_SIGNALLING=ks + +# Whether or not to echocan: +DAHDI_FXO_ECHOCAN=yes +DAHDI_FXS_ECHOCAN=yes + +# These settings will be used for BRI cards. +# Known options: B8ZS,AMI,HDB3 +DAHDI_BRI_CODING=AMI + +# Known options: ESF,D4,CCS,CRC4 +DAHDI_BRI_FRAMING=CCS + +# Our experience is that it's not required (still defaults to yes) +DAHDI_BRI_NT_ECHOCAN=yes +DAHDI_BRI_TE_ECHOCAN=yes + +# These settings are for PRI cards. Note that only E1 currently supported. +DAHDI_E1_CPE_ECHOCAN=yes +DAHDI_E1_NET_ECHOCAN=yes + +# PRI will default to CPE mode (remote end provides signalling). +# If you really want to provide signalling set the appropriate spans +# here (eg, set span 1 to NET mode). +#PRI_SPAN_1_NET=yes diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.init2 b/net-misc/dahdi-tools/files/dahdi-autoconf.init2 new file mode 100644 index 000000000000..1ebe8ec28ea8 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.init2 @@ -0,0 +1,225 @@ +#!/sbin/runscript +# Copyright 1999-2011 Ultimate Linux Solutions CC +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before dahdi +} + +dahdi_load_modules() { + local hwlist loc status mod mod_vname pciid desc + + hwlist=$(/usr/sbin/dahdi_hardware) + + if [ -z "${hwlist}" ]; then + einfo "No digium hardware found." + ebegin "Loading module dahdi_dummy" + /sbin/modprobe dahdi_dummy + eend $? + return + fi + + echo "${hwlist}" | while read loc mod pciid desc; do + status="${mod:${#mod}-1:1}" + mod="${mod%[+-]}" + mod_vname="mod_${mod}" + + einfo "Found $desc at $loc (module: $mod)" + + if [ "${status}" = "-" -a "${!mod_vname-notloaded}" = "notloaded" ]; then + ebegin "Loading module $mod" + /sbin/modprobe $mod + eend + + [ $? -eq 0 ] && eval "$mod_vname=loaded" + fi + done +} + +dahdi_module_unload() { + local mod=$1 s + [ -d /sys/module/${mod} ] || return 0 + + for s in $(find /sys/module/${mod}/holders -type l); do + dahdi_module_unload $(basename $s) + done + + ebegin "Removing dahdi module: $mod" + /sbin/rmmod $mod + eend $? +} + +dahdi_gen_fxo_config() { + local port=$1 + + echo "fxs${DAHDI_FXO_SIGNALLING-ks}=${port}" + [ "${DAHDI_FXO_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}" +} + +dahdi_gen_fxs_config() { + local port=$1 + + echo "fxo${DAHDI_FXO_SIGNALLING-ks}=${port}" + [ "${DAHDI_FXS_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}" +} + +dahdi_gen_bri_te_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}" + echo "bchan=${basechan}-$(( basechan + 1 ))" + echo "hardhdlc=$(( basechan + 2 ))" + [ "${DAHDI_BRI_TE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))" +} + +dahdi_gen_bri_nt_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}" + echo "bchan=${basechan}-$(( basechan + 1 ))" + echo "hardhdlc=$(( basechan + 2 ))" + [ "${DAHDI_BRI_NT_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))" +} + +dahdi_gen_e1_cpe_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}" + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 15 ))" + [ "${DAHDI_E1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_gen_e1_net_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}" + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 15 ))" + [ "${DAHDI_E1_NET_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_conf_span() { + local span=$1 + local type=$2 + local desc=$3 + local port=$4 + local basechan=$5 + local vname="" + + # Analog we need to deal with on a port-by-port basis. + [ "${type}" = "analog" ] && return 0 + + echo -e "\n# ${desc}" + case "${type}" in + digital-TE) + dahdi_gen_bri_te_config "${span}" "${port}" "${basechan}" + ;; + digital-NT) + dahdi_gen_bri_nt_config "${span}" "${port}" "${basechan}" + ;; + digital-E1) + # Use CPE by default. Unfortunately there is no easy + # way to detect CPE vs NET as far as I know and specifying + # in a config that you want NET mode seems the sanest way. + vname="PRI_SPAN_${span}_NET" + if [[ "${!vname}" = [Yy][Ee][Ss] ]]; then + dahdi_gen_e1_net_config "${span}" "${port}" "${basechan}" + else + dahdi_gen_e1_cpe_config "${span}" "${port}" "${basechan}" + fi + ;; + *) + echo "# Don't know how to configure this (type=${type})." + echo "# Please file a bug on bugs.gentoo.org and add jaco@uls.co.za as CC." + ;; + esac +} + +dahdi_gen_config() { + local type manufacturer devicetype basechan aport atype + local span= + local tfile="$(mktemp)" + local sfile="$(mktemp)" + local plocation="" + local isdnport=0 + + /usr/sbin/dahdi_scan > "${sfile}" + exec 3<"${sfile}" + + echo "# Automatically dahdi-autoconf generated file ($(date))." >> "${tfile}" + echo "# This file WILL get regenerated whenever you restart dahdi-autoconf." >> "${tfile}" + + while read LINE <&3; do + case "$LINE" in + [[]*[]]) + [ -n "${span}" ] && dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >> "${tfile}" + span="${LINE%?}" + span="${span#?}" + ;; + type=*|manufacturer=*|devicetype=*|basechan=*|name=*) + eval "${LINE%%=*}='${LINE#*=}'" + ;; + location=*) + eval "${LINE%%=*}='${LINE#*=}'" + if [ "${location}" == "${plocation}" ]; then + (( ++isdnport )) + else + plocation="${location}" + isdnport=1 + fi + ;; + port=*) + # For analog cards only. + aport="${LINE#*=}"; aport="${aport%,*}" + atype="${LINE#*,}" + [ "${aport}" -eq "${basechan}" ] && echo -e "\n# ${manufacturer} ${devicetype} (${name})" >> "${tfile}" + case "${atype}" in + FXO) + dahdi_gen_fxo_config $aport >> "${tfile}" + ;; + FXS) + dahdi_gen_fxs_config $aport >> "${tfile}" + ;; + esac + ;; + esac + done + + [ -n "${span}" ] && dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >> "${tfile}" + + echo -e "\nloadzone = ${DAHDI_ZONE}\ndefaultzone = ${DAHDI_ZONE}\n## END OF AUTOCONFIGURED FILE ##" >> "${tfile}" + + exec 3<&- + + rm -f "${sfile}" + mv /etc/dahdi/system.conf /etc/dahdi/system.conf.bck + mv "${tfile}" /etc/dahdi/system.conf +} + +start() { + dahdi_load_modules + + if [ ! -r /dev/dahdi/ctl ]; then + eerror "No DAHDI compatible cards detected." + return 1 + fi + + ebegin "Generating DAHDI Configuration" + dahdi_gen_config + eend $? +} + +stop() { + dahdi_module_unload dahdi +} |