forked from grpc/grpc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
16 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,32 @@ | ||
#!/bin/bash | ||
# Install protoc | ||
echo "Installing protoc" | ||
PROTOC_VERSION="25.2" | ||
echo "Protobuf version: ${PROTOC_VERSION}" | ||
|
||
# Function to download pre-built binaries for Linux | ||
download_binary() { | ||
echo "Attempting to download pre-built libprotoc ${PROTOC_VERSION} binary." | ||
|
||
# Download URL (adjust if a newer release is available) | ||
DOWNLOAD_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-$2-$1.zip" | ||
echo "Download URL: ${DOWNLOAD_URL}" | ||
|
||
# Download and unzip | ||
curl -LO "$DOWNLOAD_URL" | ||
echo "Downloaded" | ||
INSTALL_DIR="${3:-/home/runner/go}" | ||
INSTALL_DIR="${3:-${GOBIN:-${GOPATH:-$HOME/go}/bin}}" | ||
unzip "protoc-${PROTOC_VERSION}-$2-$1.zip" -d $INSTALL_DIR | ||
rm "protoc-${PROTOC_VERSION}-$2-$1.zip" | ||
} | ||
|
||
download_protoc() { | ||
# Determine architecture | ||
if [[ $(uname -m) == "x86_64" ]]; then | ||
ARCH="x86_64" | ||
elif [[ $(uname -m) == "aarch64" ]] || [[ $(uname -m) == "arm64" ]] ; then | ||
ARCH="aarch_64" | ||
else | ||
echo "Unsupported architecture. Please consider manual installation." | ||
return | ||
fi | ||
if [[ $(uname -m) == "x86_64" ]]; then | ||
ARCH="x86_64" | ||
elif [[ $(uname -m) == "aarch64" ]] || [[ $(uname -m) == "arm64" ]] ; then | ||
ARCH="aarch_64" | ||
else | ||
die "Unsupported architecture. Please consider manual installation." | ||
fi | ||
# Detect the Operating System | ||
OS=$(uname -s) | ||
case "$OS" in | ||
"Darwin") download_binary $ARCH "osx" "${WORKDIR:-.}";; | ||
"Darwin") download_binary $ARCH "osx" "$1";; | ||
"Linux") download_binary $ARCH "linux" $1;; | ||
*) echo "Unsupported operating system. Please consider manual installation." ;; | ||
*) echo "Unsupported operating system. Please consider manual installation." ;; | ||
esac | ||
} |
This file contains 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
This file contains 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
This file contains 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