Module: kamailio
Branch: master
Commit: 64cd9336039bc05944fd9693e08edfab5fbd2f14
URL: 
https://github.com/kamailio/kamailio/commit/64cd9336039bc05944fd9693e08edfab5fbd2f14

Author: Xenofon Karamanos <x...@gilawa.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2023-11-16T18:25:23+01:00

kamctl: Fix source order

- Add check for already sourced rc file in kamctl

---

Modified: utils/kamctl/kamctl

---

Diff:  
https://github.com/kamailio/kamailio/commit/64cd9336039bc05944fd9693e08edfab5fbd2f14.diff
Patch: 
https://github.com/kamailio/kamailio/commit/64cd9336039bc05944fd9693e08edfab5fbd2f14.patch

---

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index ad4262b7fc0..197c6e43035 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -18,6 +18,7 @@ else
 fi
 
 ### include config files
+RC_FILE_SOURCED="false"
 
 # check for rc file at same location with kamctl
 which greadlink >/dev/null 2>&1
@@ -39,11 +40,13 @@ if [ -n "$KAMCTLFULLPATH" ] ; then
 fi
 
 # check for rc file at standard locations
-if [ -f /etc/kamailio/kamctlrc -a -r /etc/kamailio/kamctlrc ]; then
+if [ $RC_FILE_SOURCED = "false" ] && [ -f /etc/kamailio/kamctlrc -a -r 
/etc/kamailio/kamctlrc ]; then
        . /etc/kamailio/kamctlrc
+       RC_FILE_SOURCED="true"
 fi
-if [ -f /usr/local/etc/kamailio/kamctlrc -a -r 
/usr/local/etc/kamailio/kamctlrc ]; then
+if[ $RC_FILE_SOURCED = "false" ] &&  [ -f /usr/local/etc/kamailio/kamctlrc -a 
-r /usr/local/etc/kamailio/kamctlrc ]; then
        . /usr/local/etc/kamailio/kamctlrc
+       RC_FILE_SOURCED="true"
 fi
 if [ -f ~/.kamctlrc -a -r ~/.kamctlrc ]; then
        . ~/.kamctlrc
@@ -3255,4 +3258,3 @@ case $1 in
                exit 1
                ;;
 esac
-

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to