From b386d7c7d07dd3031c260f362463f8f5a7fa9629 Mon Sep 17 00:00:00 2001
From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
Date: Sun, 28 Nov 2010 16:04:49 -0200
Subject: [PATCH] run-config.sh: Added network interface parameter when calling
 the client

The new parameter is obtained from getNetworkInterface() in "common.sh" file
when there is more than one default route set. Otherwise, the "interface"
variable will be an empty string.

Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: Ricardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
Signed-off-by: Danilo K. S. Yorinori <danilok@c3sl.ufpr.br>
---
 run-config.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/run-config.sh b/run-config.sh
index c752e67..7d95bba 100755
--- a/run-config.sh
+++ b/run-config.sh
@@ -77,15 +77,22 @@ proxy="${phost} ${pport} ${puid} ${ppasswd}"
 
 inep="--inep=${inep}"
 
+interface=""
+if test $(route | grep default | wc -l) -gt 1; then
+    getNetworkInterface
+    interface="--nic=${interface}"
+fi
+
 # Execution
 if test $# -ne 1; then
     echo "Run.sh call: wrong number of parameters ($#)." \
          >> ${dirname}/run.log
     exit 101
 elif [[ $1 == "--inventory" ]]; then
-    ${bindir}/client $1 ${url} ${inep} ${proxy} >> ${dirname}/run.log
+    ${bindir}/client $1 ${url} ${inep} ${proxy} ${interface} \
+        >> ${dirname}/run.log
 elif [[ $1 == "--update" ]]; then
-    retstr=$(${bindir}/client $1 ${url} ${proxy})
+    retstr=$(${bindir}/client $1 ${url} ${proxy} ${interface})
     retval=$?
     if test ${retval} -eq 4; then
         echo "$retstr" | tee -a ${dirname}/run.log
-- 
GitLab