mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Add PATH when looking for executable locations
This commit is contained in:
parent
f538d808c9
commit
5d52b4ef9a
@ -211,6 +211,7 @@ kube::util::find-binary-for-platform() {
|
||||
"${KUBE_ROOT}/_output/local/bin/${platform}/${lookfor}"
|
||||
"${KUBE_ROOT}/platforms/${platform}/${lookfor}"
|
||||
)
|
||||
|
||||
# if we're looking for the host platform, add local non-platform-qualified search paths
|
||||
if [[ "${platform}" = "$(kube::util::host_platform)" ]]; then
|
||||
locations+=(
|
||||
@ -219,6 +220,12 @@ kube::util::find-binary-for-platform() {
|
||||
);
|
||||
fi
|
||||
|
||||
# looks for $1 in the $PATH
|
||||
if which ${lookfor} >/dev/null; then
|
||||
local -r local_bin="$(which ${lookfor})"
|
||||
locations+=( "${local_bin}" );
|
||||
fi
|
||||
|
||||
# List most recently-updated location.
|
||||
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user