From 82e6b0217e63d5a77e7f673bc2a7c3712c84b7e6 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Wed, 3 Oct 2007 16:46:13 +0000 Subject: New xpp release: r4786: * New firmware protocol version: 2.9 . * fpga_load: initial clean-ups before interface split. * genzaptelconf: Don't leave an empty directory behind (4784) * Increase xpp poll_timeout to 1000ms - useful for CentOS 4 (r4781). * Fix initialization anoyance: if AB don't answer to polls, don't waitfor_xpds, and show no waiting XPDs (r4725). * Disable dtmf_detect by default once again (r4712). * Don't check twice for asterisk to stop. The second test was done while Asterisk was still stopping (r4708). * Support building the kernel with M= instead of with SUBDIRS= , as used in some newer build systems (r4677). git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3105 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- xpp/utils/genzaptelconf | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'xpp/utils/genzaptelconf') diff --git a/xpp/utils/genzaptelconf b/xpp/utils/genzaptelconf index 93d7f6e..d5ce1b9 100755 --- a/xpp/utils/genzaptelconf +++ b/xpp/utils/genzaptelconf @@ -115,7 +115,7 @@ if [ ! -x "$ZTCFG" ]; then ZTCFG=/usr/sbin/ztcfg else echo >&2 "ztcfg is not on found, do you have zaptel properly installed?" - exit 1; + exit_cleanup 1 fi fi @@ -143,14 +143,13 @@ bri) ZAPBRI_NET=bri_net; ZAPBRI_CPE=bri_cpe ;; pri) ZAPBRI_NET=pri_net; ZAPBRI_CPE=pri_cpe ;; bri_ptmp) ZAPBRI_NET=bri_net_ptmp; ZAPBRI_CPE=bri_cpe_ptmp ;; *) - echo >&2 "Incorrect value for ZAPBRI_SIGNALLING ($ZAPBRI_SIGNALLING). Abortring" - exit 1 + die "Incorrect value for ZAPBRI_SIGNALLING ($ZAPBRI_SIGNALLING). Abortring" ;; esac die() { echo "$@" >&2 - exit 1 + exit_cleanup 1 } say() { @@ -160,6 +159,16 @@ say() { echo "$@" >&2 } +# exit (exit value is the optional $1), and clean up after us +exit_cleanup() { + if [ -d "$tmp_dir" ]; then + # don't fail but don't hide error if directory is not + # empty + rmdir "$tmp_dir" || : + fi + exit $1 +} + # Wait for udev to generate /dev/zap/ctl, if needed: wait_for_zapctl() { # if device file already exists, or if zaptel has failed to load: @@ -529,12 +538,6 @@ unload_module() { } unload_modules() { - if - pids="$(pgrep asterisk)" - [ "$pids" != '' ] - then - die "Before unloading -- STOP asterisk (pids=$pids)." - fi say "Unloading zaptel modules:" unload_module zaptel say '' @@ -1052,7 +1055,7 @@ do c) lc_country=`echo $OPTARG | tr -d -c a-z` ;; d) do_detect=yes ;; F) fxsdisable=yes;; - u) do_unload=yes ;; + u) do_unload=yes ; force_stop_ast=yes ;; v) verbose=yes ;; l) mode='list' ;; M) do_module_list=yes; do_detect=yes ;; @@ -1101,14 +1104,14 @@ else echo >&2 "Asterisk is already running. Configuration left untouched" echo >&2 "You can use the option -s to shut down Asterisk for the" echo >&2 "duration of the detection." - exit 1 + exit_cleanup 1 fi fi if [ "$do_unload" = yes ] then unload_modules - exit + exit_cleanup $? fi if [ "$do_detect" = yes ] @@ -1144,7 +1147,7 @@ fi if [ "$force_stop_ast" != 'yes' ] || [ "$do_restart" != 'yes' ] then - exit 0 + exit_cleanup 0 fi if [ -x /etc/init.d/asterisk ] -- cgit v1.2.3