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

yolo: we shouldn't need to add an app-specific conf for dnsmasq only to add 'interface=wlanX', it's already handled by the core, we just need to regen-conf dnsmasq when we start/stop the hotspot ?

This commit is contained in:
Alexandre Aubin 2023-10-05 18:44:05 +02:00
parent f55f117625
commit f40082a94c
8 changed files with 10 additions and 24 deletions

View file

@ -1,4 +0,0 @@
# Wifi Hotspot app for YunoHost
# Enable DNS resolution on wifi interface
interface=__WIFI_DEVICE__

View file

@ -296,6 +296,9 @@ start)
# Update dynamic settings
ynh_app_setting_set hotspot gateway_interface "${new_gateway_interface}"
# Regen-conf dnsmasq to enable dns resolution on dnsmasq for the new interface
yunohost tools regen-conf dnsmasq
;;
stop)
echo "[hotspot] Stopping..."
@ -319,6 +322,9 @@ stop)
echo "Stop hostapd"
stop_hostapd
fi
# Regen-conf dnsmasq to disable dns resolution on dnsmasq for the previous interface
yunohost tools regen-conf dnsmasq
;;
restart)
$0 stop

View file

@ -83,12 +83,6 @@ function configure_hostapd()
ynh_add_config --template="/etc/hostapd/$app/hostapd.conf.tpl" --destination="/etc/hostapd/$app/hostapd.conf"
}
function configure_dnsmasq()
{
ynh_add_config --template="/etc/dnsmasq.$app/dnsmasq.conf.tpl" --destination="/etc/dnsmasq.d/$app.conf"
systemctl restart dnsmasq
}
function configure_dhcp()
{
ynh_add_config --template="/etc/dnsmasq.$app/dhcpdv4.conf.tpl" --destination="/etc/dnsmasq.$app/dhcpdv4.conf"

View file

@ -43,7 +43,6 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="/etc/hostapd/$app/hostapd.conf.tpl"
ynh_backup --src_path="/etc/hostapd/$app/hostapd.conf" --not_mandatory
ynh_backup --src_path="/etc/dnsmasq.$app/dnsmasq.conf.tpl"
ynh_backup --src_path="/etc/dnsmasq.d/$app.conf" --not_mandatory
ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl"

View file

@ -205,7 +205,6 @@ ynh_app_config_apply() {
if [[ "${service_enabled}" -eq 1 ]]; then
configure_hostapd
configure_dnsmasq
configure_dhcp
# Start hotspot

View file

@ -162,7 +162,6 @@ mkdir -pm 0755 /etc/dnsmasq.$app/
chown root: /etc/dnsmasq.$app/
install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl /etc/hostapd/$app/hostapd.conf.tpl
install -b -o root -g root -m 0644 ../conf/dnsmasq.conf.tpl /etc/dnsmasq.$app/dnsmasq.conf.tpl
install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.$app/dhcpdv6.conf.tpl
install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.$app/dhcpdv4.conf.tpl
@ -192,9 +191,8 @@ systemctl stop hostapd 2>&1
systemctl unmask hostapd 2>&1 # On some system e.g. RPi, for some reason hostapd is masked after install ...
if [[ -n "${wifi_device}" ]]; then
configure_hostapd
configure_dnsmasq
configure_dhcp
configure_hostapd
configure_dhcp
fi
#=================================================

View file

@ -74,10 +74,6 @@ fi
ynh_restore_file --origin_path="/etc/hostapd/$app/hostapd.conf.tpl"
ynh_restore_file --origin_path="/etc/hostapd/$app/hostapd.conf" --not_mandatory
ynh_restore_file --origin_path="/etc/dnsmasq.$app/dnsmasq.conf.tpl"
ynh_restore_file --origin_path="/etc/dnsmasq.d/$app.conf" --not_mandatory
systemctl restart dnsmasq
ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl"
ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf" --not_mandatory

View file

@ -214,14 +214,12 @@ mkdir -pm 0755 /etc/dnsmasq.$app/
chown root: /etc/dnsmasq.$app/
install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl /etc/hostapd/$app/hostapd.conf.tpl
install -b -o root -g root -m 0644 ../conf/dnsmasq.conf.tpl /etc/dnsmasq.$app/dnsmasq.conf.tpl
install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.$app/dhcpdv6.conf.tpl
install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.$app/dhcpdv4.conf.tpl
if [[ -n "${wifi_device}" ]]; then
configure_hostapd
configure_dnsmasq
configure_dhcp
configure_hostapd
configure_dhcp
fi
# Copy init script