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:
commit
d85d399124
5 changed files with 12 additions and 8 deletions
|
@ -6,9 +6,7 @@ Wants=network-online.target nss-lookup.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
User=root
|
User=root
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/bin/systemctl restart wg-quick@%I.service
|
ExecStart=/bin/systemctl restart wg-quick@%I.service
|
||||||
ExecStop=/bin/systemctl stop wg-quick@%I.service
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -180,7 +180,7 @@ chown -R $app: /etc/wireguard
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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"
|
yunohost service add wireguard_ui --description="WireGuard UI"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -35,10 +35,10 @@ then
|
||||||
yunohost service remove wireguard_ui
|
yunohost service remove wireguard_ui
|
||||||
fi
|
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
|
then
|
||||||
ynh_script_progression --message="Removing WireGuard service integration..." --weight=1
|
ynh_script_progression --message="Removing WireGuard service integration..." --weight=1
|
||||||
yunohost service remove wireguard@wg0
|
yunohost service remove wg-quick@wg0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -132,7 +132,7 @@ sysctl -p /etc/sysctl.d/$app.conf
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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"
|
yunohost service add wireguard_ui --description="WireGuard UI"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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"
|
ynh_secure_remove --file="/etc/systemd/system/wireguard_ui_conf.service"
|
||||||
fi
|
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
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -115,7 +121,7 @@ fi
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
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_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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -220,7 +226,7 @@ chown -R $app: /etc/wireguard
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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"
|
yunohost service add wireguard_ui --description="WireGuard UI"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue