1
0
Fork 0

nagios/forgejo: version format has changed

This commit is contained in:
Chl 2024-07-31 13:14:46 +02:00
parent 7594ba6bd7
commit f5f7727c5b

View file

@ -170,8 +170,11 @@ case "$RELEASE_MEDIUM" in
'rss') UPSTREAM_VERSION="$( get_latest_version_number_from_rss "$URL_RSS_RELEASES" )" ;; 'rss') UPSTREAM_VERSION="$( get_latest_version_number_from_rss "$URL_RSS_RELEASES" )" ;;
'dns') UPSTREAM_VERSION="$( get_latest_version_number_from_dns "$DNS_RECORD_RELEASES" )" ;; 'dns') UPSTREAM_VERSION="$( get_latest_version_number_from_dns "$DNS_RECORD_RELEASES" )" ;;
esac esac
# note : the API seems to switch 1.21.1-0 to 1.21.1+0. We dumbly switch back ? LOCAL_VERSION="$( fetch_with_curl_wget_or_whatever "$URL_LOCAL_VERSION" | sed -n 's/{"version":"\([^"]\+\)"}/\1/p' )"
LOCAL_VERSION="$( fetch_with_curl_wget_or_whatever "$URL_LOCAL_VERSION" | sed -n 's/{"version":"\([^"]\+\)"}/\1/p' | sed 's/+/-/' )" # note Forgejo 7 : the API returns something like '8.0.0+gitea-1.22.0' which differs from DNS and RSS sources :-/
LOCAL_VERSION="$( echo "$LOCAL_VERSION" | sed 's/+gitea.*//' )"
# note pre-7 versions : the API seems to switch 1.21.1-0 to 1.21.1+0. We dumbly switch back ?
LOCAL_VERSION="$( echo "$LOCAL_VERSION" | sed 's/+/-/' )"
# ...and check if they match. # ...and check if they match.
if [ "$UPSTREAM_VERSION" = "$LOCAL_VERSION" ]; then if [ "$UPSTREAM_VERSION" = "$LOCAL_VERSION" ]; then