]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
base-files: Remove localhost ::1 from hosts if ipv6 missing
authorJörg Sommer <joerg.sommer@navimatix.de>
Mon, 16 Oct 2023 10:31:23 +0000 (12:31 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 19 Oct 2023 12:38:54 +0000 (13:38 +0100)
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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/recipes-core/base-files/base-files_3.0.14.bb

index 6ba3971e32d1d37136b9cf7f50308d45d3868cb6..4d246126a291d7ca0c032c26a6d9aaad3018601c 100644 (file)
@@ -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 () {