Created
April 4, 2019 20:58
-
-
Save caarlos0/8560a0520994b56e16449f492c27781c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -ex | |
TAR_FILE="/tmp/kubeval.tar.gz" | |
RELEASES_URL="https://github.com/garethr/kubeval/releases" | |
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" | |
last_version() { | |
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | | |
rev | | |
cut -f1 -d'/'| | |
rev | |
} | |
download() { | |
test -z "$VERSION" && VERSION="$(last_version)" | |
test -z "$VERSION" && { | |
echo "Unable to get kubeval version." >&2 | |
exit 1 | |
} | |
rm -f "$TAR_FILE" | |
os="linux" | |
test "$(uname -s)" = "Darwin" && os="darwin" | |
curl -s -L -o "$TAR_FILE" \ | |
"$RELEASES_URL/download/$VERSION/kubeval-${os}-amd64.tar.gz" | |
} | |
download | |
mkdir -p .bin | |
tar -xf "$TAR_FILE" -C .bin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment