Download macOS binaries for etcd and consul.

Instead of downloading Linux binaries when running macOS, detect platform
and download the appropriate binary.

Signed-off-by: Gerald Kaszuba <gak@gak0.com>
This commit is contained in:
gak 2019-02-19 11:12:00 +11:00 коммит произвёл Gerald Kaszuba
Родитель 092479406b
Коммит 005658898f
1 изменённых файлов: 22 добавлений и 8 удалений

Просмотреть файл

@ -196,13 +196,22 @@ function install_etcd() {
local version="$1"
local dist="$2"
download_url=https://github.com/coreos/etcd/releases/download
tar_file="etcd-${version}-linux-amd64.tar.gz"
case $(uname) in
Linux) local platform=linux; local ext=tar.gz;;
Darwin) local platform=darwin; local ext=zip;;
esac
wget "$download_url/$version/$tar_file"
tar xzf "$tar_file"
rm "$tar_file"
ln -snf "$dist/etcd-${version}-linux-amd64/etcd" "$VTROOT/bin/etcd"
download_url=https://github.com/coreos/etcd/releases/download
file="etcd-${version}-${platform}-amd64.${ext}"
wget "$download_url/$version/$file"
if [ "$ext" = "tar.gz" ]; then
tar xzf "$file"
else
unzip "$file"
fi
rm "$file"
ln -snf "$dist/etcd-${version}-${platform}-amd64/etcd" "$VTROOT/bin/etcd"
}
install_dep "etcd" "v3.3.10" "$VTROOT/dist/etcd" install_etcd
@ -212,9 +221,14 @@ function install_consul() {
local version="$1"
local dist="$2"
case $(uname) in
Linux) local platform=linux;;
Darwin) local platform=darwin;;
esac
download_url=https://releases.hashicorp.com/consul
wget "${download_url}/${version}/consul_${version}_linux_amd64.zip"
unzip "consul_${version}_linux_amd64.zip"
wget "${download_url}/${version}/consul_${version}_${platform}_amd64.zip"
unzip "consul_${version}_${platform}_amd64.zip"
ln -snf "$dist/consul" "$VTROOT/bin/consul"
}
install_dep "Consul" "1.4.0" "$VTROOT/dist/consul" install_consul