From 89d36a43192c7f7f6c0fa6c46082337885d402a4 Mon Sep 17 00:00:00 2001
From: Vinicius Ruoso <vkr07@c3sl.ufpr.br>
Date: Thu, 11 Feb 2010 12:08:17 -0200
Subject: [PATCH] run-config.sh: Added support to return the client binary
 return code

This is necessary because the collect agent must find out if it needs to
auto-update.

When calling run.sh with "--update" option, the collect agent must check if
the return code equals to 4 to update.

Signed-off-by: Vinicius Ruoso <vkr07@c3sl.ufpr.br>
Acked-by: Ricardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
Acked-by: Diego Giovane Pasqualin <dgp06@c3sl.ufpr.br>
Acked-by: Josiney de Souza <josineys@c3sl.ufpr.br>
Signed-off-by: Danilo K. S. Yorinori <danilok@c3sl.ufpr.br>
---
 run-config.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/run-config.sh b/run-config.sh
index ecdef85..8596010 100755
--- a/run-config.sh
+++ b/run-config.sh
@@ -62,8 +62,13 @@ ppasswd=
 date +"%F %T" >> ${dirname}/run.log
 # Execution
 if [[ $# == 1 && $1 == "--update" ]]; then
-    ${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} ${puid} ${ppasswd} 2>> ${dirname}/run.log | tee -a ${dirname}/run.log
+    retstr=$(${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} \
+                                 ${puid} ${ppasswd} 2>> ${dirname}/run.log)
+    retval=$?
+    echo "$retstr" >> ${dirname}/run.log
+    exit $retval
 else
-    ${bindir}/client ${url} ${inep} ${mac} ${phost} ${pport} ${puid} ${ppasswd} >> ${dirname}/run.log 2>&1
+    ${bindir}/client ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \
+                     ${ppasswd} >> ${dirname}/run.log 2>&1
 fi
 EOF
-- 
GitLab