On Thu, Dec 18, 2025 at 11:39 AM Yi Zhao via lists.openembedded.org <[email protected]> wrote: > > Use volatile files to create runtime directories, instead of creating > them in systemd unit/initscript files. > > Signed-off-by: Yi Zhao <[email protected]> > --- > .../kea/files/kea-dhcp-ddns.service | 2 - > .../kea/files/kea-dhcp4.service | 3 -- > .../kea/files/kea-dhcp6.service | 3 -- > .../kea/files/kea.tmpfiles | 2 + > .../kea/files/kea.volatiles | 2 + > meta/recipes-connectivity/kea/kea_3.0.1.bb | 43 +++++++++++++------ > 6 files changed, 34 insertions(+), 21 deletions(-) > create mode 100644 meta/recipes-connectivity/kea/files/kea.tmpfiles > create mode 100644 meta/recipes-connectivity/kea/files/kea.volatiles > > diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service > b/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service > index aec6446f0e..fe09ef6437 100644 > --- a/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service > +++ b/meta/recipes-connectivity/kea/files/kea-dhcp-ddns.service > @@ -5,8 +5,6 @@ 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/ > 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..a48a230654 100644 > --- a/meta/recipes-connectivity/kea/files/kea-dhcp4.service > +++ b/meta/recipes-connectivity/kea/files/kea-dhcp4.service > @@ -5,9 +5,6 @@ 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 > 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..a441df9ad2 100644 > --- a/meta/recipes-connectivity/kea/files/kea-dhcp6.service > +++ b/meta/recipes-connectivity/kea/files/kea-dhcp6.service > @@ -5,9 +5,6 @@ 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 > ExecStart=@SBINDIR@/kea-dhcp6 -c @SYSCONFDIR@/kea/kea-dhcp6.conf > > [Install] > diff --git a/meta/recipes-connectivity/kea/files/kea.tmpfiles > b/meta/recipes-connectivity/kea/files/kea.tmpfiles > new file mode 100644 > index 0000000000..5da74be3a6 > --- /dev/null > +++ b/meta/recipes-connectivity/kea/files/kea.tmpfiles > @@ -0,0 +1,2 @@ > +d /run/kea 0750 root root - > +d /var/lib/kea 0644 root root -
I think it'd be better if we add StateDirectory and RuntimeDirectory to the service file if the lifetime of directory is tied to the unit: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#RuntimeDirectory= Debian also does something similar. > diff --git a/meta/recipes-connectivity/kea/files/kea.volatiles > b/meta/recipes-connectivity/kea/files/kea.volatiles > new file mode 100644 > index 0000000000..d0350e38a6 > --- /dev/null > +++ b/meta/recipes-connectivity/kea/files/kea.volatiles > @@ -0,0 +1,2 @@ > +d root root 0750 /var/run/kea none > +d root root 0644 /var/lib/kea none > diff --git a/meta/recipes-connectivity/kea/kea_3.0.1.bb > b/meta/recipes-connectivity/kea/kea_3.0.1.bb > index 8729b1162e..5c46498d5b 100644 > --- a/meta/recipes-connectivity/kea/kea_3.0.1.bb > +++ b/meta/recipes-connectivity/kea/kea_3.0.1.bb > @@ -14,6 +14,8 @@ SRC_URI = "http://ftp.isc.org/isc/kea/${PV}/${BP}.tar.xz \ > file://kea-dhcp4-server \ > file://kea-dhcp6-server \ > file://kea-dhcp-ddns-server \ > + file://kea.volatiles \ > + file://kea.tmpfiles \ > file://fix-multilib-conflict.patch \ > file://fix_pid_keactrl.patch \ > > file://0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch \ > @@ -61,26 +63,41 @@ do_compile:prepend:class-target() { > } > > do_install:append() { > - install -d ${D}${sysconfdir}/init.d > - install -d ${D}${systemd_system_unitdir} > - > - install -m 0644 ${UNPACKDIR}/kea-dhcp*service > ${D}${systemd_system_unitdir} > - install -m 0755 ${UNPACKDIR}/kea-*-server ${D}${sysconfdir}/init.d > - sed -i -e 's,@SBINDIR@,${sbindir},g' -e > 's,@BASE_BINDIR@,${base_bindir},g' \ > - -e 's,@LOCALSTATEDIR@,${localstatedir},g' -e > 's,@SYSCONFDIR@,${sysconfdir},g' \ > - ${D}${systemd_system_unitdir}/kea-dhcp*service > ${D}${sbindir}/keactrl > + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', > d)}; then > + install -d ${D}${sysconfdir}/init.d > + install -d ${D}/${sysconfdir}/default/volatiles > + > + install -m 0755 ${UNPACKDIR}/kea-*-server ${D}${sysconfdir}/init.d > + install -m 0644 ${UNPACKDIR}/kea.volatiles > ${D}/${sysconfdir}/default/volatiles/99_kea > + fi > + > + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', > d)}; then > + install -d ${D}${systemd_system_unitdir} > + install -d ${D}${sysconfdir}/tmpfiles.d > + > + install -m 0644 ${UNPACKDIR}/kea-dhcp*service > ${D}${systemd_system_unitdir} > + install -m 0644 ${UNPACKDIR}/kea.tmpfiles > ${D}/${sysconfdir}/tmpfiles.d/kea.conf > + > + sed -i -e 's,@SBINDIR@,${sbindir},g' -e > 's,@BASE_BINDIR@,${base_bindir},g' \ > + -e 's,@LOCALSTATEDIR@,${localstatedir},g' -e > 's,@SYSCONFDIR@,${sysconfdir},g' \ > + ${D}${systemd_system_unitdir}/kea-dhcp*service > + fi > + > sed -i -e "s:${B}:@abs_top_builddir_placeholder@:g" \ > -e "s:${S}:@abs_top_srcdir_placeholder@:g" \ > ${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 > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#228088): https://lists.openembedded.org/g/openembedded-core/message/228088 Mute This Topic: https://lists.openembedded.org/mt/116837599/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
