From: Christian Heller Date: Fri, 26 Jun 2020 19:57:15 +0000 (+0200) Subject: In /etc/hosts-setting script, ignore IPv6s. X-Git-Url: https://plomlompom.com/repos/te"st.html?a=commitdiff_plain;h=077f3ef4a11d4d013f1ad0882811c597499ad7ce;p=config In /etc/hosts-setting script, ignore IPv6s. --- 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