1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

Merge branch 'remove_openvpn_coupling' of github.com:YunoHost-Apps/hotspot_ynh into remove_multissid

This commit is contained in:
HgO 2023-08-20 15:07:15 +02:00
commit 4325af2a2b
7 changed files with 27 additions and 15 deletions

3
conf/openvpn_90-hotspot Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
systemctl restart ynh-hotspot

View file

@ -20,10 +20,6 @@
# Functions
## State functions
has_vpnclient_app() {
[ -e /tmp/.ynh-vpnclient-started ]
}
has_ip6delegatedprefix() {
local i=${1}
@ -355,12 +351,6 @@ if [ "$1" != restart ]; then
old_gateway_interface=$(ynh_setting_get hotspot gateway_interface)
new_gateway_interface=$(ip route get 1.2.3.4 | awk '{ print $5; }')
# Switch the NAT interface if there is a VPN
ip link show dev tun0 &>/dev/null
if [ "$?" -eq 0 ]; then
new_gateway_interface=tun0
fi
echo "OK"
fi
@ -461,11 +451,6 @@ stop)
echo "Stop hostapd"
stop_hostapd
fi
# Fix configuration
if has_vpnclient_app; then
ynh-vpnclient start
fi
;;
restart)
$0 stop

View file

@ -50,6 +50,9 @@ ynh_backup --src_path="/etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl"
ynh_backup --src_path="/usr/local/bin/$service_name"
ynh_backup --src_path="/etc/openvpn/scripts/route-up.d/90-hotspot"
ynh_backup --src_path="/etc/openvpn/scripts/route-down.d/90-hotspot"
ynh_backup --src_path="/etc/init.d/hostapd"
#=================================================

View file

@ -165,6 +165,14 @@ install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq
# Copy init script
install -o root -g root -m 0755 ../conf/$service_name /usr/local/bin/
# Copy openvpn scripts
mkdir -pm 0755 /etc/openvpn/scripts
mkdir -pm 0755 /etc/openvpn/scripts/route-up.d
mkdir -pm 0755 /etc/openvpn/scripts/route-down.d
install -o root -g root -m 0755 ../conf/openvpn_90-hotspot /etc/openvpn/scripts/route-up.d/90-hotspot
install -o root -g root -m 0755 ../conf/openvpn_90-hotspot /etc/openvpn/scripts/route-down.d/90-hotspot
#=================================================
# CONFIGURE HOSTAPD
#=================================================

View file

@ -54,6 +54,9 @@ ynh_remove_app_dependencies
#=================================================
ynh_script_progression --message="Removing app main directory..."
ynh_secure_remove --file="/etc/openvpn/scripts/route-up.d/90-hotspot"
ynh_secure_remove --file="/etc/openvpn/scripts/route-down.d/90-hotspot"
# Remove the app directory securely
ynh_secure_remove --file="/usr/local/bin/$service_name"

View file

@ -70,6 +70,9 @@ ynh_restore_file --origin_path="/etc/dnsmasq.dhcpd/dhcpdv4.conf.tpl"
ynh_restore_file --origin_path="/usr/local/bin/$service_name"
ynh_restore_file --origin_path="/etc/openvpn/scripts/route-up.d/90-hotspot"
ynh_restore_file --origin_path="/etc/openvpn/scripts/route-down.d/90-hotspot"
ynh_restore_file --origin_path="/etc/init.d/hostapd"
#=================================================

View file

@ -141,6 +141,13 @@ install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq
# Copy init script
install -o root -g root -m 0755 ../conf/$service_name /usr/local/bin/
# Copy openvpn scripts
mkdir -pm 0755 /etc/openvpn/scripts
mkdir -pm 0755 /etc/openvpn/scripts/route-up.d
mkdir -pm 0755 /etc/openvpn/scripts/route-down.d
install -o root -g root -m 0755 ../conf/openvpn_90-hotspot /etc/openvpn/scripts/route-up.d/90-hotspot
install -o root -g root -m 0755 ../conf/openvpn_90-hotspot /etc/openvpn/scripts/route-down.d/90-hotspot
#=================================================
# SETUP SYSTEMD
#=================================================