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