mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Hotspot and hairpining use cases
This commit is contained in:
parent
04ebf2740d
commit
7e7dbe41d7
3 changed files with 23 additions and 6 deletions
|
@ -14,7 +14,7 @@ do_pre_regen() {
|
||||||
etcdefault_dir="${pending_dir}/etc/default"
|
etcdefault_dir="${pending_dir}/etc/default"
|
||||||
mkdir -p "$etcdefault_dir"
|
mkdir -p "$etcdefault_dir"
|
||||||
|
|
||||||
# add general conf files
|
# add default conf files
|
||||||
cp plain/etcdefault ${pending_dir}/etc/default/dnsmasq
|
cp plain/etcdefault ${pending_dir}/etc/default/dnsmasq
|
||||||
cp plain/dnsmasq.conf ${pending_dir}/etc/dnsmasq.conf
|
cp plain/dnsmasq.conf ${pending_dir}/etc/dnsmasq.conf
|
||||||
|
|
||||||
|
@ -26,11 +26,22 @@ do_pre_regen() {
|
||||||
ynh_validate_ip4 "$ipv4" || ipv4='127.0.0.1'
|
ynh_validate_ip4 "$ipv4" || ipv4='127.0.0.1'
|
||||||
ipv6=$(curl -s -6 https://ip6.yunohost.org 2>/dev/null || true)
|
ipv6=$(curl -s -6 https://ip6.yunohost.org 2>/dev/null || true)
|
||||||
ynh_validate_ip6 "$ipv6" || ipv6=''
|
ynh_validate_ip6 "$ipv6" || ipv6=''
|
||||||
|
IFS=' ' read -a interfaces <<< "$(ls /sys/class/net)"
|
||||||
|
wireless_interfaces=()
|
||||||
|
for dev in "${interfaces[@]}"; do
|
||||||
|
if [ -d "/sys/class/net/$dev/wireless" ]; then
|
||||||
|
wireless_interfaces+=("$dev")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
export ipv4
|
# General configuration
|
||||||
export ipv6
|
export wireless_interfaces
|
||||||
|
ynh_render_template "dnsmasq.conf.tpl" "${pending_dir}/etc/dnsmasq.conf"
|
||||||
|
|
||||||
# add domain conf files
|
# add domain conf files
|
||||||
|
export interfaces
|
||||||
|
export ipv4
|
||||||
|
export ipv6
|
||||||
for domain in $YNH_DOMAINS; do
|
for domain in $YNH_DOMAINS; do
|
||||||
[[ ! $domain =~ \.local$ ]] || continue
|
[[ ! $domain =~ \.local$ ]] || continue
|
||||||
export domain
|
export domain
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
host-record={{ domain }},{{ ipv4 }}
|
{% for interface in interfaces %}
|
||||||
host-record=xmpp-upload.{{ domain }},{{ ipv4 }}
|
interface-name={{ domain }},{{ interface }}
|
||||||
|
interface-name=xmpp-upload.{{ domain }},{{ interface }}
|
||||||
|
{% endfor %}
|
||||||
{% if ipv6 %}
|
{% if ipv6 %}
|
||||||
host-record={{ domain }},{{ ipv6 }}
|
host-record={{ domain }},{{ ipv6 }}
|
||||||
host-record=xmpp-upload.{{ domain }},{{ ipv6 }}
|
host-record=xmpp-upload.{{ domain }},{{ ipv6 }}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
domain-needed
|
domain-needed
|
||||||
expand-hosts
|
expand-hosts
|
||||||
|
localise-queries
|
||||||
|
|
||||||
listen-address=127.0.0.1
|
|
||||||
|
{% for interface in wireless_interfaces %}
|
||||||
|
interface={{ interface }}
|
||||||
|
{% endfor %}
|
||||||
resolv-file=/etc/resolv.dnsmasq.conf
|
resolv-file=/etc/resolv.dnsmasq.conf
|
||||||
cache-size=256
|
cache-size=256
|
||||||
|
|
Loading…
Add table
Reference in a new issue