dhcpcd: add systemd start-up service
authorMarkus Mayer <mmayer@broadcom.com>
Tue, 31 Oct 2017 22:36:59 +0000 (15:36 -0700)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 2 Nov 2017 22:03:36 +0000 (23:03 +0100)
Add systemd start-up configuration for dhcpcd that is executed after
the network has been brought up.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/dhcpcd/dhcpcd.mk
package/dhcpcd/dhcpcd.service [new file with mode: 0644]

index cf1da4f1470151522ab75fd151c9140776a5f4ca..dc5c69b86b693c062cb051c442cdd61fca138dcf 100644 (file)
@@ -41,6 +41,14 @@ define DHCPCD_INSTALL_INIT_SYSV
                $(TARGET_DIR)/etc/init.d/S41dhcpcd
 endef
 
+define DHCPCD_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 0644 package/dhcpcd/dhcpcd.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/dhcpcd.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -sf ../../../../usr/lib/systemd/system/dhcpcd.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dhcpcd.service
+endef
+
 # NOTE: Even though this package has a configure script, it is not generated
 # using the autotools, so we have to use the generic package infrastructure.
 
diff --git a/package/dhcpcd/dhcpcd.service b/package/dhcpcd/dhcpcd.service
new file mode 100644 (file)
index 0000000..0552b5c
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=DHCP client
+After=network.target
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/default/dhcpcd
+PIDFile=/var/run/dhcpcd.pid
+ExecStart=/sbin/dhcpcd $DAEMON_ARGS
+Restart=always
+
+[Install]
+WantedBy=multi-user.target