mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
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:
parent
87eedc2a36
commit
eb97b3632a
1 changed files with 8 additions and 3 deletions
|
@ -26,15 +26,20 @@ ynh_config_add_systemd() {
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config, and if configured into YunoHost, removes the service.
|
||||||
#
|
#
|
||||||
# usage: ynh_config_remove_systemd service
|
# usage: ynh_config_remove_systemd service
|
||||||
# | arg: service - Service name (optionnal, $app by default)
|
# | arg: service - Service name (optionnal, $app by default)
|
||||||
ynh_config_remove_systemd() {
|
ynh_config_remove_systemd() {
|
||||||
local service="${1:-$app}"
|
local service="${1:-$app}"
|
||||||
|
|
||||||
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
||||||
|
yunohost service remove "$app"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e "/etc/systemd/system/$service.service" ]; then
|
if [ -e "/etc/systemd/system/$service.service" ]; then
|
||||||
ynh_systemctl --service=$service --action=stop
|
ynh_systemctl --service="$service" --action=stop
|
||||||
systemctl disable $service --quiet
|
systemctl disable "$service" --quiet
|
||||||
ynh_safe_rm "/etc/systemd/system/$service.service"
|
ynh_safe_rm "/etc/systemd/system/$service.service"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue