github.com/thomasobenaus/nomad@v0.11.1/scripts/vagrant-linux-priv-protoc.sh (about) 1 #!/usr/bin/env bash 2 3 set -o errexit 4 5 # Make sure you grab the latest version 6 VERSION=3.6.1 7 DOWNLOAD=https://github.com/google/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_64.zip 8 9 function install_protoc() { 10 if [[ -e /usr/local/bin/protoc ]] ; then 11 if [ "${VERSION}" = "$(protoc --version | cut -d ' ' -f 2)" ] ; then 12 return 13 fi 14 fi 15 16 # Download 17 curl -sSL --fail -o /tmp/protoc.zip ${DOWNLOAD} 18 19 # Unzip 20 unzip /tmp/protoc.zip -d /tmp/protoc3 21 22 # all protoc files should be world-wide readable, specially the include files 23 chmod -R a+r /tmp/protoc3 24 25 # Move protoc to /usr/local/bin/ 26 mv /tmp/protoc3/bin/* /usr/local/bin/ 27 28 # Move protoc3/include to /usr/local/include/ 29 mv /tmp/protoc3/include/* /usr/local/include/ 30 31 # Link 32 ln -s /usr/local/bin/protoc /usr/bin/protoc 33 34 rm -rf /tmp/protoc3 /tmp/protoc.zip 35 } 36 37 install_protoc