]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd: arrange for volatile /etc/resolv.conf
authorChristopher Larson <chris_larson@mentor.com>
Thu, 5 Nov 2015 03:19:19 +0000 (20:19 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 11 Jan 2016 23:23:16 +0000 (23:23 +0000)
On sysvinit systems, volatiles is configured to make /etc/resolv.conf symlink
to a file in a volatile path, which lets us write to /etc/resolv.conf for
read-only-rootfs. For systemd, this isn't set up unless we enable
systemd-resolved, which we don't by default. When it's not enabled, create the
/etc/resolv.conf symlink and ensure the volatile path is created on boot with
tmpfiles.d.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/systemd/systemd_228.bb

index df8813ac420ca295b1475bba6660dbdfd7c4a5ff..aa2e846b696a0bd5461a1f31aee8261f08f4f504 100644 (file)
@@ -203,6 +203,13 @@ do_install() {
        if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then
                ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf', d)}
        fi
+       if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
+               # if resolved is disabled, it won't handle the link of resolv.conf, so
+               # set it up ourselves
+               ln -s ../run/resolv.conf ${D}${sysconfdir}/resolv.conf
+               echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
+               echo 'f /run/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
+       fi
        install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
 }
 
@@ -297,6 +304,7 @@ FILES_${PN} = " ${base_bindir}/* \
                 ${sysconfdir}/tmpfiles.d/ \
                 ${sysconfdir}/xdg/ \
                 ${sysconfdir}/init.d/README \
+                ${sysconfdir}/resolv.conf \
                 ${rootlibexecdir}/systemd/* \
                 ${systemd_unitdir}/* \
                 ${base_libdir}/security/*.so \