2020-07-31 20:43:06 +05:30
get_protobuf_tag( ) {
if [ " $protobuf_tag " = "latest" ] ; then
2022-05-26 10:21:36 +05:30
protobuf_tag = $( get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<& 1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
2020-07-31 20:43:06 +05:30
else
2020-11-11 02:23:45 +05:30
status_code = $( get -v -n /tmp/protobuf.tmp " https://github.com/protocolbuffers/protobuf/releases/tag/v $protobuf_tag " )
2020-07-31 20:43:06 +05:30
if [ " $status_code " = "200" ] ; then
protobuf_tag = " v $protobuf_tag "
else
2022-05-26 10:21:36 +05:30
protobuf_tag = $( get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<& 1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
2020-07-31 20:43:06 +05:30
fi
fi
}
add_protoc( ) {
protobuf_tag = $1
get_protobuf_tag
(
platform = 'linux'
[ " $( uname -s) " = "Darwin" ] && platform = 'osx'
2020-11-11 02:23:45 +05:30
get -q -n /tmp/protobuf.zip " https://github.com/protocolbuffers/protobuf/releases/download/ $protobuf_tag /protoc- ${ protobuf_tag : 1 } - $platform -x86_64.zip "
2020-07-31 20:43:06 +05:30
sudo unzip /tmp/protobuf.zip -d /usr/local/
2021-05-31 07:19:10 +05:30
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
2020-07-31 20:43:06 +05:30
) >/dev/null 2>& 1
2020-09-28 10:58:02 +05:30
add_log " ${ tick : ? } " "protoc" " Added protoc ${ protobuf_tag : 1 } "
2022-01-30 10:00:11 +05:30
printf " $GROUP \033[34;1m%s \033[0m\033[90;1m%s \033[0m\n " "protoc" "Click to read the protoc related license information"
2020-07-31 20:43:06 +05:30
curl " ${ curl_opts [@] : ? } " https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
2022-01-30 10:00:11 +05:30
echo " $END_GROUP "
2020-07-31 20:43:06 +05:30
}