From 80e29842d97b9e5f1b5bff664720c4f5159323f7 Mon Sep 17 00:00:00 2001 From: HgO Date: Mon, 18 Dec 2023 14:33:53 +0100 Subject: [PATCH 1/2] check if ynh-hotspot is activating --- conf/openvpn_90-hotspot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/openvpn_90-hotspot b/conf/openvpn_90-hotspot index 1fbc11c..bb1f580 100644 --- a/conf/openvpn_90-hotspot +++ b/conf/openvpn_90-hotspot @@ -15,7 +15,8 @@ set_nat() { iptables -w -t nat -A POSTROUTING -o "${gateway_interface}" -j MASQUERADE } -if systemctl -q is-active __SERVICE_NAME__; then +ynh_hotspot_state=$(systemctl -q is-active __SERVICE_NAME__) +if [[ "${ynh_hotspot_state}" == "active" || "${ynh_hotspot_state}" == "activating" ]]; then old_gateway_interface=$(yunohost app setting __APP__ gateway_interface) new_gateway_interface=$(ip route get 1.2.3.4 | awk '{ print $5; }') From d16e8f5503f2525a54165d5edf7408e20ca30fba Mon Sep 17 00:00:00 2001 From: HgO Date: Tue, 19 Dec 2023 10:42:31 +0100 Subject: [PATCH 2/2] obviously it won't work in quiet mode... --- conf/openvpn_90-hotspot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/openvpn_90-hotspot b/conf/openvpn_90-hotspot index bb1f580..1fc4dd0 100644 --- a/conf/openvpn_90-hotspot +++ b/conf/openvpn_90-hotspot @@ -15,7 +15,7 @@ set_nat() { iptables -w -t nat -A POSTROUTING -o "${gateway_interface}" -j MASQUERADE } -ynh_hotspot_state=$(systemctl -q is-active __SERVICE_NAME__) +ynh_hotspot_state=$(systemctl is-active __SERVICE_NAME__) if [[ "${ynh_hotspot_state}" == "active" || "${ynh_hotspot_state}" == "activating" ]]; then old_gateway_interface=$(yunohost app setting __APP__ gateway_interface) new_gateway_interface=$(ip route get 1.2.3.4 | awk '{ print $5; }')