diff --git a/scripts/upgrade b/scripts/upgrade index 227b8b9a..b70a5731 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,23 +92,43 @@ fi if dpkg --compare-versions "0.9.0~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then ynh_print_info --message="Ensuring upgrade compatibility to 0.9.0~ynh3..." + + ynh_print_info --message="Configuring a systemd service..." ynh_add_systemd_config --service="${app}-horizon" --template=horizon.conf fi if dpkg --compare-versions "0.10.9~ynh2" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then ynh_print_info --message="Ensuring upgrade compatibility to 0.10.9~ynh2..." + + ynh_print_info --message="Stopping and removing the systemd service..." ynh_remove_systemd_config --service="${app}-horizon" + + ynh_print_info --message="Installing dependencies..." ynh_install_app_dependencies "$pkg_dependencies" + + ynh_print_info --message="Creating log file..." mkdir -p "/var/log/$app/" touch "/var/log/$app/${app}-horizon.log" chown -R root: "/var/log/$app/" + + + ynh_print_info --message="Configuring a supervisor service..." ynh_add_supervisor_config --service="${app}-horizon" --template=horizon.conf + + ynh_print_info --message="Starting a supervisor service..." ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log" fi if dpkg --compare-versions "0.10.9~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then ynh_print_info --message="Ensuring upgrade compatibility to 0.10.9~ynh3..." - yunohost service remove "${app}-horizon" + + if ynh_exec_warn_less yunohost service status ${app}-horizon >/dev/null + then + ynh_print_info --message="Removing ${app}-horizon service..." + yunohost service remove "${app}-horizon" + fi + + ynh_print_info --message="Integrating service in YunoHost..." yunohost service add "supervisor" --description "Supervisor daemon for $app" --log "/var/log/$app/${app}-horizon.log" fi