From: Jörg Sommer Date: Mon, 16 Oct 2023 10:31:23 +0000 (+0200) Subject: base-files: Remove localhost ::1 from hosts if ipv6 missing X-Git-Tag: yocto-5.2~4815 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c3d9cff06f383528884bfb5c4f8a6a6cb023977a;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git base-files: Remove localhost ::1 from hosts if ipv6 missing If a distribution doesn't provide IPv6, the mapping of localhost and ::1 has to be removed. Signed-off-by: Jörg Sommer Signed-off-by: Alexandre Belloni --- 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 6ba3971e32d..4d246126a29 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 () {