diff options
author | Stefan Knoblich <stkn@gentoo.org> | 2006-04-16 01:04:44 +0000 |
---|---|---|
committer | Stefan Knoblich <stkn@gentoo.org> | 2006-04-16 01:04:44 +0000 |
commit | 3aec563798a11aaa7ece8f73fab9633c5434dc87 (patch) | |
tree | 3f8a5fc2278e24decf9c3ec88019edee7ee3ca93 /net-misc/asterisk/files | |
parent | Update gcc4 patch to fix compilation with gcc-4.1 as well; bug #125679 (diff) | |
download | gentoo-2-3aec563798a11aaa7ece8f73fab9633c5434dc87.tar.gz gentoo-2-3aec563798a11aaa7ece8f73fab9633c5434dc87.tar.bz2 gentoo-2-3aec563798a11aaa7ece8f73fab9633c5434dc87.zip |
New version, add experimental generic jitter buffer patch (use at your own risk), cleanups, add asterisk-updater script and check for asterisk-1.0.x modules after update, initgroups patch has been dropped (update your conf.d and init.d files!), add work-in-progress wrapper initscript.
(Portage version: 2.0.54)
Diffstat (limited to 'net-misc/asterisk/files')
-rw-r--r-- | net-misc/asterisk/files/1.2.0/asterisk-updater | 146 | ||||
-rw-r--r-- | net-misc/asterisk/files/1.2.0/asterisk.confd | 98 | ||||
-rwxr-xr-x | net-misc/asterisk/files/1.2.0/asterisk.rc6 | 235 | ||||
-rw-r--r-- | net-misc/asterisk/files/digest-asterisk-1.2.7_p1 | 15 |
4 files changed, 494 insertions, 0 deletions
diff --git a/net-misc/asterisk/files/1.2.0/asterisk-updater b/net-misc/asterisk/files/1.2.0/asterisk-updater new file mode 100644 index 000000000000..309c48987d52 --- /dev/null +++ b/net-misc/asterisk/files/1.2.0/asterisk-updater @@ -0,0 +1,146 @@ +#!/bin/bash + +# +# +# +PORTDB_DIR="$(portageq vdb_path)" +PRETEND=0 +UPDATE=0 + +# +# +# +modules_list="" +ebuild_list="" + +pkgname() { + echo "${1%-[0-9.]*}" +} + +pkgver() { + echo "${1##$(pkgname "$1")-}" +} + +for x in $@; do + case ${x} in + *help|*h) + echo "Usage: $0 [EMERGE_OPTIONS|--help|-h]" + exit 0 + ;; + *pretend|*p) + PRETEND=1 + ;; + *update|*u) + UPDATE=1 + ;; + esac +done + +echo ">>> Scanning modules in /usr/lib/asterisk/modules..." + +# create list of modules +for x in $(ls -1 /usr/lib/asterisk/modules/*.so); do + + if $(readelf -s "${x}" | grep -q "\(ast_load\|ast_destroy\)$"); then + modules_list="${modules_list} $(basename ${x})" + fi +done + +if [[ -n "${modules_list}" ]]; then + echo ">>> Module(s) need to be updated, creating list..." + + # + # grab initial list of ebuilds + # + for x in ${modules_list}; do + package="$(grep -l "${x}" "${PORTDB_DIR}"/net-misc/*/CONTENTS | head -n 1 | sed -e "s:${PORTDB_DIR}/::" -e "s:/CONTENTS::")" + + [[ -n "${package}" ]] && \ + ebuild_list="${ebuild_list} ${package}" + done + + echo + echo ">>> Checking packages..." + + tmp_list="" + fail_list="" + for x in ${ebuild_list}; do + # strip version from package + pkgname="${x%-[0-9.]*}" + + if ! emerge -pq "=${x}" &>/dev/null; then + if ! emerge -pq ">${x}" &>/dev/null; then + + # ebuild is gone + fail_list="${fail_list} ${x}" + else + + # ebuild is available in a newer version, + # add it to the update list + update_list="${update_list} ${x}" + fi + else + if [[ $UPDATE -eq 1 ]]; then + # user wants to update all ebuilds... + if emerge -pq ">${x}" &>/dev/null; then + + # add ebuild without version information to the update list + update_list="${update_list} ${x}" + continue + fi + fi + + tmp_list="${tmp_list} =${x}" + fi + done + + echo + + if [[ -n "${fail_list}" ]]; then + echo + echo "!!! The following ebuild(s) need to be updated manually:" + for x in ${fail_list}; do + echo " $(pkgname "${x}")" + done + echo + fi + + if [[ $UPDATE -eq 0 ]] && [[ -n "${update_list}" ]] + then + # display list of packages and ask user what to do + echo "!!! The following ebuilds are only available in newer versions:" + echo + for x in ${update_list}; do + echo " $(pkgname "${x}")" + done + echo + echo -n "--- Do you want to update them (y/N)? " + read tmp + + tmp="$(echo "${tmp}" | tr "[[:upper:]]" "[[:lower:]]")" + if [[ "${tmp}" != "y" ]]; then + echo ">>> NOT updating ebuilds" + unset update_list + fi + fi + + if [[ -n "${update_list}" ]]; then + # simply copy update list to merge list + echo ">>> Adding list of ebuilds to update..." + for x in ${update_list}; do + tmp_list="${tmp_list} $(pkgname "${x}")" + done + fi + + if [[ -n "${tmp_list}" ]]; then + echo ">>> Feeding list of ebuilds to emerge $@..." + emerge ${tmp_list} $@ + else + echo -e "*** Nothing to emerge..." + fi +else + echo "*** No asterisk-1.0.x modules found!" +fi + +echo +exit 0 diff --git a/net-misc/asterisk/files/1.2.0/asterisk.confd b/net-misc/asterisk/files/1.2.0/asterisk.confd new file mode 100644 index 000000000000..c25ee0050ff9 --- /dev/null +++ b/net-misc/asterisk/files/1.2.0/asterisk.confd @@ -0,0 +1,98 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.2.0/asterisk.confd,v 1.1 2006/04/16 01:04:44 stkn Exp $ + +# +# Additional options for asterisk +# +# see "asterisk -h" for a list of options +# +ASTERISK_OPTS="" + +# +# User and group to run asterisk as +# +# Value: double-colon separated list of user and group, or empty to run as root: +# +# +# "asterisk:asterisk" to run as user "asterisk" and group "asterisk" +# +# "asterisk" to run as user "asterisk" and all groups that user "asterisk" is a member of +# +# ":asterisk" to run as user "root" and group "asterisk" +# +# "" to run as user "root" and group "root" +# +ASTERISK_USER="asterisk" + +# +# Nicelevel +# +# Set the priority of the asterisk process +# +# Value: (highest) -20..19 (lowest) +# +#ASTERISK_NICE="19" + +# +# Wrapper script +# +# Value: yes or no/empty +# +ASTERISK_WRAPPER="no" + +############# Wrapper script settings ############# + +# +# Send crash notifications emails to this address +# (needs a working mail service and /usr/sbin/sendmail to do so (e.g. ssmtp)) +# +# Value: Email address or empty to disable +# +#ASTERISK_NOTIFY_EMAIL="root" + +# +# Send asterisk's output to this terminal +# +# Value: Full path to device node or a number +# +#ASTERISK_TTY="/dev/tty9" + +# +# Start an asterisk console on the terminal specified by ASTERISK_TTY +# +# Warning! Use only for debugging, this is a potential security issue! +# +# Value: yes or no/empty +# +ASTERISK_CONSOLE="no" + +# +# Maximum size of core files. +# +# Value: Size in bytes, unlimited for no limit or empty to disable. +# +#ASTERISK_CORE_SIZE="unlimited" + +# +# ASTERISK_CORE_DIR +# +# Value: Directory (will be created if non-existant), default is /tmp +# +ASTERISK_CORE_DIR="/var/lib/asterisk/coredump" + +# +# Max number of filedescriptors +# +# Value: Number of descriptors +# +#ASTERISK_MAX_FD="1024" + +# +# Kill these tasks after asterisk crashed (ASTERISK_WRAPPER=yes only!) +# +# Warning! This will kill _ALL_ tasks with the specified names! +# +# Value: Space separated list of names in double quotes (e.g. "mpg123 mad") +# +#ASTERISK_CLEANUP_ON_CRASH="mpg123 asterisk-mpg123 mad" diff --git a/net-misc/asterisk/files/1.2.0/asterisk.rc6 b/net-misc/asterisk/files/1.2.0/asterisk.rc6 new file mode 100755 index 000000000000..f2f0471e2ee1 --- /dev/null +++ b/net-misc/asterisk/files/1.2.0/asterisk.rc6 @@ -0,0 +1,235 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.2.0/asterisk.rc6,v 1.1 2006/04/16 01:04:44 stkn Exp $ + +opts="${opts} forcestop reload" + +depend() { + need net + use zaptel mysql postgresql slapd capi +} + +is_running() { + if [[ -z "$(pidof asterisk)" ]]; then + return 1 + else + PID="$(cat /var/run/asterisk/asterisk.pid)" + for x in $(pidof asterisk); do + if [[ "${x}" = "${PID}" ]]; then + return 0 + fi + done + fi + + return 1 +} + +asterisk_run_loop() { + local OPTS ARGS MSG NICE="" + local result=0 signal=0 + + # default options + OPTS="-f" # don't fork / detach breaks wrapper script... + + # filter (redundant) arguments + ARGS="$(echo "${@}" | sed -e "s:-c\|-f::g")" + + # mangle yes/no options + ASTERISK_CONSOLE="$(echo ${ASTERISK_CONSOLE} | tr [:lower:] [:upper:])" + + if [[ -n "${ASTERISK_CORE_SIZE}" ]] && + [[ "${ASTERISK_CORE_SIZE}" != "0" ]]; then + ulimit -c ${ASTERISK_CORE_SIZE} + + if [[ -n "${ASTERISK_CORE_DIR}" ]] && \ + [[ ! -d "${ASTERISK_CORE_DIR}" ]] + then + mkdir -m750 -p "${ASTERISK_CORE_DIR}" + + if [[ -n "${ASTERISK_USER}" ]]; then + chown -R "${ASTERISK_USER}" "${ASTERISK_CORE_DIR}" + fi + fi + ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}" + + cd "${ASTERISK_CORE_DIR}" + echo " Core dump size : ${ASTERISK_CORE_SIZE}" + echo " Core dump location : ${ASTERISK_CORE_DIR}" + fi + + if [[ -n "${ASTERISK_MAX_FD}" ]]; then + ulimit -n ${ASTERISK_MAX_FD} + echo " Max open filedescriptors : ${ASTERISK_MAX_FD}" + fi + + if [[ -n "${ASTERISK_NICE}" ]]; then + echo " Nice level : ${ASTERISK_NICE}" + NICE="/bin/nice -n ${ASTERISK_NICE} --" + fi + + if [[ -n "${ASTERISK_NOTIFY_EMAIL}" ]]; then + if [[ -x /usr/sbin/sendmail ]]; then + echo " Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}" + else + echo " Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" + unset ASTERISK_NOTIFY_EMAIL + fi + fi + + if [[ -n "${ASTERISK_TTY}" ]]; then + for x in ${ASTERISK_TTY} \ + /dev/tty${ASTERISK_TTY} \ + /dev/vc/${ASTERISK_TTY} + do + if [[ -c "${x}" ]]; then + TTY="${x}" + fi + done + [[ -n "${TTY}" ]] && \ + echo " Messages are sent to : ${TTY}" + fi + + if [[ "${ASTERISK_CONSOLE}" = "YES" ]] && [[ -n "${TTY}" ]]; then + echo " Starting Asterisk console : ${ASTERISK_CONSOLE}" + OPTS="${OPTS} -c" + fi + + OPTS="${OPTS} ${ARGS}" + + while :; do + + if [[ -n "${TTY}" ]]; then + /usr/bin/stty -F ${TTY} sane + ${NICE} /usr/sbin/asterisk ${OPTS} >${TTY} 2>&1 <${TTY} + result=$? + else + ${NICE} /usr/sbin/asterisk ${OPTS} &>/dev/null + result=$? + fi + + if [[ $result -eq 0 ]]; then + echo "Asterisk terminated normally" + break + else + if [[ $result -gt 128 ]]; then + signal=$((result - 128)) + MSG="Asterisk terminated with Signal: $signal" + + CORE_TARGET="core-$(date "+%Y%m%d-%h%M%s")" + + local CORE_DUMPED=0 + if [[ -f "${ASTERISK_CORE_DIR}/core" ]]; then + mv "${ASTERISK_CORE_DIR}/core" \ + "${ASTERISK_CORE_DIR}/${CORE_TARGET}" + CORE_DUMPED=1 + + elif [[ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]]; then + mv "${ASTERISK_CORE_DIR}/core.${PID}" \ + "${ASTERISK_CORE_DIR}/${CORE_TARGET}" + CORE_DUMPED=1 + + fi + + [[ $CORE_DUMPED -eq 1 ]] && \ + MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}" + else + MSG="Asterisk terminated with return code: $result" + fi + + # kill left-over tasks + for X in ${ASTERISK_CLEANUP_ON_CRASH}; do + kill -9 $(pidof ${X}); + done + fi + + [[ -n "${TTY}" ]] \ + && echo "${MSG}" >${TTY} \ + || echo "${MSG}" + + + if [[ -n "${ASTERISK_NOTIFY_EMAIL}" ]] && \ + [[ -x /usr/sbin/sendmail ]]; then + echo -e -n "Subject: Asterisk crashed\n\r${MSG}\n\r" |\ + /usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}" + fi + sleep 5 + echo "Restarting Asterisk..." + done + return 0 +} + +start() { + local OPTS USER GROUP PID + local tmp x + + if [[ -n "${ASTERISK_NICE}" ]]; then + if [[ ${ASTERISK_NICE} -ge -20 ]] && \ + [[ ${ASTERISK_NICE} -le 19 ]]; then + OPTS="--nicelevel ${ASTERISK_NICE}" + else + eerror "Nice value must be between -20 and 19" + return 1 + fi + fi + + if [[ -n "${ASTERISK_USER}" ]]; then + USER=${ASTERISK_USER/:*/} + GROUP=$(echo $ASTERISK_USER | awk -F: '/.*:.*/ { print $2 }') + if [[ -n "${USER}" ]]; then + ASTERISK_OPTS="${ASTERISK_OPTS} -U ${USER}" + fi + if [[ -n "${GROUP}" ]]; then + ASTERISK_OPTS="${ASTERISK_OPTS} -G ${GROUP}" + GROUP=":${GROUP}" # make it look nice... + fi + ebegin "Starting asterisk PBX (as ${USER}${GROUP})" + else + ebegin "Starting asterisk PBX (as root)" + fi + + if [[ "$(echo ${ASTERISK_WRAPPER} | tr [:upper:] [:lower:])" != "yes" ]]; then + start-stop-daemon --start --exec /usr/sbin/asterisk \ + ${OPTS} -- ${ASTERISK_OPTS} + else + asterisk_run_loop ${ASTERISK_OPTS} 2>/dev/null & + fi + + if [[ $result -eq 0 ]]; then + # 2 seconds should be enough for asterisk to start + sleep 2 + + result=$(is_running) + fi + + eend $result +} + +forcestop() { + ebegin "Stopping asterisk PBX" + start-stop-daemon --stop --pidfile /var/run/asterisk/asterisk.pid + eend $? +} + +stop() { + + if is_running; then + ebegin "Stopping asterisk PBX gracefully" + /usr/sbin/asterisk -r -x "stop gracefully" &>/dev/null + [[ $? -eq 0 ]] && svc_stop + eend + else + + eerror "Asterisk is not running!" + fi +} + +reload() { + if is_running; then + ebegin "Forcing asterisk to reload configuration" + /usr/sbin/asterisk -r -x "reload" &>/dev/null + eend $? + else + eerror "Asterisk is not running!" + fi +} diff --git a/net-misc/asterisk/files/digest-asterisk-1.2.7_p1 b/net-misc/asterisk/files/digest-asterisk-1.2.7_p1 new file mode 100644 index 000000000000..c003fb1aa407 --- /dev/null +++ b/net-misc/asterisk/files/digest-asterisk-1.2.7_p1 @@ -0,0 +1,15 @@ +MD5 7d1509b8871dc21598644d15eeb5dec5 asterisk-1.2.5-genericjb-20060228.patch.gz 14864 +RMD160 857811e1882d3a9b88cd3e511eb5b0cdaa9a0a40 asterisk-1.2.5-genericjb-20060228.patch.gz 14864 +SHA256 eb95782962cd158e5ced8342e0822fd3d9c196c07c5465aab8c549acc2eb4acb asterisk-1.2.5-genericjb-20060228.patch.gz 14864 +MD5 1658bc78dd14c1f6cf4885f581c62143 asterisk-1.2.7-patches-1.0.tar.bz2 8330 +RMD160 1e699108a1016f9c2e0291c02638c750ff9465e9 asterisk-1.2.7-patches-1.0.tar.bz2 8330 +SHA256 4e3f69063d160edef35ade7e86f2a7d5408c6937d4c7487c6ed6043fb3c12d2c asterisk-1.2.7-patches-1.0.tar.bz2 8330 +MD5 a00cfbd2b80f64a01eaab23735285c18 asterisk-1.2.7.1-bristuff-0.3.0-PRE-1n.diff.bz2 81710 +RMD160 1ab7df2785fc7fd7859f7e55cc1ab643519249bf asterisk-1.2.7.1-bristuff-0.3.0-PRE-1n.diff.bz2 81710 +SHA256 8e6e00e4273a7d96bde834c872b598f18e3328c01172940975fa93bf726f70b6 asterisk-1.2.7.1-bristuff-0.3.0-PRE-1n.diff.bz2 81710 +MD5 5c4b473eee2fbc2cb9e346f0564ef970 asterisk-1.2.7.1.tar.gz 10554037 +RMD160 28c1d5c3ac6db52d7d315f59d391a655b77338fd asterisk-1.2.7.1.tar.gz 10554037 +SHA256 c561ec886a779a59c78cbeffda457f2a07535ddceb371561c54adc6ee60d984a asterisk-1.2.7.1.tar.gz 10554037 +MD5 a0c78e7676acbc06b26d2c68ef3e0c86 bristuff-0.3.0-PRE-1n.tar.gz 248488 +RMD160 3da3043a88551578b4495ae8e54ffb6a4f3bfd2c bristuff-0.3.0-PRE-1n.tar.gz 248488 +SHA256 31b894bdd2741e309dfed23963db1cda3d74a8d616de8df9f1281b5558aa27f1 bristuff-0.3.0-PRE-1n.tar.gz 248488 |