From cb5c6495d6141bddc54b2b9ecb90b2e07e48945f Mon Sep 17 00:00:00 2001 From: Simon L Date: Mon, 11 Dec 2023 10:43:47 +0100 Subject: [PATCH 1/4] use correct way to do the update to new major versions Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index c1b025190a2..c1559c1f853 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -258,7 +258,14 @@ DATADIR_PERMISSION_CONF if [ "$INSTALL_LATEST_MAJOR" = yes ]; then php /var/www/html/occ config:system:set updater.release.channel --value=beta php /var/www/html/occ config:system:set updatedirectory --value="/nc-updater" - php /var/www/html/updater/updater.phar --no-interaction + INSTALL_DAT="$(php /var/www/html/occ config:app:get core installedat)" + if [ -n "$INSTALL_DAT" ]; then + # Set the installdat to 00 which will allow to skip staging and install the next major directly + # shellcheck disable=SC2001 + INSTALL_DAT="$(echo "$INSTALL_DAT" | sed "s|[0-9][0-9]$|00|")" + php /var/www/html/occ config:app:set core installedat --value="$INSTALL_DAT" + fi + php /var/www/html/updater/updater.phar --no-interaction --no-backup if ! php /var/www/html/occ -V || php /var/www/html/occ status | grep maintenance | grep -q 'true'; then echo "Installation of Nextcloud failed!" touch "$NEXTCLOUD_DATA_DIR/install.failed" @@ -266,18 +273,6 @@ DATADIR_PERMISSION_CONF fi # shellcheck disable=SC2016 installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" - INSTALLED_MAJOR="${installed_version%%.*}" - IMAGE_MAJOR="${image_version%%.*}" - if ! [ "$INSTALLED_MAJOR" -gt "$IMAGE_MAJOR" ]; then - php /var/www/html/updater/updater.phar --no-interaction - if ! php /var/www/html/occ -V || php /var/www/html/occ status | grep maintenance | grep -q 'true'; then - echo "Installation of Nextcloud failed!" - touch "$NEXTCLOUD_DATA_DIR/install.failed" - exit 1 - fi - # shellcheck disable=SC2016 - installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" - fi php /var/www/html/occ app:disable updatenotification rm -rf /var/www/html/apps/updatenotification php /var/www/html/occ config:system:set updater.release.channel --value=stable From 6412aa3e0f4262e5fa6b163be7efb3bbd2ed5e2e Mon Sep 17 00:00:00 2001 From: Simon L Date: Mon, 11 Dec 2023 13:08:19 +0100 Subject: [PATCH 2/4] address review Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index c1559c1f853..d174ebd921d 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -256,7 +256,6 @@ DATADIR_PERMISSION_CONF unset ADMIN_PASSWORD if [ "$INSTALL_LATEST_MAJOR" = yes ]; then - php /var/www/html/occ config:system:set updater.release.channel --value=beta php /var/www/html/occ config:system:set updatedirectory --value="/nc-updater" INSTALL_DAT="$(php /var/www/html/occ config:app:get core installedat)" if [ -n "$INSTALL_DAT" ]; then @@ -275,7 +274,6 @@ DATADIR_PERMISSION_CONF installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" php /var/www/html/occ app:disable updatenotification rm -rf /var/www/html/apps/updatenotification - php /var/www/html/occ config:system:set updater.release.channel --value=stable php /var/www/html/occ app:enable nextcloud-aio --force php /var/www/html/occ db:add-missing-indices php /var/www/html/occ db:add-missing-columns From fb796debd6140444bac64ec7e674a5aafc30755d Mon Sep 17 00:00:00 2001 From: Simon L Date: Tue, 12 Dec 2023 14:16:03 +0100 Subject: [PATCH 3/4] address review Signed-off-by: Simon L Co-authored-by: Arthur Schiwon Signed-off-by: Simon L. --- Containers/nextcloud/entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index d174ebd921d..20b31854111 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -257,12 +257,12 @@ DATADIR_PERMISSION_CONF if [ "$INSTALL_LATEST_MAJOR" = yes ]; then php /var/www/html/occ config:system:set updatedirectory --value="/nc-updater" - INSTALL_DAT="$(php /var/www/html/occ config:app:get core installedat)" - if [ -n "$INSTALL_DAT" ]; then + INSTALLED_AT="$(php /var/www/html/occ config:app:get core installedat)" + if [ -n "${INSTALLED_AT}" ]; then # Set the installdat to 00 which will allow to skip staging and install the next major directly # shellcheck disable=SC2001 - INSTALL_DAT="$(echo "$INSTALL_DAT" | sed "s|[0-9][0-9]$|00|")" - php /var/www/html/occ config:app:set core installedat --value="$INSTALL_DAT" + INSTALLED_AT="$(echo "${INSTALLED_AT}" | sed "s|[0-9][0-9]$|00|")" + php /var/www/html/occ config:app:set core installedat --value="${INSTALLED_AT}" fi php /var/www/html/updater/updater.phar --no-interaction --no-backup if ! php /var/www/html/occ -V || php /var/www/html/occ status | grep maintenance | grep -q 'true'; then From fe669a0be7618468809ac391c2820d8fa60e0840 Mon Sep 17 00:00:00 2001 From: Simon L Date: Tue, 12 Dec 2023 16:37:29 +0100 Subject: [PATCH 4/4] restore major version check Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 20b31854111..213fdaed90d 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -272,6 +272,18 @@ DATADIR_PERMISSION_CONF fi # shellcheck disable=SC2016 installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" + INSTALLED_MAJOR="${installed_version%%.*}" + IMAGE_MAJOR="${image_version%%.*}" + if ! [ "$INSTALLED_MAJOR" -gt "$IMAGE_MAJOR" ]; then + php /var/www/html/updater/updater.phar --no-interaction --no-backup + if ! php /var/www/html/occ -V || php /var/www/html/occ status | grep maintenance | grep -q 'true'; then + echo "Installation of Nextcloud failed!" + touch "$NEXTCLOUD_DATA_DIR/install.failed" + exit 1 + fi + # shellcheck disable=SC2016 + installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" + fi php /var/www/html/occ app:disable updatenotification rm -rf /var/www/html/apps/updatenotification php /var/www/html/occ app:enable nextcloud-aio --force