diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-misc/dahdi-tools/files | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-misc/dahdi-tools/files')
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.conf2 | 40 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.init2 | 225 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.init3 | 226 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi.init2 | 37 |
4 files changed, 528 insertions, 0 deletions
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 +} diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.init3 b/net-misc/dahdi-tools/files/dahdi-autoconf.init3 new file mode 100644 index 000000000000..550a90e780d7 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.init3 @@ -0,0 +1,226 @@ +#!/sbin/runscript +# Copyright 1999-2012 Ultimate Linux Solutions CC +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before dahdi + after wanrouter +} + +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 +} diff --git a/net-misc/dahdi-tools/files/dahdi.init2 b/net-misc/dahdi-tools/files/dahdi.init2 new file mode 100644 index 000000000000..9f550c17a15e --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi.init2 @@ -0,0 +1,37 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need net +} + +checkconfig() { + if [ ! -f /etc/dahdi/system.conf ]; then + eerror "/etc/dahdi/system.conf not found. Nothing to do." + return 1 + fi + + return 0 +} + +start() { + checkconfig || return 1 + + ebegin "Starting DAHDI" + /usr/sbin/dahdi_cfg + eend $? + + if [ $? -eq 0 -a -r /etc/fxotune.conf ]; then + ebegin "Loading DAHDI fxotune.conf" + /usr/sbin/fxotune -s + eend $? + fi +} + +stop() { + ebegin "Stopping DAHDI" + /usr/sbin/dahdi_cfg -s + eend +} |