From dc8af9a44adca26ace0cb941c9ba272910862815 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 20 Aug 2026 13:52:15 -0400 Subject: [PATCH 1/2] Fix updater aborting when storage is deleted while panel is live The panel keeps writing logs and sessions into storage/ while the updater runs, so the delete step could fail with "Directory not empty" and abort mid-update, leaving a half-deleted install (pelican/panel#2536). Exclude storage/ from the delete (the tarball merges over it and optimize:clear handles stale caches), enable maintenance mode before deleting, and bring the panel back up at the end. --- static/updatePanel.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/updatePanel.sh b/static/updatePanel.sh index fe16581..011539c 100644 --- a/static/updatePanel.sh +++ b/static/updatePanel.sh @@ -120,7 +120,12 @@ if [ "$delete_confirm" != "y" ]; then exit 1 fi -find "$install_dir" -mindepth 1 -maxdepth 1 ! -name 'backup' ! -name 'plugins' ! -name 'panel.tar.gz' -exec rm -rf {} + +echo "Enabling maintenance mode" +(cd "$install_dir" && php artisan down) || echo "Failed to enable maintenance mode, continuing." + +# storage is excluded: the panel keeps writing logs/sessions into it while this runs, +# which makes rm -rf fail with "Directory not empty" and abort mid-update +find "$install_dir" -mindepth 1 -maxdepth 1 ! -name 'backup' ! -name 'plugins' ! -name 'storage' ! -name 'panel.tar.gz' -exec rm -rf {} + if [ $? -ne 0 ]; then echo "Failed to delete old files, aborting" exit 1 @@ -197,6 +202,7 @@ if [ $? -ne 0 ]; then fi php artisan queue:restart +php artisan up echo "Panel Updated!" echo "If you previously had any themes installed you need to build the panel assets again by manually running \"yarn install\" and \"yarn build\" inside \"$install_dir\"." From 33238077ed0c1a5760b111c86bb542e35b6977c1 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 20 Aug 2026 15:09:49 -0400 Subject: [PATCH 2/2] Delete storage during update, keeping only the maintenance flag Per maintainer feedback, keeping the whole storage folder also kept old logs. Instead delete storage like before but preserve storage/framework/down (and maintenance.php), which is what keeps the live panel from writing into storage mid-delete. Since the delete now depends on maintenance mode being active, abort if php artisan down fails instead of continuing. --- static/updatePanel.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/static/updatePanel.sh b/static/updatePanel.sh index 011539c..198ff4f 100644 --- a/static/updatePanel.sh +++ b/static/updatePanel.sh @@ -121,11 +121,18 @@ if [ "$delete_confirm" != "y" ]; then fi echo "Enabling maintenance mode" -(cd "$install_dir" && php artisan down) || echo "Failed to enable maintenance mode, continuing." +(cd "$install_dir" && php artisan down) +if [ $? -ne 0 ]; then + echo "Failed to enable maintenance mode, aborting" + exit 1 +fi -# storage is excluded: the panel keeps writing logs/sessions into it while this runs, -# which makes rm -rf fail with "Directory not empty" and abort mid-update -find "$install_dir" -mindepth 1 -maxdepth 1 ! -name 'backup' ! -name 'plugins' ! -name 'storage' ! -name 'panel.tar.gz' -exec rm -rf {} + +# The maintenance flag (storage/framework/down) must survive the delete: it stops the +# live panel from writing logs/sessions into storage mid-delete, which made rm fail +# with "Directory not empty" and abort the update. Everything else in storage goes too. +find "$install_dir" -mindepth 1 -maxdepth 1 ! -name 'backup' ! -name 'plugins' ! -name 'storage' ! -name 'panel.tar.gz' -exec rm -rf {} + && +find "$install_dir/storage" -mindepth 1 -maxdepth 1 ! -name 'framework' -exec rm -rf {} + && +find "$install_dir/storage/framework" -mindepth 1 -maxdepth 1 ! -name 'down' ! -name 'maintenance.php' -exec rm -rf {} + if [ $? -ne 0 ]; then echo "Failed to delete old files, aborting" exit 1