From 7d6ba67da055d76c15f9a07b319af2262406bda6 Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Wed, 29 Apr 2020 15:58:03 -0700 Subject: [PATCH] Update find-binary-for-platform to work with non-GNU versions of find --- hack/lib/util.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 43e7226597c..01f8b4bc765 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -208,7 +208,12 @@ kube::util::find-binary-for-platform() { locations+=("$location"); done < <(find "${KUBE_ROOT}/bazel-bin/" -type f -executable \ \( -path "*/${platform/\//_}*/${lookfor}" -o -path "*/${lookfor}" \) 2>/dev/null || true) - + # search for executables for non-GNU versions of find (eg. BSD) + while IFS=$'\n' read -r location; do + locations+=("$location"); + done < <(find "${KUBE_ROOT}/bazel-bin/" -type f -perm -111 \ + \( -path "*/${platform/\//_}*/${lookfor}" -o -path "*/${lookfor}" \) 2>/dev/null || true) + # List most recently-updated location. local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 ) echo -n "${bin}"