From 51d26ae02708ae51e813846e39779f368dcb4476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 21 Feb 2024 16:19:00 +0100 Subject: [PATCH] helpers: ynh_remove_systemd_config: Also remove the systemd service from YunoHost. Every app or almost will do that, because it doesn't make sense to remove the systemd config but not the associated yunohost configuration. This will clean up a bit the remove scripts. --- helpers/systemd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/systemd b/helpers/systemd index 765c575ef..4a3a46a7e 100644 --- a/helpers/systemd +++ b/helpers/systemd @@ -29,7 +29,7 @@ ynh_add_systemd_config() { systemctl daemon-reload } -# Remove the dedicated systemd config +# Remove the dedicated systemd config, and if configured into YunoHost, removes the service. # # usage: ynh_remove_systemd_config [--service=service] # | arg: -s, --service= - Service name (optionnal, $app by default) @@ -44,6 +44,10 @@ ynh_remove_systemd_config() { ynh_handle_getopts_args "$@" local service="${service:-$app}" + if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" + fi + local finalsystemdconf="/etc/systemd/system/$service.service" if [ -e "$finalsystemdconf" ]; then ynh_systemd_action --service_name=$service --action=stop