1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00

trying to better handle ip processing at install

This commit is contained in:
OniriCorpe 2023-12-28 06:43:36 +01:00
parent 7c5ce0d152
commit 584d0ce893
2 changed files with 14 additions and 6 deletions

View file

@ -81,8 +81,14 @@ process_ips(){
if is_public_ip "$ip" && [ "$open_port_53" == "false" ] ; then
break
else
processed_ips="$ip"
break
if [[ $is_install = true ]]; then
# to get a dash before each IP
processed_ips="- $ip"
break
else
processed_ips="$ip"
break
fi
fi
fi
done

View file

@ -84,12 +84,14 @@ ipv6_interface="$(get_network_interface 6)"
# put the network interface in a dedicated dnsmasq config
configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface"
# get IPv4 for the AGH config file (with a starting "- ")
ipv4_addr=$(echo "- " "$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")")
# to warn process_ips that we're doing an installation (to get a dash before each IP)
is_install=true
# get IPv4 for the AGH config file
ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")
# get IPv6 for the AGH config file (with a starting "- ")
# get IPv6 for the AGH config file
# the 'sed' is used to get rid of the network prefix ('/64' for example)
ipv6_addr=$(echo "- " "$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")")
ipv6_addr=$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")
password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())")
ynh_app_setting_set --app="$app" --key=password --value="$password"