diff --git a/scripts/upgrade b/scripts/upgrade index 1461ec1..d75fd2d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,6 +52,13 @@ ynh_systemd_action --service_name="$app" --action=stop --line_match="Stopped Hom # migrate to new app architecture ynh_script_progression --message="If needed, migrating to new app architecture..." +if [ -f "/etc/systemd/system/$app@$app.service" ]; then + # remove old systemd service + if ynh_exec_warn_less yunohost service status "$app@$app" >/dev/null ; then + yunohost service remove "$app@$app" + fi + ynh_remove_systemd_config --service="$app@$app" +fi if [ ! -d "$final_path" ]; then # move $final_path to new directory mv "/opt/yunohost/$app" "$final_path" @@ -70,13 +77,6 @@ if [ ! -f "$log_file" ]; then myynh_create_dir "$(dirname "$log_file")" touch "$log_file" fi -if [ -f "/etc/systemd/system/$app@$app.service" ]; then - # remove old systemd service - if ynh_exec_warn_less yunohost service status "$app@$app" >/dev/null ; then - yunohost service remove "$app@$app" - fi - ynh_remove_systemd_config --service="$app@$app" -fi # installation in a virtual environment ynh_script_progression --message="Installing Home Assistant in a virtual environment..."