icinga-plugins/checks/check_gitea_update

31 lines
984 B
Bash
Executable File

#!/bin/bash
if [ "$#" = 0 ]
then
app_root="/home/git/gitea/gitea"
else
app_root=$1
fi
if [ -e "$app_root" ]
then
gitea_local_version=$($app_root --version | awk '{print $3}')
else
echo "$app_root does not exist. exit"
exit 1
fi
gitea_remote_version=$(curl --silent https://github.com/go-gitea/gitea/releases | grep "/releases/tag" | grep -v "\-rc" | grep -v "\-dev" | cut -d ">" -f 2 | cut -d "<" -f 1 | head -n 1| sed -e 's/^v//' | awk '{print $1}' | sed -e 's/://' )
#gitea_remote_version=$(curl --silent https://github.com/go-gitea/gitea/releases | grep "css-truncate-target" | grep -v "\-rc" | cut -d "v" -f 2 | cut -d "<" -f 1 | head -n 1)
if [ "$gitea_local_version" = "$gitea_remote_version" ]
then
echo "gitea ist up-to-date - installed version: $gitea_local_version; newest version: $gitea_remote_version"
exit 0
else
#Warnung wird ausgegeben
echo "different version - installed version: $gitea_local_version; newest version: $gitea_remote_version"
exit 1
fi