2017-09-08 03:12:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2019-08-29 14:24:48 +00:00
|
|
|
VERSION="1.6.0"
|
2017-10-21 23:08:22 +00:00
|
|
|
OS="linux"
|
|
|
|
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
|
|
|
OS="darwin"
|
|
|
|
fi
|
|
|
|
DOWNLOAD=https://releases.hashicorp.com/consul/${VERSION}/consul_${VERSION}_${OS}_amd64.zip
|
2017-09-08 03:12:52 +00:00
|
|
|
|
|
|
|
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 14:24:48 +00:00
|
|
|
|
2020-03-23 15:47:26 +00:00
|
|
|
curl -sSL --fail -o /tmp/consul.zip ${DOWNLOAD}
|
2017-09-08 03:12:52 +00:00
|
|
|
|
|
|
|
unzip -d /tmp /tmp/consul.zip
|
2017-10-19 19:10:56 +00:00
|
|
|
mv /tmp/consul /usr/local/bin/consul
|
|
|
|
chmod +x /usr/local/bin/consul
|
2017-09-08 03:12:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
install_consul
|