package/dhcp: Only install the relevant unit file
authorNathaniel Roach <nroach44@gmail.com>
Mon, 1 Dec 2014 14:18:16 +0000 (22:18 +0800)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 7 Dec 2014 20:55:08 +0000 (21:55 +0100)
Previous to this patch, if BR2_PACKAGE_DHCP_CLIENT was selected,
dhcpd.service was installed to the target on systemd systems.

On the resultant system, this would mean that systemctl would
show an error starting dhcpd.service, as the requisite files
do not exist. This does not cause issue on sysvinit systems
as the init scripts silently error when the files aren't found.

Fix this by adding a conditional check to the install define.

Signed-off-by: Nathaniel Roach <nroach44@gmail.com>
Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/dhcp/dhcp.mk

index 1eb6b325497f44c4dc988010416ee0e65ccf20dd..2aa690f05c9ac611bb19357b92db2346f240e7f1 100644 (file)
@@ -75,6 +75,7 @@ define DHCP_INSTALL_INIT_SYSV
                $(TARGET_DIR)/etc/init.d/S80dhcp-relay
 endef
 
+ifeq ($(BR2_PACKAGE_DHCP_SERVER),y)
 define DHCP_INSTALL_INIT_SYSTEMD
        $(INSTALL) -D -m 644 package/dhcp/dhcpd.service \
                $(TARGET_DIR)/lib/systemd/system/dhcpd.service
@@ -89,6 +90,7 @@ define DHCP_INSTALL_INIT_SYSTEMD
        echo "f /var/lib/dhcp/dhcpd.leases - - - - -" >> \
                $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf
 endef
+endif
 
 define DHCP_INSTALL_TARGET_CMDS
        $(DHCP_INSTALL_RELAY)