[sr-dev] git:master: kamctl: search for greadlink first

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 13 09:32:01 CEST 2014


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Oct 13 00:05:24 2014 +0200

kamctl: search for greadlink first

- bsd version of readlink is different than gnu version

---

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

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 0a78d41..f1b3109 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -15,15 +15,26 @@ TEST="false"
 
 ### include config files
 
-which readlink > /dev/null
+# check for rc file at same location with kamctl
+which greadlink > /dev/null
 ret=$?
 if [ $ret -eq 0 ] ; then
-	KAMCTLFULLPATH=$(readlink -f "$0")
+	KAMCTLFULLPATH=$(greadlink -f "$0")
+else
+	which readlink > /dev/null
+	ret=$?
+	if [ $ret -eq 0 ] ; then
+		KAMCTLFULLPATH=$(readlink -f "$0")
+	fi
+fi
+if [ -n "$KAMCTLFULLPATH" ] ; then
 	KAMCTLDIRPATH=$(dirname "$KAMCTLFULLPATH")
 	if [ -f $KAMCTLDIRPATH/kamctlrc ]; then
 		. $KAMCTLDIRPATH/kamctlrc
 	fi
 fi
+
+# check for rc file at standard locations
 if [ -f /etc/kamailio/kamctlrc ]; then
 	. /etc/kamailio/kamctlrc
 fi




More information about the sr-dev mailing list