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

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


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

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

kamdbctl: search for greadlink first

- bsd version of readlink is different than gnu version

---

 utils/kamctl/kamdbctl |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 1ecb6fa..13f227e 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -14,15 +14,27 @@ PATH=$PATH:/usr/local/sbin/
 TEST="false"
 
 ### include resource files, if any
-which readlink > /dev/null
+
+# check for rc file at same location with kamdbctl
+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