2017-09-07 18:49:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2020-03-15 10:01:55 +00:00
|
|
|
VERSION="1.6.4"
|
2017-09-07 18:49:22 +00:00
|
|
|
DOWNLOAD=https://releases.hashicorp.com/consul/${VERSION}/consul_${VERSION}_linux_amd64.zip
|
|
|
|
|
|
|
|
function install_consul() {
|
|
|
|
if [[ -e /usr/bin/consul ]] ; then
|
|
|
|
if [ "v${VERSION}" == "$(consul version | head -n1 | awk '{print $2}')" ] ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
2019-08-29 13:51:48 +00:00
|
|
|
|
2020-03-23 15:47:26 +00:00
|
|
|
curl -sSL --fail -o /tmp/consul.zip ${DOWNLOAD}
|
2017-09-07 18:49:22 +00:00
|
|
|
|
|
|
|
unzip -d /tmp /tmp/consul.zip
|
|
|
|
mv /tmp/consul /usr/bin/consul
|
|
|
|
chmod +x /usr/bin/consul
|
|
|
|
}
|
|
|
|
|
|
|
|
install_consul
|