From 7afb30566b017165ce6e4ef79d7b9a81fe124ff1 Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Sun, 20 Feb 2022 18:13:48 +0000 Subject: [PATCH] Fix services --- conf/wireguard@.service | 2 -- scripts/install | 2 +- scripts/remove | 4 ++-- scripts/restore | 2 +- scripts/upgrade | 10 ++++++++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/conf/wireguard@.service b/conf/wireguard@.service index 17eb385..2b089af 100644 --- a/conf/wireguard@.service +++ b/conf/wireguard@.service @@ -6,9 +6,7 @@ Wants=network-online.target nss-lookup.target [Service] Type=oneshot User=root -RemainAfterExit=yes ExecStart=/bin/systemctl restart wg-quick@%I.service -ExecStop=/bin/systemctl stop wg-quick@%I.service [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index d95861d..fd862ce 100644 --- a/scripts/install +++ b/scripts/install @@ -180,7 +180,7 @@ chown -R $app: /etc/wireguard #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add wireguard@wg0 --description="WireGuard VPN" --needs_exposed_ports="$port_wg" --test_status="wg show | grep wg0" +yunohost service add wg-quick@wg0 --description="WireGuard VPN" --needs_exposed_ports="$port_wg" --test_status="wg show | grep wg0" yunohost service add wireguard_ui --description="WireGuard UI" #================================================= diff --git a/scripts/remove b/scripts/remove index 3c35861..4d9d468 100644 --- a/scripts/remove +++ b/scripts/remove @@ -35,10 +35,10 @@ then yunohost service remove wireguard_ui fi -if ynh_exec_warn_less yunohost service status wireguard@wg0 >/dev/null +if ynh_exec_warn_less yunohost service status wg-quick@wg0 >/dev/null then ynh_script_progression --message="Removing WireGuard service integration..." --weight=1 - yunohost service remove wireguard@wg0 + yunohost service remove wg-quick@wg0 fi #================================================= diff --git a/scripts/restore b/scripts/restore index e66d9da..cf7bda3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -132,7 +132,7 @@ sysctl -p /etc/sysctl.d/$app.conf #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add wireguard@wg0 --description="WireGuard VPN" --needs_exposed_ports="$port_wg" --test_status="wg show | grep wg0" +yunohost service add wg-quick@wg0 --description="WireGuard VPN" --needs_exposed_ports="$port_wg" --test_status="wg show | grep wg0" yunohost service add wireguard_ui --description="WireGuard UI" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 480b2ac..249fbe6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,6 +107,12 @@ if systemctl list-units --full -all | grep -Fq "wireguard_ui_conf.service"; then ynh_secure_remove --file="/etc/systemd/system/wireguard_ui_conf.service" fi +# Remove the service integration from an older version +if ynh_exec_warn_less yunohost service status wireguard@wg0 >/dev/null +then + yunohost service remove wireguard@wg0 +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -115,7 +121,7 @@ fi ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=wireguard_ui --action="stop" --line_match="Stopped WireGuard UI" --log_path="systemd" --timeout=30 -ynh_systemd_action --service_name=wireguard@wg0 --action="stop" +ynh_systemd_action --service_name=wg-quick@wg0 --action="stop" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -220,7 +226,7 @@ chown -R $app: /etc/wireguard #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add wireguard@wg0 --description="WireGuard VPN" --needs_exposed_ports="$port_wg" --test_status="wg show | grep wg0" +yunohost service add wg-quick@wg0 --description="WireGuard VPN" --needs_exposed_ports="$port_wg" --test_status="wg show | grep wg0" yunohost service add wireguard_ui --description="WireGuard UI" #=================================================