[sr-dev] git:3.1: kamctl: don't require sercmd all the time

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 1 18:37:49 CEST 2011


Module: sip-router
Branch: 3.1
Commit: a568684930e5dfea48b0044e17ee2ee57bfede57
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a568684930e5dfea48b0044e17ee2ee57bfede57

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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
(cherry picked from commit 8b445f464c7d3904eae5d62a571148c621c3c6f8)

---

 utils/kamctl/kamctl |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 2ec550a..a68093f 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
@@ -137,6 +136,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"
@@ -155,6 +162,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
@@ -2398,6 +2406,7 @@ case $1 in
 		;;
 
 	ser|sercmd)
+		require_sercmd
 		shift
 		$SERCTLCMD "$@"
 		;;




More information about the sr-dev mailing list