From 9ccd6949ce7c96386400762b1dbe9c4cbc34367e Mon Sep 17 00:00:00 2001 From: Simon L Date: Sat, 10 Jun 2023 09:59:14 +0200 Subject: [PATCH 1/3] add run_upgrade_if_needed_due_to_app_update Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index cb6e3a9b..e3bb6d15 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -10,6 +10,13 @@ directory_empty() { [ -z "$(ls -A "$1/")" ] } +run_upgrade_if_needed_due_to_app_update() { + if php /var/www/html/occ status | grep needsDbUpgrade | grep -q true; then + php /var/www/html/occ upgrade + php /var/www/html/occ app:enable nextcloud-aio --force + fi +} + echo "Configuring Redis as session handler..." cat << REDIS_CONF > /usr/local/etc/php/conf.d/redis-session.ini session.save_handler = redis @@ -147,6 +154,8 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then fi done + run_upgrade_if_needed_due_to_app_update + php /var/www/html/occ maintenance:mode --off echo "Getting and backing up the status of apps for later, this might take a while..." @@ -170,6 +179,8 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then php /var/www/html/occ app:update --all + run_upgrade_if_needed_due_to_app_update + # Fix removing the updatenotification for old instances UPDATENOTIFICATION_STATUS="$(php /var/www/html/occ config:app:get updatenotification enabled)" if [ -d "/var/www/html/apps/updatenotification" ]; then @@ -354,6 +365,8 @@ DATADIR_PERMISSION_CONF php /var/www/html/occ app:update --all + run_upgrade_if_needed_due_to_app_update + # Restore app status if [ "${APPSTORAGE[0]}" != "no-export-done" ]; then echo "Restoring the status of apps. This can take a while..." @@ -367,6 +380,7 @@ DATADIR_PERMISSION_CONF rm -r "/var/www/html/custom_apps/$app" php /var/www/html/occ maintenance:mode --off fi + run_upgrade_if_needed_due_to_app_update echo "The $app app could not get enabled. Probably because it is not compatible with the new Nextcloud version." if [ "$app" = apporder ]; then CUSTOM_HINT="The apporder app was deprecated. A possible replacement is the side_menu app, aka 'Custom menu'." @@ -387,6 +401,8 @@ DATADIR_PERMISSION_CONF php /var/www/html/occ app:update --all + run_upgrade_if_needed_due_to_app_update + # Apply optimization echo "Doing some optimizations..." php /var/www/html/occ maintenance:repair @@ -404,6 +420,7 @@ DATADIR_PERMISSION_CONF UPDATED_APPS="$(php /var/www/html/occ app:update --all)" # Update all apps again and try to prevent something like https://github.com/nextcloud/polls/issues/2793 from happening php /var/www/html/occ app:update --all + run_upgrade_if_needed_due_to_app_update if [ -n "$UPDATED_APPS" ]; then bash /notify.sh "Your apps just got updated!" "$UPDATED_APPS" fi @@ -412,6 +429,8 @@ else SKIP_UPDATE=1 fi +run_upgrade_if_needed_due_to_app_update + if [ -z "$OBJECTSTORE_S3_BUCKET" ] && [ -z "$OBJECTSTORE_SWIFT_URL" ]; then # Check if appdata is present # If not, something broke (e.g. changing ncdatadir after aio was first started) @@ -446,6 +465,7 @@ php /var/www/html/occ app:enable support # Adjusting log files to be stored on a volume echo "Adjusting log files..." +php /var/www/html/occ config:system:set upgrade.cli-upgrade-link --value="https://github.com/nextcloud/all-in-one/discussions/2726" php /var/www/html/occ config:system:set logfile --value="/var/www/html/data/nextcloud.log" php /var/www/html/occ config:app:set admin_audit logfile --value="/var/www/html/data/audit.log" php /var/www/html/occ config:system:set updatedirectory --value="/nc-updater" From 82a53ab1395c89401dcf2baf833089551493c84e Mon Sep 17 00:00:00 2001 From: Simon L Date: Sat, 10 Jun 2023 14:49:50 +0200 Subject: [PATCH 2/3] disable integrity check temporarily Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index e3bb6d15..96a41fac 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -12,6 +12,8 @@ directory_empty() { run_upgrade_if_needed_due_to_app_update() { if php /var/www/html/occ status | grep needsDbUpgrade | grep -q true; then + # Disable integrity check temporarily until next update + php /var/www/html/occ config:system:set integrity.check.disabled --type bool --value true php /var/www/html/occ upgrade php /var/www/html/occ app:enable nextcloud-aio --force fi @@ -354,6 +356,7 @@ DATADIR_PERMISSION_CONF else touch "$NEXTCLOUD_DATA_DIR/update.failed" echo "Upgrading nextcloud from $installed_version to $image_version..." + php /var/www/html/occ config:system:delete integrity.check.disabled if ! php /var/www/html/occ upgrade || ! php /var/www/html/occ -V; then echo "Upgrade failed. Please restore from backup." bash /notify.sh "Nextcloud update to $image_version failed!" "Please restore from backup!" From 48b852149af75c6c9488b79f2a2950dae5615921 Mon Sep 17 00:00:00 2001 From: Simon L Date: Sat, 10 Jun 2023 14:49:53 +0200 Subject: [PATCH 3/3] Remove not anymore needed workaround 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 96a41fac..8d9864f9 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -421,8 +421,6 @@ DATADIR_PERMISSION_CONF # Performing update of all apps if daily backups are enabled, running and successful and if it is saturday if [ "$UPDATE_NEXTCLOUD_APPS" = 'yes' ] && [ "$(date +%u)" = 6 ]; then UPDATED_APPS="$(php /var/www/html/occ app:update --all)" - # Update all apps again and try to prevent something like https://github.com/nextcloud/polls/issues/2793 from happening - php /var/www/html/occ app:update --all run_upgrade_if_needed_due_to_app_update if [ -n "$UPDATED_APPS" ]; then bash /notify.sh "Your apps just got updated!" "$UPDATED_APPS"