github.com/rohankumardubey/nomad@v0.11.8/scripts/travis-consul.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -o errexit
     4  
     5  VERSION="1.6.0"
     6  OS="linux"
     7  if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
     8      OS="darwin"
     9  fi
    10  DOWNLOAD=https://releases.hashicorp.com/consul/${VERSION}/consul_${VERSION}_${OS}_amd64.zip
    11  
    12  function install_consul() {
    13  	if [[ -e /usr/bin/consul ]] ; then
    14  		if [ "v${VERSION}" == "$(consul version | head -n1 | awk '{print $2}')" ] ; then
    15  			return
    16  		fi
    17  	fi
    18  
    19  	curl -sSL --fail -o /tmp/consul.zip ${DOWNLOAD}
    20  
    21  	unzip -d /tmp /tmp/consul.zip
    22  	mv /tmp/consul /usr/local/bin/consul
    23  	chmod +x /usr/local/bin/consul
    24  }
    25  
    26  install_consul