summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-06-21 09:01:39 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-06-21 09:01:39 +0000
commit5ee564c8ac8f24e9b20fad0b8051f82bc30d2c26 (patch)
tree66c937c3709fb99ac33ddba99aed632aff1dbfb1
parentd262d1f053135f468e0bd557cc424a8e0ed357a3 (diff)
zaptel.init:
* Reduce nesting in hpec startup by moving it to a function. * Fix a syntax error in hpec startup. * Remove ztcfg -s from shutdown. * Someone with a dynamic span, please test the suggested replacement (remmed-out). * Reduced nesting in wait_for_xpp . Ignore some generated man pages in xpp/utils Merges: r2657 - r2660 from brnaches/1.4 . git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2661 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--zaptel.init104
1 files changed, 59 insertions, 45 deletions
diff --git a/zaptel.init b/zaptel.init
index d7bbdd3..273cbb6 100644
--- a/zaptel.init
+++ b/zaptel.init
@@ -63,12 +63,11 @@ unload_module() {
# Wait for Astribank to initialize registers:
wait_for_xpp() {
- if [ -d /proc/xpp ]
- then
- # reading from waitfor_xpds only returns when the device
- # has finished initilizing its regiters and is available.
- cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
- fi
+ if [ ! -d /proc/xpp ]; then return; fi
+
+ # reading from waitfor_xpds only returns when the device
+ # has finished initilizing its regiters and is available.
+ cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
}
# Register to zaptel Astribank spans that were not autoomatically registered
@@ -127,6 +126,57 @@ fix_asterisbank_sync() {
fi
}
+hpec_start() {
+ # check for HPEC licenses
+ for f in /var/lib/digium/licenses/HPEC*.lic; do
+ if [ -f ${f} ]; then
+ haveHPEC=1
+ fi
+ done
+ if [ -z "${haveHPEC}" ]; then return; fi
+
+ # If we got here, HPEC license was found
+
+ # zaphpec_enable not installed in /usr/sbin
+ if [ ! -f /usr/sbin/zaphpec_enable ]; then
+ echo -n "Running zaphpec_enable: Failed"
+ echo -n "."
+ echo " The zaphpec_enable binary is not installed in /usr/sbin."
+ return
+ fi
+
+ # zaphpec_enable not set executable
+ if [ ! -x /usr/sbin/zaphpec_enable ]; then
+ echo -n "Running zaphpec_enable: Failed"
+ echo -n "."
+ echo " /usr/sbin/zaphpec_enable is not set as executable."
+ return
+ fi
+
+ # zaphpec_enable properly installed
+ if [ $system = debian ]; then
+ echo -n "Running zaphpec_enable: "
+ /usr/sbin/zaphpec_enable 2> /dev/null
+ elif [ $system = redhat ]; then
+ action "Running zaphpec_enable: " /usr/sbin/zaphpec_enable
+ fi
+ if [ $? = 0 ]; then
+ echo -n "done"
+ echo "."
+ else
+ echo -n "Failed"
+ echo -n "."
+ echo " This can be caused if you had already run zaphpec_enable, or if your HPEC license is no longer valid."
+ fi
+}
+
+shutdown_dynamic() {
+ if ! grep -q ' ZTD/' /proc/* 2>/dev/null; then return; fi
+
+ # we should only get here if we have dynamic spans. Right?
+ $ZTCFG -s
+}
+
# Check that telephony is up.
[ "${TELEPHONY}" = "yes" ] || exit 0
@@ -201,48 +251,12 @@ case "$1" in
[ $RETVAL -eq 0 ] && touch $LOCKFILE
- # check for HPEC licenses
- for f in /var/lib/digium/licenses/HPEC*.lic; do
- if [ -f ${f} ]; then
- haveHPEC = 1
- fi
- done
-
- # HPEC license found
- if [ -n "${haveHPEC}" ]; then
- # zaphpec_enable not installed in /usr/sbin
- if [ ! -f /usr/sbin/zaphpec_enable ]; then
- echo -n "Running zaphpec_enable: Failed"
- echo -n "."
- echo " The zaphpec_enable binary is not installed in /usr/sbin."
- else
- # zaphpec_enable not set executable
- if [ ! -x /usr/sbin/zaphpec_enable ]; then
- echo -n "Running zaphpec_enable: Failed"
- echo -n "."
- echo " /usr/sbin/zaphpec_enable is not set as executable."
- else
- # zaphpec_enable properly installed
- if [ $system = debian ]; then
- echo -n "Running zaphpec_enable: "
- /usr/sbin/zaphpec_enable 2> /dev/null
- elif [ $system = redhat ]; then
- action "Running zaphpec_enable: " /usr/sbin/zaphpec_enable
- fi
- if [ $? = 0 ]; then
- echo -n "done"
- echo "."
- else
- echo -n "Failed"
- echo -n "."
- echo " This can be caused if you had already run zaphpec_enable, or if your HPEC license is no longer valid."
- fi
- fi
- fi
- fi
+ hpec_start
;;
stop)
# Unload drivers
+ shutdown_dynamic # FIXME: needs test from someone with dynamic spans
+
echo -n "Unloading zaptel hardware drivers:"
unload_module zaptel
RETVAL=$?