mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers2.1: ynh_config_remove_systemd now uses positional
This commit is contained in:
parent
6b6580a919
commit
b8a1a3a660
1 changed files with 5 additions and 14 deletions
|
@ -30,23 +30,14 @@ ynh_config_add_systemd() {
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
#
|
#
|
||||||
# usage: ynh_config_remove_systemd [--service=service]
|
# usage: ynh_config_remove_systemd service
|
||||||
# | arg: -s, --service= - Service name (optionnal, $app by default)
|
# | arg: service - Service name (optionnal, $app by default)
|
||||||
#
|
|
||||||
# Requires YunoHost version 2.7.2 or higher.
|
|
||||||
ynh_config_remove_systemd() {
|
ynh_config_remove_systemd() {
|
||||||
# ============ Argument parsing =============
|
local service="${1:-$app}"
|
||||||
local -A args_array=([s]=service=)
|
if [ -e "/etc/systemd/system/$service.service" ]; then
|
||||||
local service
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
local service="${service:-$app}"
|
|
||||||
# ===========================================
|
|
||||||
|
|
||||||
local finalsystemdconf="/etc/systemd/system/$service.service"
|
|
||||||
if [ -e "$finalsystemdconf" ]; then
|
|
||||||
ynh_systemd_action --service=$service --action=stop
|
ynh_systemd_action --service=$service --action=stop
|
||||||
systemctl disable $service --quiet
|
systemctl disable $service --quiet
|
||||||
ynh_safe_rm "$finalsystemdconf"
|
ynh_safe_rm "/etc/systemd/system/$service.service"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue