|
@@ -62,6 +62,7 @@ VERSION_FIELDS=2
|
|
|
# All configureable parameters are above this section.
|
|
# All configureable parameters are above this section.
|
|
|
######################
|
|
######################
|
|
|
|
|
|
|
|
|
|
+# Check availabillity of required commands or packages
|
|
|
for COMMAND in sudo php jq curl; do
|
|
for COMMAND in sudo php jq curl; do
|
|
|
if ! command -v "$COMMAND" >/dev/null 2>&1; then
|
|
if ! command -v "$COMMAND" >/dev/null 2>&1; then
|
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck requires $COMMAND command to be installed"
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck requires $COMMAND command to be installed"
|
|
@@ -70,14 +71,14 @@ for COMMAND in sudo php jq curl; do
|
|
|
fi
|
|
fi
|
|
|
done
|
|
done
|
|
|
|
|
|
|
|
-# check if configured apache user exists
|
|
|
|
|
|
|
+# Check if configured apache user exists
|
|
|
if ! id -u "$APACHEUSER" >/dev/null 2>&1; then
|
|
if ! id -u "$APACHEUSER" >/dev/null 2>&1; then
|
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck webserver user does not exist, check configuration!"
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck webserver user does not exist, check configuration!"
|
|
|
echo "2 \"$SERVICE Apps\" - $SERVICE Apps localcheck webserver user does not exist, check configuration!"
|
|
echo "2 \"$SERVICE Apps\" - $SERVICE Apps localcheck webserver user does not exist, check configuration!"
|
|
|
exit 0
|
|
exit 0
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-# check if configured basepath exists
|
|
|
|
|
|
|
+# Check if configured basepath exists
|
|
|
if [ ! -d "$BASEPATH" ]; then
|
|
if [ ! -d "$BASEPATH" ]; then
|
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck could not find configured basepath, check configuration!"
|
|
echo "2 \"$SERVICE\" - $SERVICE localcheck could not find configured basepath, check configuration!"
|
|
|
echo "2 \"$SERVICE Apps\" - $SERVICE Apps localcheck could not find configured basepath, check configuration!"
|
|
echo "2 \"$SERVICE Apps\" - $SERVICE Apps localcheck could not find configured basepath, check configuration!"
|
|
@@ -89,7 +90,13 @@ fi
|
|
|
|
|
|
|
|
NCINSTALLED=$(sudo -u "$APACHEUSER" php "$BASEPATH"/occ status --output=json | jq -r '.versionstring // empty' | cut -d. -f1-"$VERSION_FIELDS")
|
|
NCINSTALLED=$(sudo -u "$APACHEUSER" php "$BASEPATH"/occ status --output=json | jq -r '.versionstring // empty' | cut -d. -f1-"$VERSION_FIELDS")
|
|
|
|
|
|
|
|
-# Get latest avaialble (core) version information from release-url
|
|
|
|
|
|
|
+# Check output of installed version
|
|
|
|
|
+if [ -z "$NCINSTALLED" ]; then
|
|
|
|
|
+ echo "3 \"$SERVICE\" - Unable to determine installed $SERVICE Core version"
|
|
|
|
|
+ echo "3 \"$SERVICE Apps\" - Unable to determine installed $SERVICE Core version"
|
|
|
|
|
+ exit 0
|
|
|
|
|
+fi
|
|
|
|
|
+# Get latest available (core) version information from release-url
|
|
|
# In v29.x.x this has changed outputs <name-of-instance> <version>,
|
|
# In v29.x.x this has changed outputs <name-of-instance> <version>,
|
|
|
NCRELEASEDATA=$(curl -fsS --connect-timeout 5 --max-time 10 "$RELEASEURL" 2>/dev/null)
|
|
NCRELEASEDATA=$(curl -fsS --connect-timeout 5 --max-time 10 "$RELEASEURL" 2>/dev/null)
|
|
|
CURL_RC=$?
|
|
CURL_RC=$?
|
|
@@ -112,6 +119,13 @@ fi
|
|
|
# sort them as versions and select the highest version.
|
|
# sort them as versions and select the highest version.
|
|
|
NCAVAILABLE=$(printf '%s\n' "$NCRELEASEDATA" | grep -oE 'nextcloud-[0-9]+\.[0-9]+\.[0-9]+\.zip' | sed -E 's/^nextcloud-([0-9]+\.[0-9]+\.[0-9]+)\.zip$/\1/' | sort -V | tail -n1)
|
|
NCAVAILABLE=$(printf '%s\n' "$NCRELEASEDATA" | grep -oE 'nextcloud-[0-9]+\.[0-9]+\.[0-9]+\.zip' | sed -E 's/^nextcloud-([0-9]+\.[0-9]+\.[0-9]+)\.zip$/\1/' | sort -V | tail -n1)
|
|
|
|
|
|
|
|
|
|
+# Check output of release-version parsing
|
|
|
|
|
+if [ -z "$NCAVAILABLE" ]; then
|
|
|
|
|
+ echo "3 \"$SERVICE\" - No valid release-version found in release-URL data for $SERVICE Core"
|
|
|
|
|
+ echo "3 \"$SERVICE Apps\" - No valid release-version found in release-URL data for $SERVICE Apps"
|
|
|
|
|
+ exit 0
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
# Apply configured version-comparison granularity to the available version
|
|
# Apply configured version-comparison granularity to the available version
|
|
|
NCAVAILABLE=$(printf '%s\n' "$NCAVAILABLE" | cut -d. -f1-"$VERSION_FIELDS")
|
|
NCAVAILABLE=$(printf '%s\n' "$NCAVAILABLE" | cut -d. -f1-"$VERSION_FIELDS")
|
|
|
|
|
|