Explorar o código

kamctl: search for greadlink first

- bsd version of readlink is different than gnu version
Daniel-Constantin Mierla %!s(int64=11) %!d(string=hai) anos
pai
achega
b209f27df9
Modificáronse 1 ficheiros con 13 adicións e 2 borrados
  1. 13 2
      utils/kamctl/kamctl

+ 13 - 2
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