diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-06-21 06:51:52 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-06-21 06:51:52 +0000 |
commit | d07330b318be668b667e4339d8dd0387327460e1 (patch) | |
tree | 15198513161027b52781b4859a67f3f07cffcb87 /zaptel.init | |
parent | 625d996c4860f1d6f10d301b1f90c44d532253b9 (diff) |
readability fixes: Remove complex nesting. Move hpec init to a function.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2656 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.init')
-rw-r--r-- | zaptel.init | 83 |
1 files changed, 45 insertions, 38 deletions
diff --git a/zaptel.init b/zaptel.init index 0f80bfd..1185620 100644 --- a/zaptel.init +++ b/zaptel.init @@ -62,12 +62,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 @@ -126,6 +125,45 @@ fix_asterisbank_sync() { fi } +hpec_start() { + # HPEC license found + if ! echo /var/lib/digium/licenses/HPEC-*.lic | grep -v '\*' | grep -q .; then + return + fi + + # 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 >& /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 +} + # Check that telephony is up. [ "${TELEPHONY}" = "yes" ] || exit 0 @@ -193,38 +231,7 @@ case "$1" in [ $RETVAL -eq 0 ] && touch $LOCKFILE - # HPEC license found - if echo /var/lib/digium/licenses/HPEC-*.lic | grep -v '\*' | grep -q .; 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 >& /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 |