package/systemd: create /etc/resolv.conf only if resolved is selected
authorCarlos Santos <unixmania@gmail.com>
Sat, 26 Oct 2019 16:17:02 +0000 (13:17 -0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 26 Oct 2019 17:03:15 +0000 (19:03 +0200)
Or else it becomes a dangling link to
/run/systemd/resolve/resolv.conf, which is never created. Even worst,
it also prevents NetworkManager from updating resolv.conf.

Fixes:
  https://bugs.busybox.net/show_bug.cgi?id=9881

Signed-off-by: Carlos Santos <unixmania@gmail.com>
Reviewed-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/systemd/systemd.mk

index 5961d98b22b252143cce4b150b32a2730019e10b..df40961feea3ca91b18de30c9a4bcbaf93c6c559 100644 (file)
@@ -354,10 +354,6 @@ define SYSTEMD_INSTALL_SERVICE_NETWORKD
        ln -sf ../../../../lib/systemd/system/systemd-network-generator.service \
                $(TARGET_DIR)/etc/systemd/system/network-pre.target.wants/systemd-network-generator.service
 endef
-define SYSTEMD_INSTALL_RESOLVCONF_HOOK
-       ln -sf ../run/systemd/resolve/resolv.conf \
-               $(TARGET_DIR)/etc/resolv.conf
-endef
 SYSTEMD_NETWORKD_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
 ifneq ($(SYSTEMD_NETWORKD_DHCP_IFACE),)
 define SYSTEMD_INSTALL_NETWORK_CONFS
@@ -371,6 +367,10 @@ SYSTEMD_CONF_OPTS += -Dnetworkd=false
 endif
 
 ifeq ($(BR2_PACKAGE_SYSTEMD_RESOLVED),y)
+define SYSTEMD_INSTALL_RESOLVCONF_HOOK
+       ln -sf ../run/systemd/resolve/resolv.conf \
+               $(TARGET_DIR)/etc/resolv.conf
+endef
 SYSTEMD_CONF_OPTS += -Dresolve=true
 SYSTEMD_RESOLVED_USER = systemd-resolve -1 systemd-resolve -1 * - - - Network Name Resolution Manager
 define SYSTEMD_INSTALL_SERVICE_RESOLVED