diff options
author | Jaco Kroon <jaco@uls.co.za> | 2022-06-15 15:06:51 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-06-30 21:46:42 +0000 |
commit | 927a9ab6f7f379ad727928be6d7174cd62cce398 (patch) | |
tree | 5376ebb86e4c198e804f025b798c042b92296540 /net-misc/dahdi-tools | |
parent | net-misc/dahdi: 3.1.0-r4 (diff) | |
download | gentoo-927a9ab6f7f379ad727928be6d7174cd62cce398.tar.gz gentoo-927a9ab6f7f379ad727928be6d7174cd62cce398.tar.bz2 gentoo-927a9ab6f7f379ad727928be6d7174cd62cce398.zip |
net-misc/dahdi-tools: revbump to fix bugs.
No major changes.
Biggest was to add T1 support into dahdi-autoconf.
Closes: https://bugs.gentoo.org/841428
Closes: https://bugs.gentoo.org/852779
Closes: https://bugs.gentoo.org/852785
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Closes: https://github.com/gentoo/gentoo/pull/25852
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-misc/dahdi-tools')
-rw-r--r-- | net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild | 70 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3 | 271 |
2 files changed, 341 insertions, 0 deletions
diff --git a/net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild new file mode 100644 index 000000000000..4cdea940512c --- /dev/null +++ b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools bash-completion-r1 perl-functions udev + +DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi" +HOMEPAGE="https://www.asterisk.org" +SRC_URI="https://downloads.asterisk.org/pub/telephony/${PN}/releases/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86" +IUSE="ppp" +PATCHES=( + "${FILESDIR}/dahdi-nondigium-blacklist.patch" + "${FILESDIR}/dahdi-tools-3.1.0-parallel-make-no-config.patch" + "${FILESDIR}/dahdi-tools-3.1.0-fno-common.patch" + "${FILESDIR}/dahdi-tools-3.1.0-execinfo.patch" + "${FILESDIR}/dahdi-tools-3.1.0-cplusplusexternc.patch" +) + +DEPEND="dev-libs/newt + net-misc/dahdi + sys-kernel/linux-headers + virtual/libusb:0 + ppp? ( net-dialup/ppp:= )" +RDEPEND="${DEPEND} + dev-lang/perl:= + dev-perl/CGI" +BDEPEND="dev-lang/perl + sys-apps/file" + +src_prepare() { + default + eautoreconf +} + +src_configure() { + econf $(use_with ppp) --with-perllib="$(perl_get_vendorlib)" + sed -re 's/ -Werror($|[[:space:]])//' -i xpp/oct612x/Makefile.in || die "sed to eliminate -Werror failed." + sed -re '/[[:space:]]*-Werror[[:space:]]*\\$/ d' -i xpp/xtalk/Makefile || die "sed to eliminate -Werror failed." +} + +src_install() { + local bashcompdir="$(get_bashcompdir)" + local bashcmd bashcmdtarget + + emake DESTDIR="${ED}" bashcompdir="${bashcompdir}" udevrulesdir="$(get_udevdir)/rules.d" install + emake DESTDIR="${ED}" install-config + + dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest + + # install init scripts + newinitd "${FILESDIR}"/dahdi.init2 dahdi + newinitd "${FILESDIR}"/dahdi-autoconf.init-3.1.0-r3 dahdi-autoconf + newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf + + bashcomp_alias dahdi $(sed -nre 's/^complete -F .* //p' "${ED}${bashcompdir}/dahdi" || + die "Error parsing dahdi bash completion file for commands") + + rm "${ED}"/usr/$(get_libdir)/libtonezone.a || die "Unable to remove static libs from install." + # Delete *if* the libtool file exists, bug #778380 + find "${ED}" -name '*.la' -delete || die +} + +pkg_postinst() { + udev_reload +} diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3 b/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3 new file mode 100644 index 000000000000..3841aca8d18a --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3 @@ -0,0 +1,271 @@ +#!/sbin/openrc-run +# 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_gen_t1_cpe_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_T1_FRAMING-ESF},${DAHDI_T1_CODING-B8ZS}" + bchans="${basechan}-$(( basechan + 22 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 23 ))" + [ "${DAHDI_T1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_gen_t1_net_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_T1_FRAMING-ESF},${DAHDI_T1_CODING-B8ZS}" + bchans="${basechan}-$(( basechan + 22 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 23 ))" + [ "${DAHDI_T1_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="PRI_SPAN_${span}_NET" + local cfunc="dahdi_gen_" + + # Analog we need to deal with on a port-by-port basis. + [ "${type}" = "analog" ] && return 0 + + echo "" + echo "# ${desc}" + + case "${type}" in + digital-TE) + cfunc+="bri_te" + ;; + digital-NT) + cfunc+="bri_nt" + ;; + digital-[TE]1) + cfunc+="$(echo "${type##*-}" | tr 'TE' 'te')" + # 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. + if yesno "${vname}"; then + cfunc+="_net" + else + cfunc+="_cpe" + 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." + return 1 + ;; + esac + + "${cfunc}_config" "${span}" "${port}" "${basechan}" +} + +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}" + exec 4>"${tfile}" + + echo "# Automatically dahdi-autoconf generated file ($(date))." >&4 + echo "# This file WILL get regenerated whenever you restart dahdi-autoconf." >&4 + + while read LINE <&3; do + case "$LINE" in + \[*\]) + if [ -n "${span}" ]; then + ebegin "Configuring ${manufacturer} ${devicetype} (${name})" + dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >&4 + eend $? + fi + span="${LINE%?}" + span="${span#?}" + ;; + type=*|manufacturer=*|devicetype=*|basechan=*|name=*) + eval "${LINE%%=*}='${LINE#*=}'" + ;; + location=*) + eval "${LINE%%=*}='${LINE#*=}'" + if [ "${location}" = "${plocation}" ]; then + isdnport=$(( isdnport + 1 )) + else + plocation="${location}" + isdnport=1 + fi + ;; + port=*) + # For analog cards only. + aport="${LINE#*=}"; aport="${aport%,*}" + atype="${LINE#*,}" + if [ "${aport}" -eq "${basechan}" ]; then + echo "" >&4 + echo "# ${manufacturer} ${devicetype} (${name})" >&4 + fi + case "${atype}" in + FXO) + dahdi_gen_fxo_config $aport >&4 + ;; + FXS) + dahdi_gen_fxs_config $aport >&4 + ;; + esac + ;; + esac + done + + if [ -n "${span}" ]; then + ebegin "Configuring ${manufacturer} ${devicetype} (${name})" + dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >&4 + eend $? + fi + + echo "" >&4 + echo "loadzone = ${DAHDI_ZONE}" >&4 + echo "defaultzone = ${DAHDI_ZONE}" >&4 + echo "## END OF AUTOCONFIGURED FILE ##" >&4 + + exec 3<&- + exec 4<&- + + rm -f "${sfile}" + [ -r /etc/dahdi/system.conf ] && 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 +} |