From 489050ee7e0659fe388fb7b99e08c0675e212a56 Mon Sep 17 00:00:00 2001 From: Lockszmith Date: Wed, 15 Nov 2023 20:01:08 -0500 Subject: [PATCH] fixed: fix-kubectl installation of tools --- fix-kubectl | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/fix-kubectl b/fix-kubectl index 14990d5..077b25e 100755 --- a/fix-kubectl +++ b/fix-kubectl @@ -38,41 +38,41 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then if [[ -n "$(type -t 'kubectl-cnpg')" ]]; then . <( kubectl cnpg completion ${SHELL##*/} ) - else - DL_VER=v1.21.1 - GH_URL=https://github.com/cloudnative-pg/cloudnative-pg - DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb" - URL=${GH_URL}/releases/download/${DL_VER}/${DL_FILE} - printf '%s\n' \ - 'To download and install cnpg kubectl plugin, run:' \ - " curl -sSLO ${URL}" \ - " sudo dpkg -i $DL_FILE" - + fi + if [[ -z "$(type -t 'kubectl-cnpg')" || -n "$UPGRADE" ]]; then + DL_VER=1.21.1 + GH_URL=https://github.com/cloudnative-pg/cloudnative-pg + DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb" + URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE} + printf '%s\n' \ + 'To download and install cnpg kubectl plugin, run:' \ + " curl -sSLO ${URL}" \ + " sudo dpkg -i $DL_FILE" fi - if [[ -z "$(type -t 'kubetui')" ]]; then - DL_VER='v1.4.2' - GH_URL=https://github.com/sarub0b0/kubetui - DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls - URL=${GH_URL}/releases/download/${DL_VER}/${DL_FILE} - printf '%s\n' \ - 'To download and install kubetui, run:' \ - " curl -sSL ${URL} > ~/bin/kubetui" \ - " chmod +x ~/bin/kubetui" + if [[ -z "$(type -t 'kubetui')" || -n "$UPGRADE" ]]; then + DL_VER=1.4.2 + GH_URL=https://github.com/sarub0b0/kubetui + DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls + URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE} + printf '%s\n' \ + 'To download and install kubetui, run:' \ + " curl -sSL ${URL} > ~/bin/kubetui" \ + " chmod +x ~/bin/kubetui" fi - if [[ -z "$(type -t 'k3s')" ]]; then - printf '%s\n' \ - 'To download and install k3s, run:' \ - " curl -sS https://webinstall.dev/k9s | bash" + if [[ -z "$(type -t 'k9s')" || -n "$UPGRADE" ]]; then + printf '%s\n' \ + 'To download and install k9s, run:' \ + " curl -sS https://webinstall.dev/k9s | bash" fi if [[ -n "$(type -t 'k3s')" ]]; then - . <( k3s completion ${SHELL##*/} ) + . <( k3s completion "${SHELL##*/}" ) fi if [[ -n "$(type -t 'helm')" ]]; then - . <( helm completion ${SHELL##*/} 2>/dev/null ) + . <( helm completion "${SHELL##*/}" 2>/dev/null ) fi kg() { @@ -80,7 +80,6 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then } fi elif [[ "$1" == '-' ]]; then - printf "SCRIPT_FULL_PATH='%s'\n" "${BASH_SOURCE[0]}" cat "${BASH_SOURCE[0]}" else SCRIPT_NAME="$BASE_0"