You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
Plaintext
58 lines
1.5 KiB
Plaintext
5 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
MINIKUBE_VERSION=${MINIKUBE_VERSION:-v1.9.2}
|
||
|
|
||
|
PREFIX_DIR=/usr/local
|
||
|
BIN_DIR=${PREFIX_DIR}/bin
|
||
|
|
||
|
MINIKUBE_PREFIX_DIR=${PREFIX_DIR}/apps/minikube
|
||
|
MINIKUBE_DEST_DIR=${MINIKUBE_PREFIX_DIR}/${MINIKUBE_VERSION}
|
||
|
MINIKUBE_CURRENT=${MINIKUBE_PREFIX_DIR}/current
|
||
|
|
||
|
if [[ $(uname) =~ Linux ]]; then
|
||
|
OS=linux
|
||
|
elif [[ $(uname) =~ Darwin ]]; then
|
||
|
OS=darwin
|
||
|
else
|
||
4 years ago
|
echo "unsupported os: $(uname)"
|
||
5 years ago
|
exit 1
|
||
|
fi
|
||
|
|
||
|
ARCH=
|
||
|
if [[ $(uname -m) == x86_64 ]]; then
|
||
|
ARCH=amd64
|
||
|
else
|
||
4 years ago
|
echo arch not yet supported: "$(uname -m)"
|
||
5 years ago
|
exit 1
|
||
|
fi
|
||
|
|
||
|
TMP_DIR=
|
||
|
if [[ ! -d ${MINIKUBE_DEST_DIR} ]]; then
|
||
4 years ago
|
sudo mkdir -p "${MINIKUBE_DEST_DIR}"
|
||
5 years ago
|
TMP_DIR=$(mktemp --directory)
|
||
4 years ago
|
DEST_FILE="${TMP_DIR}"/minikube
|
||
|
URL="https://github.com/kubernetes/minikube/releases/download/${MINIKUBE_VERSION}/minikube-${OS}-${ARCH}"
|
||
|
echo downloading minikube "${MINIKUBE_VERSION}" to temp directory "${TMP_DIR}"
|
||
|
curl --silent --location --output "${DEST_FILE}" "${URL}"
|
||
|
|
||
|
sudo chmod 755 "${DEST_FILE}"
|
||
|
sudo mv "${DEST_FILE}" "${MINIKUBE_DEST_DIR}"
|
||
|
sudo chown --recursive root:root "${MINIKUBE_DEST_DIR}"
|
||
5 years ago
|
else
|
||
4 years ago
|
echo minikube "${MINIKUBE_VERSION}" already installed
|
||
5 years ago
|
fi
|
||
|
|
||
4 years ago
|
cd "${MINIKUBE_PREFIX_DIR}"
|
||
5 years ago
|
[[ -s current ]] && sudo unlink current
|
||
4 years ago
|
sudo ln --symbolic "${MINIKUBE_VERSION}"/ current
|
||
|
echo current version set to "${MINIKUBE_VERSION}"
|
||
5 years ago
|
cd ${BIN_DIR}
|
||
|
[[ -L ${BIN_DIR}/minikube ]] || sudo ln --symbolic ${MINIKUBE_CURRENT}/minikube
|
||
|
|
||
|
if [[ $TMP_DIR != "" ]]; then
|
||
4 years ago
|
rm -rf "${TMP_DIR}"
|
||
|
echo removed up temp directory "${TMP_DIR}"
|
||
5 years ago
|
fi
|