Fix regex in protoc.sh

This commit is contained in:
Shivam Mathur 2020-09-10 10:26:25 +05:30
parent 7cfd76cc1b
commit db36b200b1
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -1,12 +1,12 @@
get_protobuf_tag() { get_protobuf_tag() {
if [ "$protobuf_tag" = "latest" ]; then if [ "$protobuf_tag" = "latest" ]; then
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+.[0-9]+.[0-9]+)" | head -n 1) protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
else else
status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/protobuf.tmp "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag") status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/protobuf.tmp "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
if [ "$status_code" = "200" ]; then if [ "$status_code" = "200" ]; then
protobuf_tag="v$protobuf_tag" protobuf_tag="v$protobuf_tag"
else else
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+.[0-9]+.[0-9]+)" | head -n 1) protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
fi fi
fi fi
} }