mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
configure dnsmasq to enable dns resolver on wifi interface
This commit is contained in:
parent
5205776551
commit
2b60fee9f2
8 changed files with 22 additions and 0 deletions
4
conf/dnsmasq.conf.tpl
Normal file
4
conf/dnsmasq.conf.tpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Wifi Hotspot app for YunoHost
|
||||
|
||||
# Enable DNS
|
||||
interface=__WIFI_DEVICE__
|
|
@ -79,6 +79,11 @@ 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"
|
||||
}
|
||||
|
||||
function configure_dhcp()
|
||||
{
|
||||
ynh_add_config --template="/etc/dnsmasq.$app/dhcpdv4.conf.tpl" --destination="/etc/dnsmasq.$app/dhcpdv4.conf"
|
||||
|
|
|
@ -43,6 +43,9 @@ 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"
|
||||
ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv6.conf" --not_mandatory
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@ ynh_app_config_apply() {
|
|||
_ynh_app_config_apply
|
||||
|
||||
configure_hostapd
|
||||
configure_dnsmasq
|
||||
configure_dhcp
|
||||
|
||||
# Start hotspot
|
||||
|
|
|
@ -162,6 +162,7 @@ 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
|
||||
|
||||
|
@ -200,6 +201,7 @@ systemctl unmask hostapd 2>&1 # On some system e.g. RPi, for some reason hostapd
|
|||
|
||||
if [[ -n "${wifi_device}" ]]; then
|
||||
configure_hostapd
|
||||
configure_dnsmasq
|
||||
configure_dhcp
|
||||
fi
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ do
|
|||
done
|
||||
|
||||
# Remove confs
|
||||
ynh_secure_remove --file="/etc/dnsmasq.d/$app.conf"
|
||||
|
||||
ynh_secure_remove --file="/etc/dnsmasq.$app/"
|
||||
ynh_secure_remove --file="/etc/hostapd/$app/"
|
||||
|
||||
|
|
|
@ -65,6 +65,9 @@ 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
|
||||
|
||||
ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl"
|
||||
ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf" --not_mandatory
|
||||
|
||||
|
|
|
@ -214,11 +214,13 @@ 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
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue