]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd: add option to use stub-resolv.conf
authorEero Aaltonen <eero.aaltonen@vaisala.com>
Thu, 19 Oct 2023 11:11:52 +0000 (14:11 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Oct 2023 09:45:26 +0000 (10:45 +0100)
Add option to use the stub-resolv.conf file, which is the systemd
upstream's recommended default mode
https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#/etc/resolv.conf

This enables the resolution of Multicast DNS and Link-Local Multicast
Name Resolution names for programs that do not use Name Service Switch.

Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/recipes-core/systemd/systemd_254.4.bb

index 76cc07e86f535f87534642a4b0d9bbe42fa665d1..ef29116bf924d801233337aa662bb7a60557d28d 100644 (file)
@@ -227,6 +227,8 @@ PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
 PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
 PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd"
 
+RESOLV_CONF ??= ""
+
 # Helper variables to clarify locations.  This mirrors the logic in systemd's
 # build system.
 rootprefix ?= "${root_prefix}"
@@ -338,8 +340,9 @@ do_install() {
                echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
                ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
        else
-               sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
-               ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
+               resolv_conf="${@bb.utils.contains('RESOLV_CONF', 'stub-resolv', 'run/systemd/resolve/stub-resolv.conf', 'run/systemd/resolve/resolv.conf', d)}"
+               sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../${resolv_conf}%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
+               ln -s ../${resolv_conf} ${D}${sysconfdir}/resolv-conf.systemd
        fi
        if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
                rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf