add install script for minikube
parent
792f11c8d1
commit
9e71adc5d1
@ -0,0 +1,57 @@
|
|||||||
|
#!/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
|
||||||
|
echo unsupported os: $(uname)
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ARCH=
|
||||||
|
if [[ $(uname -m) == x86_64 ]]; then
|
||||||
|
ARCH=amd64
|
||||||
|
else
|
||||||
|
echo arch not yet supported: $(uname -m)
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMP_DIR=
|
||||||
|
if [[ ! -d ${MINIKUBE_DEST_DIR} ]]; then
|
||||||
|
sudo mkdir -p ${MINIKUBE_DEST_DIR}
|
||||||
|
TMP_DIR=$(mktemp --directory)
|
||||||
|
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}
|
||||||
|
else
|
||||||
|
echo minikube ${MINIKUBE_VERSION} already installed
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ${MINIKUBE_PREFIX_DIR}
|
||||||
|
[[ -s current ]] && sudo unlink current
|
||||||
|
sudo ln --symbolic ${MINIKUBE_VERSION}/ current
|
||||||
|
echo current version set to ${MINIKUBE_VERSION}
|
||||||
|
cd ${BIN_DIR}
|
||||||
|
[[ -L ${BIN_DIR}/minikube ]] || sudo ln --symbolic ${MINIKUBE_CURRENT}/minikube
|
||||||
|
|
||||||
|
if [[ $TMP_DIR != "" ]]; then
|
||||||
|
rm -rf ${TMP_DIR}
|
||||||
|
echo removed up temp directory ${TMP_DIR}
|
||||||
|
fi
|
Loading…
Reference in New Issue