From d90ac95cdbbb7bbec9d890fd65d2b476d5190703 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 27 Aug 2023 19:00:48 +0200 Subject: [PATCH] Ensure does not need any prompt --- scripts/upgrade | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index bfb99d2..c621add 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,9 +24,15 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi +# Make sure the .config directory belongs to $app:$app +if [[ $(stat -c "%U:%G" $install_dir/.config) != "$app:$app" ]]; then + chown -R $app:$app $install_dir/.config +fi + #================================================= # STOP SYSTEMD SERVICE #================================================= +# We stop the service first because the compatibility fixes might edit the configuration file of the app. ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" --line_match="Ghost has shut down" --timeout=60 @@ -100,8 +106,10 @@ else ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ghost-cli@latest popd - # Upgrade Ghost itself pushd $install_dir/ghost + # Make sure the app does not expect to manage its own process + ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost config --process local + # Upgrade Ghost itself ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost update $(ynh_app_upstream_version) \ --no-prompt --no-auto-rollback --no-restart popd