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

Merge pull request #106 from YunoHost-Apps/remove_openvpn_coupling

Remove/rework openvpn coupling
This commit is contained in:
Alexandre Aubin 2023-09-17 21:54:24 +02:00 committed by GitHub
commit 2c188a5789
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 27 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}
@ -353,12 +349,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
@ -459,11 +449,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

@ -117,18 +117,6 @@ ynh_system_user_create --username=$app
#=================================================
ynh_script_progression --message="Configuring hotspot..."
if [[ ! -v ip6_net ]]; then # if ip6_net not set
ip6_net=""
if [[ -e /tmp/.ynh-vpnclient-started ]]; then
vpnclient_ip6_net=$(ynh_app_setting_get vpnclient ip6_net 2>&1)
if [[ $vpnclient_ip6_net =~ :: ]]; then
ip6_net=${vpnclient_ip6_net}
fi
fi
fi
hot_reload_usb_wifi_cards
wifi_device=$(iw_devices | awk -F\| '{ print $1 }')
@ -165,6 +153,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
#=================================================