Last active
April 3, 2020 04:24
-
-
Save deadc/47c8e661812526942007a3b6913c175d 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
#/usr/bin/env bash | |
BIN_PATH=${HOME}/.local/bin | |
OS_TYPE=$( uname | tr '[:upper:]' '[:lower:]' ) | |
function _download_kops_version() { | |
VER=$1 | |
BIN_FILE=kops | |
if [ ! -e "${BIN_PATH}/${BIN_FILE}-${VER}" ] ; then | |
wget -O ${BIN_PATH}/kops-${VER} https://github.com/kubernetes/kops/releases/download/${VER}/kops-${OS_TYPE}-amd64 | |
chmod +x ${BIN_PATH}/${BIN_FILE}-${VER} | |
fi | |
} | |
function _download_kubectl_version() { | |
VER=$1 | |
BIN_FILE=kubectl | |
if [ ! -e "${BIN_PATH}/${BIN_FILE}-${VER}" ] ; then | |
wget -O ${BIN_PATH}/kubectl-${VER} https://storage.googleapis.com/kubernetes-release/release/v${VER}/bin/${OS_TYPE}/amd64/kubectl | |
chmod +x ${BIN_PATH}/${BIN_FILE}-${VER} | |
fi | |
} | |
function _set_version() { | |
VER=$2 | |
BIN_FILE=$1 | |
if [ ! -e "${BIN_PATH}/${BIN_FILE}-${VER}" ] ; then | |
_download_${BIN_FILE,,}_version ${VER} | |
fi | |
ln -fs ${BIN_PATH}/${BIN_FILE}-${VER} ${BIN_PATH}/${BIN_FILE} | |
} | |
_set_version $1 $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment