Module: sip-router Branch: master Commit: 8b445f464c7d3904eae5d62a571148c621c3c6f8 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8b445f46...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Tue Jun 7 22:57:32 2011 +0200
kamctl: don't require sercmd all the time
- sercmd is not needed for all commands - throw error only when it is going to be executed but it is not found
---
utils/kamctl/kamctl | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl index c548849..4d99f15 100755 --- a/utils/kamctl/kamctl +++ b/utils/kamctl/kamctl @@ -74,8 +74,7 @@ if [ -z "$SERCMD" ] ; then # try locate it with which SERCMD=`which sercmd` if [ ! -f "$SERCMD" -o ! -x "$SERCMD" ] ; then - merr "sercmd tool not found" - exit -1; + mdbg "sercmd tool not found" fi fi fi @@ -143,6 +142,14 @@ fi ##### ------------------------------------------------ ##### ### CTLENGINE # + +require_sercmd() { + if [ -z "$SERCMD" ] ; then + merr "sercmd tool is missing" + exit -1 + fi +} + CTLENGINELOADED=0 if [ -z "$CTLENGINE" ] ; then CTLENGINE="FIFO" @@ -161,6 +168,7 @@ case $CTLENGINE in fi ;; SER_MI|ser_mi|SERCMD_MI|sercmd_mi|SERCMDMI|sercmdmi) + require_sercmd if [ -f "$MYLIBDIR/kamctl.ser_mi" ]; then . "$MYLIBDIR/kamctl.ser_mi" CTLENGINELOADED=1 @@ -2404,6 +2412,7 @@ case $1 in ;;
ser|sercmd) + require_sercmd shift $SERCTLCMD "$@" ;;