mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
SC1117: Backslash is literal in "\(". Prefer explicit escaping: "\\(".
SC1117: Backslash is literal in "\)". Prefer explicit escaping: "\\)".
SC2003: expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
Signed-off-by: Michael Adam <obnox@redhat.com>
40 lines
1.2 KiB
Bash
Executable File
40 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Protobuf 3 version of `protoc` is required for GD2,
|
|
# for generating Go code from the proto definitions.
|
|
|
|
if [ "x$PROTOC" == "x" ]; then
|
|
PROTOC=protoc
|
|
fi
|
|
|
|
REQ_PROTOC_MAJOR_VERSION="3"
|
|
REQ_PROTOC_MINOR_VERSION="0"
|
|
|
|
REQ_PROTOC_VERSION="$REQ_PROTOC_MAJOR_VERSION.$REQ_PROTOC_MINOR_VERSION"
|
|
|
|
missing() {
|
|
echo "Protobuf compiler (protoc) $REQ_PROTOC_VERSION or later is missing on this system."
|
|
echo "Install protoc ${REQ_PROTOC_VERSION} using the preferred method for your system."
|
|
echo "Refer to https://developers.google.com/protocol-buffers/ if Protobuf $REQ_PROTOC_VERSION is not available in the system repositories."
|
|
|
|
exit 1
|
|
}
|
|
|
|
check_protoc_version() {
|
|
|
|
INST_PROTOC_VERSION=$(protoc --version | sed -e 's/.*libprotoc *//')
|
|
INST_PROTOC_MAJOR_VERSION=$(echo "$INST_PROTOC_VERSION" | cut -d. -f1)
|
|
INST_PROTOC_MINOR_VERSION=$(echo "$INST_PROTOC_VERSION" | cut -d. -f2)
|
|
|
|
if [ "$REQ_PROTOC_MAJOR_VERSION" -gt "$INST_PROTOC_MAJOR_VERSION" ]; then
|
|
missing
|
|
elif [ "$REQ_PROTOC_MAJOR_VERSION" -eq "$INST_PROTOC_MAJOR_VERSION" ] &&
|
|
[ "$REQ_PROTOC_MINOR_VERSION" -gt "$INST_PROTOC_MINOR_VERSION" ]; then
|
|
missing
|
|
fi
|
|
}
|
|
|
|
check_protoc_version
|
|
|
|
echo "protoc $REQ_PROTOC_VERSION or later is available on the system."
|