From 1380fc5e7bf2caa07175bff5f6c6f5811ebbf130 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Mon, 1 Aug 2022 15:33:13 -0400 Subject: [PATCH] Avoid hard coding Operating System and Architecture in hack/lib/etcd.sh Signed-off-by: Davanum Srinivas --- hack/lib/etcd.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 2424a9a2af4..f6fd950f7c8 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -161,19 +161,21 @@ kube::etcd::install() { fi if [[ ${os} == "darwin" ]]; then - download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip" + download_file="etcd-v${ETCD_VERSION}-${os}-${arch}.zip" url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}" kube::util::download_file "${url}" "${download_file}" unzip -o "${download_file}" - ln -fns "etcd-v${ETCD_VERSION}-darwin-amd64" etcd + ln -fns "etcd-v${ETCD_VERSION}-${os}-${arch}" etcd rm "${download_file}" - else - url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-${arch}.tar.gz" - download_file="etcd-v${ETCD_VERSION}-linux-${arch}.tar.gz" + elif [[ ${os} == "linux" ]]; then + url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz" + download_file="etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz" kube::util::download_file "${url}" "${download_file}" tar xzf "${download_file}" - ln -fns "etcd-v${ETCD_VERSION}-linux-${arch}" etcd + ln -fns "etcd-v${ETCD_VERSION}-${os}-${arch}" etcd rm "${download_file}" + else + kube::log::info "${os} is NOT supported." fi kube::log::info "etcd v${ETCD_VERSION} installed. To use:" kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\""