Modify the function is_on_target to search commands that are not under the PATH.
PATCH v2 1/1 Modify the function is_on_target to search commands that are not under the PATH.
Signed-off-by Wang Mingyu <[email protected]>
--- engine/scripts/functions.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
engine/scripts/functions.sh +4 -3
@@ -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
Signature · 1 line
1.8.3.1