|
|
@@ -1,7 +1,7 @@
|
|
|
#!/bin/bash
|
|
|
|
|
|
# Version 0.1 - initial start of this localcheck
|
|
|
-# Version 0.2 - introduced additional logic to also deal with a local installed version being higher then available from the release-url.
|
|
|
+# Version 0.2 - introduced additional logic to also deal with a local installed version being higher than available from the release-url.
|
|
|
|
|
|
# Current active version of the script
|
|
|
SCRIPT_VERSION=0.2
|
|
|
@@ -40,8 +40,7 @@ SERVICE="Gogs"
|
|
|
######################
|
|
|
|
|
|
# Check if jq package is present on the system (required for this check)
|
|
|
-command -v jq >/dev/null 2>&1
|
|
|
-if [ $? -ne 0 ]; then
|
|
|
+if ! command -v jq >/dev/null 2>&1; then
|
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck requires jq package to be installed"
|
|
|
exit 0
|
|
|
fi
|
|
|
@@ -75,6 +74,12 @@ if [[ -z "$GOGS_AVAILABLE" || "$GOGS_AVAILABLE" == "null" ]]; then
|
|
|
exit 0
|
|
|
fi
|
|
|
|
|
|
+# Validate the version returned by GitHub.
|
|
|
+if ! [[ "$GOGS_AVAILABLE" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
+ echo "3 \"$SERVICE\" - Invalid Gogs version received from release-URL: $GOGS_AVAILABLE"
|
|
|
+ exit 0
|
|
|
+fi
|
|
|
+
|
|
|
# Compare installed version to available version
|
|
|
if [[ "$GOGS_INSTALLED" == "$GOGS_AVAILABLE" ]]; then
|
|
|
echo "0 \"$SERVICE\" - Gogs version $GOGS_INSTALLED is up to date."
|