Adjust Krew installation function

This commit is contained in:
dabruh 2023-09-15 13:42:07 +02:00
parent e1a1c49770
commit 17c46442bd
1 changed files with 9 additions and 7 deletions

View File

@ -197,14 +197,16 @@ function setup_brew_formulas() {
} }
function setup_krew() { function setup_krew() {
cd "$(mktemp -d)" && set -e
OS="$(uname | tr '[:upper:]' '[:lower:]')" && cd "$(mktemp -d)"
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && OS="$(uname | tr '[:upper:]' '[:lower:]')"
KREW="krew-${OS}_${ARCH}" && ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && KREW="krew-${OS}_${ARCH}"
tar zxvf "${KREW}.tar.gz" && curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz"
tar zxvf "${KREW}.tar.gz"
./"${KREW}" install krew ./"${KREW}" install krew
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
set +e
} }
function setup_krew_plugins() { function setup_krew_plugins() {