From efb624314585e6ab32f302fb69fb9edef9f4116e Mon Sep 17 00:00:00 2001 From: dabruh <11458706-dabruh@users.noreply.gitlab.com> Date: Wed, 14 Dec 2022 09:41:02 +0100 Subject: [PATCH] Install krew --- setup_system.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/setup_system.sh b/setup_system.sh index 83cb192..c3bf7f1 100755 --- a/setup_system.sh +++ b/setup_system.sh @@ -169,6 +169,18 @@ function setup_brew_formulas() { done } +function setup_krew() { + set -x + cd "$(mktemp -d)" && + OS="$(uname | tr '[:upper:]' '[:lower:]')" && + ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && + KREW="krew-${OS}_${ARCH}" && + curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && + tar zxvf "${KREW}.tar.gz" && + ./"${KREW}" install krew + export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" +} + function setup_krew_plugins() { local targets=("krew-any") packages @@ -231,7 +243,7 @@ function setup_arch_with_yay() { done } -function setup_arch_with_pip(){ +function setup_arch_with_pip() { local targets=("pip-any") packages packages="$(get_packages "${targets[@]}")" @@ -248,7 +260,8 @@ function setup_arch() { configure_ufw || return 6 setup_homebrew || return 7 setup_brew_formulas || return 8 - setup_krew_plugins || return 9 + setup_krew || return 9 + setup_krew_plugins || return 10 } # @@ -281,7 +294,7 @@ function setup_debian_with_apt() { sudo apt-get install $packages -y || return 2 } -function setup_debian_with_pip(){ +function setup_debian_with_pip() { local targets=("pip-any") packages packages="$(get_packages "${targets[@]}")" @@ -303,7 +316,8 @@ function setup_debian() { configure_ufw || return 6 setup_homebrew || return 7 setup_brew_formulas || return 8 - setup_krew_plugins || return 9 + setup_krew || return 9 + setup_krew_plugins || return 10 } ID_LIKE="$(grep ID_LIKE=