]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
kea: fix creating runtime directory in service files
authorYi Zhao <yi.zhao@windriver.com>
Mon, 12 Jan 2026 08:11:56 +0000 (16:11 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Jan 2026 22:46:04 +0000 (22:46 +0000)
Create runtime and state directories using RuntimeDirectory and
StateDirectory in systemd service files, rather than creating them via
ExecStartPre. This is a standard approach for systemd[1]. When the
server starts, systemd will automatically create these directories.

Also, add more configuration files to CONFFILES.

[1] https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#RuntimeDirectory=

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service
meta/recipes-connectivity/kea/files/kea-dhcp4.service
meta/recipes-connectivity/kea/files/kea-dhcp6.service
meta/recipes-connectivity/kea/kea_3.0.2.bb

index aec6446f0e82ba9b8e36a8f616945e874d25c824..feef7e0b6ee950561e8e9b651c4edf016d50c603 100644 (file)
@@ -5,8 +5,11 @@ After=network-online.target
 After=time-sync.target
 
 [Service]
-ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/run/kea/
-ExecStartPre=@BASE_BINDIR@/chmod 750 @LOCALSTATEDIR@/run/kea/
+RuntimeDirectory=kea
+RuntimeDirectoryMode=0750
+RuntimeDirectoryPreserve=yes
+StateDirectory=kea
+StateDirectoryMode=0750
 ExecStart=@SBINDIR@/kea-dhcp-ddns -c @SYSCONFDIR@/kea/kea-dhcp-ddns.conf
 
 [Install]
index a2ed4edb59e362e6d8eb4ea732a2c53859031b86..ce1256cf26da05eb37ee80ea2f00dbd7dd080a93 100644 (file)
@@ -5,9 +5,11 @@ After=network-online.target
 After=time-sync.target
 
 [Service]
-ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/run/kea/
-ExecStartPre=@BASE_BINDIR@/chmod 750 @LOCALSTATEDIR@/run/kea/
-ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/lib/kea
+RuntimeDirectory=kea
+RuntimeDirectoryMode=0750
+RuntimeDirectoryPreserve=yes
+StateDirectory=kea
+StateDirectoryMode=0750
 ExecStart=@SBINDIR@/kea-dhcp4 -c @SYSCONFDIR@/kea/kea-dhcp4.conf
 
 [Install]
index ed6e017d0c976a5f166d96720b2a04b6558a52e5..6123a8ad586296bb86974e1822382fefbcfc4bed 100644 (file)
@@ -5,9 +5,11 @@ After=network-online.target
 After=time-sync.target
 
 [Service]
-ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/run/kea/
-ExecStartPre=@BASE_BINDIR@/chmod 750 @LOCALSTATEDIR@/run/kea/
-ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/lib/kea
+RuntimeDirectory=kea
+RuntimeDirectoryMode=0750
+RuntimeDirectoryPreserve=yes
+StateDirectory=kea
+StateDirectoryMode=0750
 ExecStart=@SBINDIR@/kea-dhcp6 -c @SYSCONFDIR@/kea/kea-dhcp6.conf
 
 [Install]
index 30dfba07a287199a8e731c6c83620b161fd329b8..11e9bd13a2cbf1fa91a2cf500b475744dfddb13c 100644 (file)
@@ -76,13 +76,15 @@ do_install:append() {
            ${D}${sbindir}/kea-admin
     rm -rf ${D}${datadir}/${BPN}/meson-info
     rm -rf ${D}${runtimedir}
+    rm -rf ${D}${localstatedir}
 }
 
-do_install:append() {
-    rm -rf "${D}${localstatedir}"
-}
-
-CONFFILES:${PN} = "${sysconfdir}/kea/keactrl.conf"
+CONFFILES:${PN} = "${sysconfdir}/kea/keactrl.conf \
+                   ${sysconfdir}/kea/kea-ctrl-agent.conf \
+                   ${sysconfdir}/kea/kea-dhcp-ddns.conf \
+                   ${sysconfdir}/kea/kea-dhcp4.conf \
+                   ${sysconfdir}/kea/kea-dhcp6.conf \
+                  "
 
 PACKAGES =+ "${PN}-python"
 FILES:${PN}-python = "${nonarch_libdir}/python*/site-packages/*"