summaryrefslogtreecommitdiff
path: root/meta/recipes-connectivity/dhcp
diff options
context:
space:
mode:
authorLi xin <lixin.fnst@cn.fujitsu.com>2015-06-18 10:14:00 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-07 23:56:23 +0100
commitb8eeac1b85c253c49f4324ac36db8ff98b286688 (patch)
treeb624d3bb6de387017b83e7eaf9cd3b8a17e1481e /meta/recipes-connectivity/dhcp
parent3630f7963a472fa11a1d52bd9782fde9a9880971 (diff)
downloadopenembedded-core-b8eeac1b85c253c49f4324ac36db8ff98b286688.tar.gz
openembedded-core-b8eeac1b85c253c49f4324ac36db8ff98b286688.tar.bz2
openembedded-core-b8eeac1b85c253c49f4324ac36db8ff98b286688.zip
dhcp: modify dhcpd.service to make it start successfully and add systemd service files dhcpd6.service
Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-connectivity/dhcp')
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp.inc12
-rw-r--r--meta/recipes-connectivity/dhcp/files/dhcpd.service8
-rw-r--r--meta/recipes-connectivity/dhcp/files/dhcpd6.service15
3 files changed, 29 insertions, 6 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp.inc b/meta/recipes-connectivity/dhcp/dhcp.inc
index 6ced77500a..3bf1ea958d 100644
--- a/meta/recipes-connectivity/dhcp/dhcp.inc
+++ b/meta/recipes-connectivity/dhcp/dhcp.inc
@@ -17,12 +17,13 @@ SRC_URI = "ftp://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
file://init-relay file://default-relay \
file://init-server file://default-server \
file://dhclient.conf file://dhcpd.conf \
- file://dhcpd.service file://dhcrelay.service"
+ file://dhcpd.service file://dhcrelay.service \
+ file://dhcpd6.service "
inherit autotools systemd
SYSTEMD_PACKAGES = "${PN}-server ${PN}-relay"
-SYSTEMD_SERVICE_${PN}-server = "dhcpd.service"
+SYSTEMD_SERVICE_${PN}-server = "dhcpd.service dhcpd6.service"
SYSTEMD_AUTO_ENABLE_${PN}-server = "disable"
SYSTEMD_SERVICE_${PN}-relay = "dhcrelay.service"
@@ -59,9 +60,12 @@ do_install_append () {
# Install systemd unit files
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/dhcpd.service ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/dhcpd6.service ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
- sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcpd.service ${D}${systemd_unitdir}/system/dhcrelay.service
- sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcpd.service
+ sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service ${D}${systemd_unitdir}/system/dhcrelay.service
+ sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcpd*.service
+ sed -i -e 's,@base_bindir@,${base_bindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service
+ sed -i -e 's,@localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/dhcpd*.service
}
PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell"
diff --git a/meta/recipes-connectivity/dhcp/files/dhcpd.service b/meta/recipes-connectivity/dhcp/files/dhcpd.service
index 8648f1a253..ae4f93eca5 100644
--- a/meta/recipes-connectivity/dhcp/files/dhcpd.service
+++ b/meta/recipes-connectivity/dhcp/files/dhcpd.service
@@ -1,11 +1,15 @@
[Unit]
-Description=DHCP Server Daemon
+Description=DHCPv4 Server Daemon
+Documentation=man:dhcpd(8) man:dhcpd.conf(5)
After=network.target
After=time-sync.target
[Service]
+PIDFile=@localstatedir@/run/dhcpd.pid
EnvironmentFile=@SYSCONFDIR@/default/dhcp-server
-ExecStart=-@SBINDIR@/dhcpd -q $INTERFACES
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/dhcp-server
+ExecStartPre=@base_bindir@/touch @localstatedir@/lib/dhcp/dhcpd.leases
+ExecStart=@SBINDIR@/dhcpd -f -cf @SYSCONFDIR@/dhcp/dhcpd.conf -pf @localstatedir@/run/dhcpd.pid $DHCPDARGS -q $INTERFACES
[Install]
WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/dhcp/files/dhcpd6.service b/meta/recipes-connectivity/dhcp/files/dhcpd6.service
new file mode 100644
index 0000000000..ca96abb838
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/files/dhcpd6.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=DHCPv6 Server Daemon
+Documentation=man:dhcpd(8) man:dhcpd.conf(5)
+After=network.target
+After=time-sync.target
+
+[Service]
+PIDFile=@localstatedir@/run/dhcpd6.pid
+EnvironmentFile=@SYSCONFDIR@/default/dhcp-server
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/dhcpd6
+ExecStartPre=@base_bindir@/touch @localstatedir@/lib/dhcp/dhcpd6.leases
+ExecStart=@SBINDIR@/dhcpd -f -6 -cf @SYSCONFDIR@/dhcp/dhcpd.conf -pf @localstatedir@/run/dhcpd6.pid $DHCPDARGS -q $INTERFACES
+
+[Install]
+WantedBy=multi-user.target