aboutsummaryrefslogtreecommitdiff
path: root/package/dhcp/dhcp.mk
diff options
context:
space:
mode:
authorGravatar Eric Le Bihan <eric.le.bihan.dev@free.fr>2014-09-15 23:04:43 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-10-29 23:00:02 +0100
commit938056f948cc00041be64c9f0394f79d820df3bd (patch)
tree93308f5ca7158b3177b8371bd78ffde7e7a38cd0 /package/dhcp/dhcp.mk
parent146f69ec79672d7dd81a8d6e3adc549b16d32f4e (diff)
downloadbuildroot-938056f948cc00041be64c9f0394f79d820df3bd.tar.gz
buildroot-938056f948cc00041be64c9f0394f79d820df3bd.tar.bz2
dhcp: add systemd service file
Add a systemd service file to start dhcpd. The network interfaces to listen on can be set via the variable INTERFACES in /etc/default/dhcpd.conf. Example: INTERFACES="eth0 eth1" Also install a tmpfiles.d file to create /var/lib/dhcp/dhcpd.leases (needed at dhcpd start-up). Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/dhcp/dhcp.mk')
-rw-r--r--package/dhcp/dhcp.mk15
1 files changed, 15 insertions, 0 deletions
diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
index 736635afe8..8b38fd0a22 100644
--- a/package/dhcp/dhcp.mk
+++ b/package/dhcp/dhcp.mk
@@ -73,6 +73,21 @@ define DHCP_INSTALL_INIT_SYSV
$(TARGET_DIR)/etc/init.d/S80dhcp-relay
endef
+define DHCP_INSTALL_INIT_SYSTEMD
+ $(INSTALL) -D -m 644 package/dhcp/dhcpd.service \
+ $(TARGET_DIR)/lib/systemd/system/dhcpd.service
+
+ mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+
+ ln -sf ../../../../lib/systemd/system/dhcpd.service \
+ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dhcpd.service
+
+ echo "d /var/lib/dhcp 0755 - - - -" > \
+ $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf
+ echo "f /var/lib/dhcp/dhcpd.leases - - - - -" >> \
+ $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf
+endef
+
define DHCP_INSTALL_TARGET_CMDS
$(DHCP_INSTALL_RELAY)
$(DHCP_INSTALL_SERVER)