Added OS verification for third party etcd binary

This commit is contained in:
Mayank Gaikwad 2018-06-06 16:44:28 +05:30
parent c10e8bc4f0
commit 5357f9a7e8

View File

@ -102,11 +102,13 @@ kube::etcd::cleanup() {
kube::etcd::install() {
(
local os
cd "${KUBE_ROOT}/third_party"
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-* ]]; then
os=$(uname | tr "[:upper:]" "[:lower:]")
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
return # already installed
fi
if [[ $(uname) == "Darwin" ]]; then
if [[ ${os} == "darwin" ]]; then
download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"
kube::util::download_file "${url}" "${download_file}"
@ -119,6 +121,7 @@ kube::etcd::install() {
kube::util::download_file "${url}" "${download_file}"
tar xzf "${download_file}"
ln -fns "etcd-v${ETCD_VERSION}-linux-amd64" etcd
rm "${download_file}"
fi
kube::log::info "etcd v${ETCD_VERSION} installed. To use:"
kube::log::info "export PATH=$(pwd)/etcd:\${PATH}"