mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
fix dns config
This commit is contained in:
parent
1a4030a094
commit
c05667cdbb
4 changed files with 23 additions and 14 deletions
|
@ -223,21 +223,10 @@ if [ "$1" != restart ]; then
|
||||||
wifi_secure=$(ynh_app_setting_get hotspot wifi_secure)
|
wifi_secure=$(ynh_app_setting_get hotspot wifi_secure)
|
||||||
wifi_passphrase=$(ynh_app_setting_get hotspot wifi_passphrase)
|
wifi_passphrase=$(ynh_app_setting_get hotspot wifi_passphrase)
|
||||||
ip6_firewall=$(ynh_app_setting_get hotspot ip6_firewall)
|
ip6_firewall=$(ynh_app_setting_get hotspot ip6_firewall)
|
||||||
|
ip6_dns=$(ynh_app_setting_get hotspot ip6_dns)
|
||||||
ip6_net=$(ynh_app_setting_get hotspot ip6_net)
|
ip6_net=$(ynh_app_setting_get hotspot ip6_net)
|
||||||
dns=$(ynh_app_setting_get hotspot dns)
|
ip4_dns=$(ynh_app_setting_get hotspot ip4_dns)
|
||||||
ip4_nat_prefix=$(ynh_app_setting_get hotspot ip4_nat_prefix)
|
ip4_nat_prefix=$(ynh_app_setting_get hotspot ip4_nat_prefix)
|
||||||
ip6_dns=""
|
|
||||||
ip4_dns=""
|
|
||||||
for ip in $(echo "${dns}" | tr ',' ' '); do
|
|
||||||
if [[ "$ip" == *":"* ]]; then
|
|
||||||
ip6_dns+="[$ip],"
|
|
||||||
else
|
|
||||||
ip4_dns+="$ip,"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# Remove trailing ,
|
|
||||||
ip6_dns="${ip6_dns%%,}"
|
|
||||||
ip4_dns="${ip4_dns%%,}"
|
|
||||||
|
|
||||||
old_gateway_interface=$(ynh_app_setting_get hotspot gateway_interface)
|
old_gateway_interface=$(ynh_app_setting_get hotspot gateway_interface)
|
||||||
new_gateway_interface=$(ip route get 1.2.3.4 | awk '{ print $5; }')
|
new_gateway_interface=$(ip route get 1.2.3.4 | awk '{ print $5; }')
|
||||||
|
|
|
@ -103,6 +103,7 @@ name = "Configuration"
|
||||||
[main.hotspot.dns]
|
[main.hotspot.dns]
|
||||||
ask = "DNS resolvers"
|
ask = "DNS resolvers"
|
||||||
type = "tags"
|
type = "tags"
|
||||||
|
bind = "null"
|
||||||
visible = "advanced"
|
visible = "advanced"
|
||||||
pattern.regexp = '^([0-9.]{7,15}|[0-9a-fA-F:]+)$'
|
pattern.regexp = '^([0-9.]{7,15}|[0-9a-fA-F:]+)$'
|
||||||
pattern.error = "Not an ip"
|
pattern.error = "Not an ip"
|
||||||
|
|
|
@ -132,6 +132,24 @@ validate__dns() {
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
set__dns() {
|
||||||
|
ip6_dns=""
|
||||||
|
ip4_dns=""
|
||||||
|
for ip in $(echo "${dns}" | tr ',' ' '); do
|
||||||
|
if [[ "$ip" == *":"* ]]; then
|
||||||
|
ip6_dns+="[$ip],"
|
||||||
|
else
|
||||||
|
ip4_dns+="$ip,"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Remove trailing ,
|
||||||
|
ip6_dns="${ip6_dns%%,}"
|
||||||
|
ip4_dns="${ip4_dns%%,}"
|
||||||
|
|
||||||
|
ynh_app_setting_set $app ip6_dns "${ip6_dns}"
|
||||||
|
ynh_app_setting_set $app ip4_dns "${ip4_dns}"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# OVERWRITING VALIDATE STEP
|
# OVERWRITING VALIDATE STEP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -139,8 +139,9 @@ ynh_app_setting_set --app=$app --key=wifi_passphrase --value="${wifi_passphrase}
|
||||||
ynh_app_setting_set --app=$app --key=wifi_device --value="${wifi_device}"
|
ynh_app_setting_set --app=$app --key=wifi_device --value="${wifi_device}"
|
||||||
ynh_app_setting_set --app=$app --key=wifi_channel --value=6
|
ynh_app_setting_set --app=$app --key=wifi_channel --value=6
|
||||||
ynh_app_setting_set --app=$app --key=ip6_firewall --value=1
|
ynh_app_setting_set --app=$app --key=ip6_firewall --value=1
|
||||||
|
ynh_app_setting_set --app=$app --key=ip6_dns --value=""
|
||||||
ynh_app_setting_set --app=$app --key=ip6_net --value="${ip6_net}"
|
ynh_app_setting_set --app=$app --key=ip6_net --value="${ip6_net}"
|
||||||
ynh_app_setting_set --app=$app --key=dns --value="10.0.242.1"
|
ynh_app_setting_set --app=$app --key=ip4_dns --value="10.0.242.1"
|
||||||
ynh_app_setting_set --app=$app --key=ip4_nat_prefix --value=10.0.242
|
ynh_app_setting_set --app=$app --key=ip4_nat_prefix --value=10.0.242
|
||||||
|
|
||||||
if [[ -z $wifi_device ]]; then
|
if [[ -z $wifi_device ]]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue