diff --git a/static/updatePanel.sh b/static/updatePanel.sh index fe16581..198ff4f 100644 --- a/static/updatePanel.sh +++ b/static/updatePanel.sh @@ -120,7 +120,19 @@ 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) +if [ $? -ne 0 ]; then + echo "Failed to enable maintenance mode, aborting" + exit 1 +fi + +# 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 @@ -197,6 +209,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\"."