diff options
author | Tony Vroon <chainsaw@gentoo.org> | 2009-12-19 18:59:59 +0000 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2009-12-19 18:59:59 +0000 |
commit | 219c958d0ff07a3666ece4f2dacf55465f599327 (patch) | |
tree | ef9aae80859d135f15df1d3e5500399d92b47793 /net-misc/asterisk/files | |
parent | Version bump. (diff) | |
download | gentoo-2-219c958d0ff07a3666ece4f2dacf55465f599327.tar.gz gentoo-2-219c958d0ff07a3666ece4f2dacf55465f599327.tar.bz2 gentoo-2-219c958d0ff07a3666ece4f2dacf55465f599327.zip |
Version bump. Improved permission handling in ebuild & initscript by Patryk Rzadzinski, closes bugs #294601 & #296087. Set ASTLDFLAGS environment variable to enforce LDFLAGS respect. Additional parallel make fixes.
(Portage version: 2.2_rc60/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/asterisk/files')
3 files changed, 488 insertions, 0 deletions
diff --git a/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.12-longer-sip-cid.patch b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.12-longer-sip-cid.patch new file mode 100644 index 000000000000..b9fa43de4484 --- /dev/null +++ b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.12-longer-sip-cid.patch @@ -0,0 +1,15 @@ +--- aaa/asterisk-1.6.1.10/channels/chan_sip.c 2009-11-13 16:57:13.000000000 +0100 ++++ bbb/asterisk-1.6.1.10/channels/chan_sip.c 2009-12-17 11:03:22.000000000 +0100 +@@ -15250,9 +15250,9 @@ + */ + + #define FORMAT4 "%-15.15s %-10.10s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6d\n" +-#define FORMAT3 "%-15.15s %-10.10s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6s\n" +-#define FORMAT2 "%-15.15s %-10.10s %-15.15s %-15.15s %-7.7s %-15.15s %-6.6s\n" +-#define FORMAT "%-15.15s %-10.10s %-15.15s %-15.15s %-3.3s %-3.3s %-15.15s %-10.10s\n" ++#define FORMAT3 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6s\n" ++#define FORMAT2 "%-15.15s %-15.15s %-15.15s %-15.15s %-7.7s %-15.15s %-6.6s\n" ++#define FORMAT "%-15.15s %-15.15s %-15.15s %-15.15s %-3.3s %-3.3s %-15.15s %-10.10s\n" + + /*! \brief callback for show channel|subscription */ + static int show_channels_cb(void *__cur, void *__arg, int flags) diff --git a/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.12-parallel-make.patch b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.12-parallel-make.patch new file mode 100644 index 000000000000..8416ce9f5c06 --- /dev/null +++ b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.12-parallel-make.patch @@ -0,0 +1,212 @@ +diff -uNr asterisk-1.6.1.12.ORIG/channels/Makefile asterisk-1.6.1.12/channels/Makefile +--- asterisk-1.6.1.12.ORIG/channels/Makefile 2009-12-19 18:18:32.727000128 +0000 ++++ asterisk-1.6.1.12/channels/Makefile 2009-12-19 18:18:42.016000126 +0000 +@@ -62,8 +62,8 @@ + endif + + clean:: +- $(MAKE) -C misdn clean +- if [ -f h323/Makefile ]; then $(MAKE) -C h323 clean; fi ++ +$(MAKE) -C misdn clean ++ if [ -f h323/Makefile ]; then +$(MAKE) -C h323 clean; fi + + dist-clean:: + rm -f h323/Makefile +@@ -99,7 +99,7 @@ + chan_usbradio.so: LIBS+=-lusb -lasound + + h323/Makefile.ast: +- $(CMD_PREFIX) $(MAKE) -C h323 Makefile.ast ++ $(CMD_PREFIX) +$(MAKE) -C h323 Makefile.ast + + h323/libchanh323.a: h323/Makefile.ast +- $(CMD_PREFIX) $(MAKE) -C h323 libchanh323.a ++ $(CMD_PREFIX) +$(MAKE) -C h323 libchanh323.a +diff -uNr asterisk-1.6.1.12.ORIG/codecs/gsm/Makefile asterisk-1.6.1.12/codecs/gsm/Makefile +--- asterisk-1.6.1.12.ORIG/codecs/gsm/Makefile 2009-12-19 18:18:32.706000128 +0000 ++++ asterisk-1.6.1.12/codecs/gsm/Makefile 2009-12-19 18:23:17.010000126 +0000 +@@ -359,12 +359,12 @@ + + gsminstall: + -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \ +- $(MAKE) $(GSM_INSTALL_TARGETS) ; \ ++ +$(MAKE) $(GSM_INSTALL_TARGETS) ; \ + fi + + toastinstall: + -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then \ +- $(MAKE) $(TOAST_INSTALL_TARGETS); \ ++ +$(MAKE) $(TOAST_INSTALL_TARGETS); \ + fi + + gsmuninstall: +diff -uNr asterisk-1.6.1.12.ORIG/codecs/Makefile asterisk-1.6.1.12/codecs/Makefile +--- asterisk-1.6.1.12.ORIG/codecs/Makefile 2009-12-19 18:18:32.705000127 +0000 ++++ asterisk-1.6.1.12/codecs/Makefile 2009-12-19 18:18:42.016000126 +0000 +@@ -30,22 +30,22 @@ + endif + + clean:: +- $(MAKE) -C gsm clean +- $(MAKE) -C lpc10 clean +- $(MAKE) -C ilbc clean ++ +$(MAKE) -C gsm clean ++ +$(MAKE) -C lpc10 clean ++ +$(MAKE) -C ilbc clean + rm -f g722/*.[oa] + + gsm/lib/libgsm.a: + @mkdir -p gsm/lib +- @$(MAKE) -C gsm lib/libgsm.a ++ @+$(MAKE) -C gsm lib/libgsm.a + + $(LIBLPC10): +- @$(MAKE) -C lpc10 all ++ @+$(MAKE) -C lpc10 all + + $(if $(filter codec_lpc10,$(EMBEDDED_MODS)),modules.link,codec_lpc10.so): $(LIBLPC10) + + $(LIBILBC): +- @$(MAKE) -C ilbc all _ASTCFLAGS="$(filter-out -Wmissing-prototypes -Wmissing-declarations -Wshadow,$(_ASTCFLAGS)) $(AST_NO_STRICT_OVERFLOW)" ++ @+$(MAKE) -C ilbc all _ASTCFLAGS="$(filter-out -Wmissing-prototypes -Wmissing-declarations -Wshadow,$(_ASTCFLAGS)) $(AST_NO_STRICT_OVERFLOW)" + + $(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC) + +diff -uNr asterisk-1.6.1.12.ORIG/main/Makefile asterisk-1.6.1.12/main/Makefile +--- asterisk-1.6.1.12.ORIG/main/Makefile 2009-12-19 18:18:32.695000126 +0000 ++++ asterisk-1.6.1.12/main/Makefile 2009-12-19 18:18:42.016000126 +0000 +@@ -174,7 +174,7 @@ + clean:: + rm -f asterisk + rm -f db1-ast/.*.d +- @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi +- @$(MAKE) -C db1-ast clean +- @$(MAKE) -C stdtime clean ++ @if [ -f editline/Makefile ]; then +$(MAKE) -C editline distclean ; fi ++ @+$(MAKE) -C db1-ast clean ++ @+$(MAKE) -C stdtime clean + rm -f libresample/src/*.o +diff -uNr asterisk-1.6.1.12.ORIG/Makefile asterisk-1.6.1.12/Makefile +--- asterisk-1.6.1.12.ORIG/Makefile 2009-12-19 18:18:32.688000127 +0000 ++++ asterisk-1.6.1.12/Makefile 2009-12-19 18:27:50.464000127 +0000 +@@ -449,14 +449,14 @@ + rm -f include/asterisk/build.h + rm -f main/version.c + rm -f include/asterisk/version.h +- @$(MAKE) -C menuselect clean ++ @+$(MAKE) -C menuselect clean + cp -f .cleancount .lastclean + + dist-clean: distclean + + distclean: $(SUBDIRS_DIST_CLEAN) _clean +- @$(MAKE) -C menuselect dist-clean +- @$(MAKE) -C sounds dist-clean ++ @+$(MAKE) -C menuselect dist-clean ++ @+$(MAKE) -C sounds dist-clean + rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps + rm -f makeopts.embed_rules + rm -f config.log config.status config.cache +@@ -488,7 +488,7 @@ + $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \ + done + mkdir -p $(DESTDIR)$(AGI_DIR) +- $(MAKE) -C sounds install ++ +$(MAKE) -C sounds install + + update: + @if [ -d .svn ]; then \ +@@ -555,7 +555,7 @@ + fi + + $(SUBDIRS_INSTALL): +- @DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install ++ @+DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install + + NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so))) + OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so))) +@@ -610,7 +610,7 @@ + @echo " + **Note** This requires that you have +" + @echo " + doxygen installed on your local system +" + @echo " +-------------------------------------------+" +- @$(MAKE) -s oldmodcheck ++ @+$(MAKE) -s oldmodcheck + + upgrade: bininstall + +@@ -794,14 +794,14 @@ + fi + + sounds: +- $(MAKE) -C sounds all ++ +$(MAKE) -C sounds all + + # If the cleancount has been changed, force a make clean. + # .cleancount is the global clean count, and .lastclean is the + # last clean count we had + + cleantest: +- @cmp -s .cleancount .lastclean || $(MAKE) clean ++ @cmp -s .cleancount .lastclean || +$(MAKE) clean + + $(SUBDIRS_UNINSTALL): + @$(SUBMAKE) -C $(@:-uninstall=) uninstall +@@ -817,7 +817,7 @@ + rm -f $(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8 + rm -f $(DESTDIR)$(ASTMANDIR)/man8/autosupport.8 + rm -f $(DESTDIR)$(ASTMANDIR)/man8/safe_asterisk.8 +- $(MAKE) -C sounds uninstall ++ +$(MAKE) -C sounds uninstall + + uninstall: _uninstall + @echo " +--------- Asterisk Uninstall Complete -----+" +@@ -851,11 +851,11 @@ + + menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect + @if [ -x menuselect/nmenuselect ]; then \ +- $(MAKE) nmenuselect; \ ++ +$(MAKE) nmenuselect; \ + elif [ -x menuselect/cmenuselect ]; then \ +- $(MAKE) cmenuselect; \ ++ +$(MAKE) cmenuselect; \ + elif [ -x menuselect/gmenuselect ]; then \ +- $(MAKE) gmenuselect; \ ++ +$(MAKE) gmenuselect; \ + else \ + echo "No menuselect user interface found. Install ncurses,"; \ + echo "newt or GTK libraries to build one and re-rerun"; \ +@@ -906,7 +906,7 @@ + + pdf: asterisk.pdf + asterisk.pdf: +- $(MAKE) -C doc/tex asterisk.pdf ++ +$(MAKE) -C doc/tex asterisk.pdf + + .PHONY: menuselect + .PHONY: main +diff -uNr asterisk-1.6.1.12.ORIG/menuselect/Makefile asterisk-1.6.1.12/menuselect/Makefile +--- asterisk-1.6.1.12.ORIG/menuselect/Makefile 2009-12-19 18:18:32.708000126 +0000 ++++ asterisk-1.6.1.12/menuselect/Makefile 2009-12-19 18:18:42.017000127 +0000 +@@ -97,7 +97,7 @@ + + mxml/libmxml.a: + @if test ! -f mxml/Makefile ; then cd mxml && ./configure ; fi +- @$(MAKE) -C mxml libmxml.a ++ @+$(MAKE) -C mxml libmxml.a + + test: menuselect + (cd test; ../$< menuselect.makeopts) +@@ -113,11 +113,11 @@ + + clean: + rm -f menuselect cmenuselect gmenuselect nmenuselect $(OBJS) $(M_OBJS) $(C_OBJS) $(G_OBJS) $(N_OBJS) +- @if test -f mxml/Makefile ; then $(MAKE) -C mxml clean ; fi ++ @if test -f mxml/Makefile ; then +$(MAKE) -C mxml clean ; fi + + dist-clean: distclean + + distclean: clean +- @if test -f mxml/Makefile ; then $(MAKE) -C mxml distclean ; fi ++ @if test -f mxml/Makefile ; then +$(MAKE) -C mxml distclean ; fi + rm -f autoconfig.h config.status config.log makeopts + rm -rf autom4te.cache diff --git a/net-misc/asterisk/files/1.6.1/asterisk.initd2 b/net-misc/asterisk/files/1.6.1/asterisk.initd2 new file mode 100644 index 000000000000..85ccb8ed0f36 --- /dev/null +++ b/net-misc/asterisk/files/1.6.1/asterisk.initd2 @@ -0,0 +1,261 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.6.1/asterisk.initd2,v 1.1 2009/12/19 18:59:58 chainsaw Exp $ + +opts="${opts} forcestop reload" + +depend() { + need net + use nscd dns dahdi 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="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=$(echo $ASTERISK_USER | sed 's/:.*//') + 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 + for element in $(find /var/{log,run}/asterisk); do + if [ $(stat -c %U $element) != ${USER} ]; then + ewarn "${USER} is not the owner of $element, fixing." + chown -R ${USER} /var/{log,run}/asterisk + chmod -R u+r /var/{log,run}/asterisk + chmod u+x /var/{log,run}/asterisk + fi; + done; + 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} + result=$? + else + asterisk_run_loop ${ASTERISK_OPTS} 2>/dev/null & + result=$? + fi + + if [ $result -eq 0 ]; then + # 2 seconds should be enough for asterisk to start + sleep 2 + is_running + result=$? + fi + + eend $result +} + +forcestop() { + ebegin "Stopping asterisk PBX" + start-stop-daemon --stop --pidfile /var/run/asterisk/asterisk.pid + eend $? +} + +stop() { + if ! is_running; then + eerror "Asterisk is not running!" + return 0 + fi + + ebegin "Stopping asterisk PBX gracefully" + /usr/sbin/asterisk -r -x "core stop gracefully" &>/dev/null + # Now we have to wait until asterisk has _really_ stopped. + sleep 1 + if is_running; then + einfon "Waiting for asterisk to shutdown ." + local cnt=0 + while is_running; do + cnt=`expr $cnt + 1` + if [ $cnt -gt 60 ] ; then + # Waited 120 seconds now. Fail. + echo + eend 1 "Failed." + return + fi + sleep 2 + echo -n "." + done + echo + fi + eend 0 +} + +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 +} |