mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
handle new dns settings
This commit is contained in:
parent
982f4ebe3e
commit
64075f2dd9
1 changed files with 25 additions and 0 deletions
|
@ -72,6 +72,31 @@ if [ -z $service_name ]; then
|
|||
ynh_app_setting_set --app=$app --key=service_name --value=$service_name
|
||||
fi
|
||||
|
||||
dns=$(ynh_app_setting_get $app dns)
|
||||
if [[ -n "${dns}" ]]; then
|
||||
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%%,}"
|
||||
|
||||
if [[ -z "$(ynh_app_setting_get --app=$app --key=ip6_dns)" ]]; then
|
||||
ynh_app_setting_set --app=$app --key=ip6_dns --value="${ip6_dns}"
|
||||
if
|
||||
if [[ -z "$(ynh_app_setting_get --app=$app --key=ip4_dns)" ]]; then
|
||||
ynh_app_setting_set --app=$app --key=ip4_dns --value="${ip4_dns}"
|
||||
if
|
||||
|
||||
ynh_app_setting_delete $app dns
|
||||
fi
|
||||
|
||||
# Old stuff prior to 2.x
|
||||
|
||||
ip6_net=$(ynh_app_setting_get --app=$app --key=ip6_net)
|
||||
|
|
Loading…
Reference in a new issue