Forked from sofyan-ahmad/Install protobuf 3 on Ubuntu
Last active
February 19, 2018 09:09
-
-
Save chriscz/0f00ec90b2ef9d0a4413ab75a8e435a0 to your computer and use it in GitHub Desktop.
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 | |
# https://gist.github.com/sofyanhadia/37787e5ed098c97919b8c593f0ec44d8 | |
# Make sure you grab the latest version | |
set -euo pipefail | |
VERSION='3.5.1' | |
FILENAME=protoc-${VERSION}-linux-x86_64.zip | |
INSTALL="/opt/protobuf/protoc-${VERSION}" | |
CURRENT="/opt/protobuf/current" | |
curl -OL https://github.com/google/protobuf/releases/download/v${VERSION}/${FILENAME} | |
# Unzip | |
sudo mkdir -p "$INSTALL" | |
sudo unzip -o ${FILENAME} -d "$INSTALL" | |
# create symlink to the current version | |
if [ -e "$CURRENT" ]; then | |
sudo unlink "${CURRENT}" | |
fi | |
sudo ln -sf "${INSTALL}" "${CURRENT}" | |
# update access rights | |
sudo chmod -R a+rx ${INSTALL}/bin | |
# directories should be READ EXECUTE, but not the files | |
find /opt/protobuf/ -type d -exec sudo chmod a+rx {} \; | |
sudo chmod -R a+r ${INSTALL}/include | |
# link all the includes | |
sudo ln -sf ${CURRENT}/include/* /usr/local/include/ | |
# XXX MANUALLY | |
echo "Add ${CURRENT}/bin to your PATH" | |
# Optional: change owner | |
# sudo chwon [user] /usr/local/bin/protoc | |
# sudo chwon -R [user] /usr/local/include/google |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment