diff mbox series

base-files: Remove localhost ::1 from hosts if ipv6 missing

Message ID 1141e5d627199e9f440cf558859a0857b1e7eac2.1697452283.git.joerg.sommer@navimatix.de
State Accepted, archived
Commit c3d9cff06f383528884bfb5c4f8a6a6cb023977a
Headers show
Series base-files: Remove localhost ::1 from hosts if ipv6 missing | expand

Commit Message

Jörg Sommer Oct. 16, 2023, 10:31 a.m. UTC
If a distribution doesn't provide IPv6, the mapping of localhost and ::1 has
to be removed.

Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 6ba3971e32..4d246126a2 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -136,6 +136,10 @@  do_install () {
 		echo ${hostname} > ${D}${sysconfdir}/hostname
 		echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
 	fi
+
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'false', 'true', d)}; then
+		sed -i '/^::1/s/ localhost//' ${D}${sysconfdir}/hosts
+	fi
 }
 
 do_install:append:libc-glibc () {