open-vault/scripts/protocversioncheck.sh
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

21 lines
621 B
Bash
Executable file

#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
set -euo pipefail
PROTOC_CMD=${PROTOC_CMD:-protoc}
PROTOC_VERSION_EXACT="$1"
echo "==> Checking that protoc is at version $1..."
PROTOC_VERSION=$($PROTOC_CMD --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
if [ "$PROTOC_VERSION" == "$PROTOC_VERSION_EXACT" ]; then
echo "Using protoc version $PROTOC_VERSION"
else
echo "protoc should be at $PROTOC_VERSION_EXACT; found $PROTOC_VERSION."
echo "If your version is higher than the version this script is looking for, updating the Makefile with the newer version."
exit 1
fi