File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,24 +53,17 @@ sudo apt update && sudo apt install -y openssl ca-certificates libssl3 libssl-de
5353Install the Protobuf compiler:
5454
5555::: note
56- While many package repositories provide a ` protobuf-compiler ` package in lieu of manually installing protoc, we've found at the time of this writing that most of them use v3.21 which is quite out of date. We recommend getting the latest version manually.
56+ While many package repositories provide a ` protobuf-compiler ` package in lieu of manually installing protoc, we've found at the time of this writing that Debian-based ones use v3.21 which is quite out of date. We recommend getting the latest version manually.
5757:::
5858
59+ We provide a convenient recipe to install the latest version directly from the GitHub releases page:
60+
5961``` bash
60- PROTOC_VERSION=$( curl -s " https://api.github.com/repos/protocolbuffers/protobuf/releases/latest" | grep -Po ' "tag_name": "v\K[0-9.]+' )
61- MACHINE_ARCH=$( uname -m)
62- case " ${MACHINE_ARCH} " in
63- aarch64) PROTOC_ARCH=aarch_64;;
64- x86_64) PROTOC_ARCH=x86_64;;
65- * ) echo " ${MACHINE_ARCH} is not supported." ; exit 1;;
66- esac
67- curl -sLo protoc.zip https://github.com/protocolbuffers/protobuf/releases/latest/download/protoc-$PROTOC_VERSION -linux-$PROTOC_ARCH .zip
68- sudo unzip -q protoc.zip bin/protoc -d /usr
69- sudo unzip -q protoc.zip " include/google/*" -d /usr
70- sudo chmod a+x /usr/bin/protoc
71- rm -rf protoc.zip
62+ just install-protoc
7263```
7364
65+ This works on OSX and Linux systems, but you are welcome to download and install it manually as well.
66+
7467With the prerequisites set up, pull the repository:
7568``` bash
7669git clone https://github.com/Commit-Boost/commit-boost-client
Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ _docker-build-image-multiarch version crate local-docker-registry: _create-docke
179179# === Utilities ===
180180# =================
181181
182+ install-protoc :
183+ provisioning/ protoc.sh
184+
182185docker-build-test-modules :
183186 docker build -t test_da_commit . -f examples/ da_commit/ Dockerfile
184187 docker build -t test_builder_log . -f examples/ builder_log/ Dockerfile
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ case "$(uname)" in
2121 Linux* )
2222 PROTOC_OS=" linux" ;
2323 TARGET_DIR=" /usr" ; # Assumes the script is run as root or the user can do it manually
24- apt update && apt install -y unzip curl ca-certificates jq ;;
24+ if [ $( id -u) != " 0" ]; then
25+ CMD_PREFIX=" sudo " ;
26+ fi
27+ ${CMD_PREFIX} apt update && ${CMD_PREFIX} apt install -y unzip curl ca-certificates jq ;;
2528 * )
2629 echo " Unsupported OS: $( uname) " ;
2730 exit 1 ;;
@@ -50,8 +53,8 @@ echo "Installing protoc: $PROTOC_VERSION-$PROTOC_OS-$PROTOC_ARCH"
5053
5154# Download and install protoc
5255curl --retry 10 --retry-delay 2 --retry-all-errors -fsLo protoc.zip https://github.com/protocolbuffers/protobuf/releases/latest/download/protoc-$PROTOC_VERSION -$PROTOC_OS -$PROTOC_ARCH .zip || fail " Failed to download protoc"
53- unzip -q protoc.zip bin/protoc -d $TARGET_DIR || fail " Failed to unzip protoc"
54- unzip -q protoc.zip " include/google/*" -d $TARGET_DIR || fail " Failed to unzip protoc includes"
55- chmod a+x $TARGET_DIR /bin/protoc || fail " Failed to set executable permissions for protoc"
56+ ${CMD_PREFIX} unzip -qo protoc.zip bin/protoc -d $TARGET_DIR || fail " Failed to unzip protoc"
57+ ${CMD_PREFIX} unzip -qo protoc.zip " include/google/*" -d $TARGET_DIR || fail " Failed to unzip protoc includes"
58+ ${CMD_PREFIX} chmod a+x $TARGET_DIR /bin/protoc || fail " Failed to set executable permissions for protoc"
5659rm -rf protoc.zip || fail " Failed to remove protoc zip file"
5760echo " protoc ${PROTOC_VERSION} installed successfully for ${PROTOC_OS} ${PROTOC_ARCH} "
You can’t perform that action at this time.
0 commit comments