Created
January 31, 2020 15:52
-
-
Save ilyar/b621e9ee299826cce6403ad1e4ce79af to your computer and use it in GitHub Desktop.
Protocol Buffers Install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| TEMP_DIR=/tmp | |
| VERSION=`curl --silent "https://api.github.com/repos/protocolbuffers/protobuf/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")'` | |
| [[ -z VERSION ]] && echo "Could not get version from github" | |
| mkdir $TEMP_DIR/protoc_inst | |
| cd $TEMP_DIR/protoc_inst | |
| # Make sure you grab the latest version | |
| curl -OL "https://github.com/google/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip" | |
| # Unzip | |
| unzip "protoc-$VERSION-linux-x86_64.zip" -d protoc | |
| # Move protoc to /usr/local/bin/ | |
| sudo mv protoc/bin/* /usr/local/bin/ | |
| # Move protoc/include to /usr/local/include/ | |
| sudo mv protoc/include/* /usr/local/include/ | |
| rm -rf $TEMP_DIR/protoc_inst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment