1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00
This commit is contained in:
OniriCorpe 2023-12-28 06:24:34 +01:00
parent 952f48f41a
commit 7c5ce0d152

View file

@ -14,8 +14,13 @@ get_network_interface(){
local IPvx="$1"
# note: echo the IP route command to prevent a crash if the server doesn't have any IPv4/6
# shellcheck disable=SC2005
echo ipv4_interface="$(echo "$(ip -"$IPvx" route get 1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)"
if [[ "$IPvx" = "4" ]]; then
# shellcheck disable=SC2005
echo "$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)"
else
# shellcheck disable=SC2005
echo "$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)"
fi
}
configure_network_interface_dnsmasq(){