From 5357f9a7e8bd721fa4c1517f310e616b198a8aa3 Mon Sep 17 00:00:00 2001 From: Mayank Gaikwad <8110509+mgdevstack@users.noreply.github.com> Date: Wed, 6 Jun 2018 16:44:28 +0530 Subject: [PATCH] Added OS verification for third party etcd binary --- hack/lib/etcd.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 3719dbf67ba..1aacae6cfec 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -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}"