[Fuego] [PATCH v2] Modify the function is_on_target to search commands that are not under the PATH.

Wang Mingyu wangmy at cn.fujitsu.com
Fri Dec 21 16:34:20 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/scripts/functions.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
index e75760b..7aee1ee 100644
--- a/engine/scripts/functions.sh
+++ b/engine/scripts/functions.sh
@@ -944,15 +944,16 @@ function is_on_target {
     # FIXTHIS: race condition
     tmpfile=$(mktemp /tmp/found_loc.XXXXXX)
     cmd "touch $tmpfile"
-    if [ -z "$3" ] ; then
-        safe_cmd "find / -name \"$1\" | head -n 1 >$tmpfile"
-    else
+    if [ ! -z "$3" ] ; then
         # split search path on colon
         for d in $(echo "$3" | tr ":" "\n") ; do
             # execute a command on the target to detect $d/$1
             cmd "if [ -z \"\$(cat $tmpfile)\" -a -e \"$d/$1\" ] ; then echo \"$d/$1\" >$tmpfile ; fi"
         done
     fi
+    safe_cmd "if [ ! -s $tmpfile ] ; then
+        find / -name \"$1\" | head -n 1 >$tmpfile
+    fi"
     get $tmpfile $tmpfile
     LOCATION=$(cat $tmpfile)
     export $2=$LOCATION
-- 
1.8.3.1





More information about the Fuego mailing list