From f5f7727c5b2ea0757e3fb594a27704cc6b4cc461 Mon Sep 17 00:00:00 2001 From: Chl Date: Wed, 31 Jul 2024 13:14:46 +0200 Subject: [PATCH] nagios/forgejo: version format has changed --- nagios/check_forgejo_version.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nagios/check_forgejo_version.sh b/nagios/check_forgejo_version.sh index d9d1515..dbcfd4f 100755 --- a/nagios/check_forgejo_version.sh +++ b/nagios/check_forgejo_version.sh @@ -170,8 +170,11 @@ case "$RELEASE_MEDIUM" in 'rss') UPSTREAM_VERSION="$( get_latest_version_number_from_rss "$URL_RSS_RELEASES" )" ;; 'dns') UPSTREAM_VERSION="$( get_latest_version_number_from_dns "$DNS_RECORD_RELEASES" )" ;; 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' | sed 's/+/-/' )" +LOCAL_VERSION="$( fetch_with_curl_wget_or_whatever "$URL_LOCAL_VERSION" | sed -n 's/{"version":"\([^"]\+\)"}/\1/p' )" +# 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. if [ "$UPSTREAM_VERSION" = "$LOCAL_VERSION" ]; then