Created
February 23, 2023 05:22
-
-
Save moto-timo/7fbb45c2423a5016e8ca7253d9f3d222 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 | |
USER=derailed | |
REPO=k9s | |
VERSION=$(curl -s https://api.github.com/repos/$USER/$REPO/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') | |
MACHINE=$(uname -m) | |
K9S_VERSION=$(k9s version -s | grep -oP '(v\d+\.\d+\.\d+)' ) | |
echo "Current k9s version: $K9S_VERSION" | |
echo "Upstream k9s version: $VERSION" | |
# https://github.com/derailed/k9s/releases/download/v0.24.12/k9s_Linux_x86_64.tar.gz | |
# https://github.com/derailed/k9s/releases/download/v0.24.12/k9s_Linux_arm64.tar.gz | |
# https://github.com/derailed/k9s/releases/download/v0.27.3/k9s_Linux_amd64.tar.gz | |
if [ "${MACHINE}" = 'x86_64' ]; then | |
MACHINE='amd64' | |
fi | |
if [ "${MACHINE}" = 'aarch64' ]; then | |
MACHINE='arm64' | |
fi | |
if [ "${K9S_VERSION}" != "${VERSION}" ]; then | |
# wget -qO- https://github.com/${USER}/${REPO}/releases/download/$VERSION/${REPO}_${VERSION}_Linux_${MACHINE}.tar.gz | tar -xvz -C /tmp | |
wget -qO- https://github.com/${USER}/${REPO}/releases/download/$VERSION/${REPO}_Linux_${MACHINE}.tar.gz | tar -xvz -C /tmp | |
sudo mv /tmp/k9s /usr/local/bin/ | |
else | |
echo "Nothing to do: ${K9S_VERSION} == ${VERSION}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment