From 77e11664931b94ea4f94eaaf03c9d5370939700b Mon Sep 17 00:00:00 2001 From: Abhishek Ranjan Date: Fri, 12 Apr 2024 11:30:47 +0530 Subject: [PATCH] Refactor --- scripts/protoc_installer.sh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/scripts/protoc_installer.sh b/scripts/protoc_installer.sh index 1ec2ca46e625..4026423bc9c0 100644 --- a/scripts/protoc_installer.sh +++ b/scripts/protoc_installer.sh @@ -1,5 +1,24 @@ #!/bin/bash -# Install protoc +# Copyright 2024 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu -o pipefail + +source "$(dirname $0)/vet-common.sh" + +# Perform installation of protoc from source based on OS. + PROTOC_VERSION="25.2" # Function to download pre-built binaries for Linux with @@ -25,10 +44,10 @@ install_protoc() { die "Unsupported architecture. Please consider manual installation." fi # Detect the Operating System - OS=$(uname -s) - case "$OS" in + case "$(uname -s)" in "Darwin") download_binary $ARCH "osx" "$1";; "Linux") download_binary $ARCH "linux" $1;; - *) echo "Unsupported operating system. Please consider manual installation." ;; + *) echo "Please consider manual installation from \ + https://github.com/protocolbuffers/protobuf/releases/ and add to PATH" ;; esac }