1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wireguard_ynh.git synced 2024-09-03 20:35:58 +02:00

Merge pull request #55 from Tagadda/fix-service

Fix services not restarting when the UI updates the conf
This commit is contained in:
tituspijean 2022-02-26 15:26:35 +01:00 committed by GitHub
commit d85d399124
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View file

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

View file

@ -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"
#=================================================

View file

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

View file

@ -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"
#=================================================

View file

@ -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"
#=================================================