public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 1/3 V3] kea: fix creating runtime directory in service files
@ 2026-01-12  8:11 Yi Zhao
  2026-01-12  8:11 ` [PATCH 2/3 V3] kea: replace keactrl with kea daemons in initscripts Yi Zhao
  2026-01-12  8:11 ` [PATCH 3/3 V3] kea: remove keactrl from package Yi Zhao
  0 siblings, 2 replies; 3+ messages in thread
From: Yi Zhao @ 2026-01-12  8:11 UTC (permalink / raw)
  To: openembedded-core

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>
---
V3 Change: update commit log

 .../kea/files/kea-dhcp-ddns.service                  |  7 +++++--
 .../recipes-connectivity/kea/files/kea-dhcp4.service |  8 +++++---
 .../recipes-connectivity/kea/files/kea-dhcp6.service |  8 +++++---
 meta/recipes-connectivity/kea/kea_3.0.2.bb           | 12 +++++++-----
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service b/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service
index aec6446f0e..feef7e0b6e 100644
--- a/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service
+++ b/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service
@@ -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]
diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp4.service b/meta/recipes-connectivity/kea/files/kea-dhcp4.service
index a2ed4edb59..ce1256cf26 100644
--- a/meta/recipes-connectivity/kea/files/kea-dhcp4.service
+++ b/meta/recipes-connectivity/kea/files/kea-dhcp4.service
@@ -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]
diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp6.service b/meta/recipes-connectivity/kea/files/kea-dhcp6.service
index ed6e017d0c..6123a8ad58 100644
--- a/meta/recipes-connectivity/kea/files/kea-dhcp6.service
+++ b/meta/recipes-connectivity/kea/files/kea-dhcp6.service
@@ -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]
diff --git a/meta/recipes-connectivity/kea/kea_3.0.2.bb b/meta/recipes-connectivity/kea/kea_3.0.2.bb
index 30dfba07a2..11e9bd13a2 100644
--- a/meta/recipes-connectivity/kea/kea_3.0.2.bb
+++ b/meta/recipes-connectivity/kea/kea_3.0.2.bb
@@ -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/*"
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-12  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12  8:11 [PATCH 1/3 V3] kea: fix creating runtime directory in service files Yi Zhao
2026-01-12  8:11 ` [PATCH 2/3 V3] kea: replace keactrl with kea daemons in initscripts Yi Zhao
2026-01-12  8:11 ` [PATCH 3/3 V3] kea: remove keactrl from package Yi Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox