mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Use a helper to find built binaries
Instead of doing it all outselves....
This commit is contained in:
parent
55d133eabb
commit
d7a89117b7
@ -96,6 +96,18 @@ kube::util::host_platform() {
|
|||||||
echo "${host_os}/${host_arch}"
|
echo "${host_os}/${host_arch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kube::util::find-binary() {
|
||||||
|
local lookfor="${1}"
|
||||||
|
local host_platform="$(kube::util::host_platform)"
|
||||||
|
local locations=(
|
||||||
|
"${KUBE_ROOT}/_output/dockerized/bin/${host_platform}/${lookfor}"
|
||||||
|
"${KUBE_ROOT}/_output/local/bin/${host_platform}/${lookfor}"
|
||||||
|
"${KUBE_ROOT}/platforms/${host_platform}/${lookfor}"
|
||||||
|
)
|
||||||
|
local bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||||
|
echo -n "${bin}"
|
||||||
|
}
|
||||||
|
|
||||||
# Wait for background jobs to finish. Return with
|
# Wait for background jobs to finish. Return with
|
||||||
# an error status if any of the jobs failed.
|
# an error status if any of the jobs failed.
|
||||||
kube::util::wait-for-jobs() {
|
kube::util::wait-for-jobs() {
|
||||||
|
@ -30,61 +30,10 @@ get_absolute_dirname() {
|
|||||||
echo "$(cd "$(dirname "$1")" && pwd)"
|
echo "$(cd "$(dirname "$1")" && pwd)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect the OS name/arch so that we can find our binary
|
|
||||||
case "$(uname -s)" in
|
|
||||||
Darwin)
|
|
||||||
host_os=darwin
|
|
||||||
;;
|
|
||||||
Linux)
|
|
||||||
host_os=linux
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported host OS. Must be Linux or Mac OS X." >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$(uname -m)" in
|
|
||||||
x86_64*)
|
|
||||||
host_arch=amd64
|
|
||||||
;;
|
|
||||||
i?86_64*)
|
|
||||||
host_arch=amd64
|
|
||||||
;;
|
|
||||||
amd64*)
|
|
||||||
host_arch=amd64
|
|
||||||
;;
|
|
||||||
arm*)
|
|
||||||
host_arch=arm
|
|
||||||
;;
|
|
||||||
i?86*)
|
|
||||||
host_arch=x86
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Find binary
|
# Find binary
|
||||||
locations=(
|
gendocs=$(kube::util::find-binary "gendocs")
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/gendocs"
|
genman=$(kube::util::find-binary "genman")
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/gendocs"
|
genbashcomp=$(kube::util::find-binary "genbashcomp")
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/gendocs"
|
|
||||||
)
|
|
||||||
gendocs=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
|
||||||
locations=(
|
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/genman"
|
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/genman"
|
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/genman"
|
|
||||||
)
|
|
||||||
genman=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
|
||||||
locations=(
|
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/genbashcomp"
|
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/genbashcomp"
|
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/genbashcomp"
|
|
||||||
)
|
|
||||||
genbashcomp=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
|
||||||
|
|
||||||
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" ]]; then
|
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" ]]; then
|
||||||
{
|
{
|
||||||
|
@ -30,63 +30,9 @@ get_absolute_dirname() {
|
|||||||
echo "$(cd "$(dirname "$1")" && pwd)"
|
echo "$(cd "$(dirname "$1")" && pwd)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect the OS name/arch so that we can find our binary
|
gendocs=$(kube::util::find-binary "gendocs")
|
||||||
case "$(uname -s)" in
|
genman=$(kube::util::find-binary "genman")
|
||||||
Darwin)
|
genbashcomp=$(kube::util::find-binary "genbashcomp")
|
||||||
host_os=darwin
|
|
||||||
;;
|
|
||||||
Linux)
|
|
||||||
host_os=linux
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported host OS. Must be Linux or Mac OS X." >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$(uname -m)" in
|
|
||||||
x86_64*)
|
|
||||||
host_arch=amd64
|
|
||||||
;;
|
|
||||||
i?86_64*)
|
|
||||||
host_arch=amd64
|
|
||||||
;;
|
|
||||||
amd64*)
|
|
||||||
host_arch=amd64
|
|
||||||
;;
|
|
||||||
arm*)
|
|
||||||
host_arch=arm
|
|
||||||
;;
|
|
||||||
i?86*)
|
|
||||||
host_arch=x86
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Find binary
|
|
||||||
locations=(
|
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/gendocs"
|
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/gendocs"
|
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/gendocs"
|
|
||||||
)
|
|
||||||
gendocs=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
|
||||||
|
|
||||||
locations=(
|
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/genman"
|
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/genman"
|
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/genman"
|
|
||||||
)
|
|
||||||
genman=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
|
||||||
|
|
||||||
locations=(
|
|
||||||
"${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/genbashcomp"
|
|
||||||
"${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/genbashcomp"
|
|
||||||
"${KUBE_ROOT}/platforms/${host_os}/${host_arch}/genbashcomp"
|
|
||||||
)
|
|
||||||
genbashcomp=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
|
||||||
|
|
||||||
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" ]]; then
|
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" ]]; then
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user