Просмотр исходного кода

Updated variables to all be in quotes.

Michael Honkoop 1 неделя назад
Родитель
Сommit
7535d6e6f1
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      localchecks/nextcloud-updates.sh

+ 7 - 7
localchecks/nextcloud-updates.sh

@@ -75,21 +75,21 @@ fi
 # Get current installed Nextcloud version-information
 # in v29.x.x version gives more detail, which is not given by the check on installed version, so switched to versionstring instead.
 
-NCINSTALLED=$(sudo -u $APACHEUSER php $BASEPATH/occ status --output=json | jq -r '.versionstring' | cut -d. -f1-"$VERSION_FIELDS")
+NCINSTALLED=$(sudo -u "$APACHEUSER" php "$BASEPATH"/occ status --output=json | jq -r '.versionstring' | cut -d. -f1-"$VERSION_FIELDS")
 
 # Get latest avaiable version information
 # In v29.x.x this has changed outputs <name-of-instance> <version>,
 
-NCAVAILABLE=$(curl -s --connect-timeout 5 --fail-with-body $RELEASEURL | sed -e 's/<[^>]*>//g' | grep -o "^nextcloud.*.zip" | tail -n1 | cut -d'-' -f 2 | sed 's/.\{4\}$//' | cut -d. -f1-"$VERSION_FIELDS")
+NCAVAILABLE=$(curl -s --connect-timeout 5 --fail-with-body "$RELEASEURL" | sed -e 's/<[^>]*>//g' | grep -o "^nextcloud.*.zip" | tail -n1 | cut -d'-' -f 2 | sed 's/.\{4\}$//' | cut -d. -f1-"$VERSION_FIELDS")
 
 # if the check on the release-url is not returning a version - report status
-if [ -z $NCAVAILABLE ]; then
+if [ -z "$NCAVAILABLE" ]; then
     echo "1 \"NextCloud\" - No data received from release-URL, can not determine latest release-version"
 # compare resuts of installed and available version and report update available if they differ
-elif [ $NCINSTALLED != $NCAVAILABLE ]; then
+elif [ "$NCINSTALLED" != "$NCAVAILABLE" ]; then
    echo "1 \"NextCloud\" - A new NextCloud version ($NCAVAILABLE)is available, running version $NCINSTALLED please upgrade"
 else
-    sudo -u $APACHEUSER php $BASEPATH/occ status -e
+    sudo -u "$APACHEUSER" php "$BASEPATH"/occ status -e
     if [ $? -eq 0 ]; then
         echo "0 \"NextCloud\" - NextCloud all up to date"
     elif [ $? -eq 1 ]; then
@@ -99,8 +99,8 @@ else
     fi
 fi
 
-APPRESULT=$(sudo -u $APACHEUSER php $BASEPATH/occ app:update --showonly)
-if [[ $APPRESULT == *"All apps are up-to-date"* ]]; then
+APPRESULT=$(sudo -u "$APACHEUSER" php "$BASEPATH"/occ app:update --showonly)
+if [[ "$APPRESULT" == *"All apps are up-to-date"* ]]; then
     echo "0 \"NextCloud Apps\" - NextCloud Apps all up to date"
 else
     UPDATECOUNT=$(echo "$APPRESULT" | wc -l)