From 077f3ef4a11d4d013f1ad0882811c597499ad7ce Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 26 Jun 2020 21:57:15 +0200 Subject: [PATCH] In /etc/hosts-setting script, ignore IPv6s. --- buster/setup_scripts/set_hostname_and_fqdn.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buster/setup_scripts/set_hostname_and_fqdn.sh b/buster/setup_scripts/set_hostname_and_fqdn.sh index 3f95590..a3b9f9a 100755 --- a/buster/setup_scripts/set_hostname_and_fqdn.sh +++ b/buster/setup_scripts/set_hostname_and_fqdn.sh @@ -10,6 +10,8 @@ # on our systems) or to 127.0.1.1 if not. On the reasoning for separating # localhost and hostname mapping to different IPs, see # . +# +# Ignores IPv6s. set -e hostname="$1" @@ -23,6 +25,9 @@ hostname "${hostname}" final_ip="127.0.1.1" for ip in $(hostname -I); do + if [ $(echo "${ip}" | grep ':' | wc -l) -eq 1 ]; then + continue + fi range_1=$(echo "${ip}" | cut -d "." -f 1) range_2=$(echo "${ip}" | cut -d "." -f 2) if [ "${range_1}" -eq 127 ]; then -- 2.30.2