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.
This commit is contained in:
Salamandar 2024-02-21 16:19:00 +01:00
parent c827877387
commit 51d26ae027

View file

@ -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