mirror of
https://github.com/YunoHost-Apps/wireguard_ynh.git
synced 2024-09-03 20:35:58 +02:00
refactor(level 3): move some code to right section
This commit is contained in:
parent
a49c6c50ce
commit
8dea863026
1 changed files with 14 additions and 9 deletions
|
@ -22,14 +22,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
port_wg=$(ynh_app_setting_get --app=$app --key=port_wg)
|
port_wg=$(ynh_app_setting_get --app=$app --key=port_wg)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
# Change port for WireGuard UI because 8095 is default port for WireGuard VPN
|
|
||||||
if [ $port -eq 8095 ]
|
|
||||||
then
|
|
||||||
ynh_app_setting_delete --app=$app --key=port
|
|
||||||
port=$(ynh_find_port --port=8096)
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -53,6 +45,15 @@ if [ -z "$final_path" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Change port for WireGuard UI because 8095 is default port for WireGuard VPN
|
||||||
|
if [ $port -eq 8095 ]
|
||||||
|
then
|
||||||
|
ynh_app_setting_delete --app=$app --key=port
|
||||||
|
port=$(ynh_find_port --port=8096)
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -78,6 +79,10 @@ ynh_systemd_action --service_name=wireguard_ui --action="stop" --log_path="/var/
|
||||||
systemctl disable --now --quiet wireguard.path
|
systemctl disable --now --quiet wireguard.path
|
||||||
ynh_systemd_action --service_name=wireguard --action="stop"
|
ynh_systemd_action --service_name=wireguard --action="stop"
|
||||||
|
|
||||||
|
ynh_remove_systemd_config --service=wireguard_ui
|
||||||
|
ynh_secure_remove --file="/etc/systemd/system/wireguard.path"
|
||||||
|
ynh_remove_systemd_config --service=wireguard
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -123,7 +128,7 @@ ynh_add_systemd_config --service=wireguard_ui --template=wireguard_ui.service --
|
||||||
|
|
||||||
# Create a dedicated systemd config for monitoring WireGuard's configuration
|
# Create a dedicated systemd config for monitoring WireGuard's configuration
|
||||||
cp ../conf/wireguard.path /etc/systemd/system/wireguard.path
|
cp ../conf/wireguard.path /etc/systemd/system/wireguard.path
|
||||||
systemctl enable wireguard.path
|
systemctl enable --quiet wireguard.path
|
||||||
|
|
||||||
# Create a dedicated systemd config for restarting WireGuard
|
# Create a dedicated systemd config for restarting WireGuard
|
||||||
ynh_add_systemd_config --service=wireguard --template=wireguard.service --others_var="port_wg"
|
ynh_add_systemd_config --service=wireguard --template=wireguard.service --others_var="port_wg"
|
||||||
|
|
Loading…
Add table
Reference in a new issue