]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd: wrap mtime based time with packageconfig
authorDaniel McGregor <daniel.mcgregor@vecima.com>
Tue, 19 Nov 2024 17:51:06 +0000 (11:51 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 Nov 2024 12:14:20 +0000 (12:14 +0000)
Recently the systemd recipe grew support for setting the epoch time
at image build time. Unfortunately this is unconditional, and our
use case for the set-time-epoch PACKAGECONFIG is we have a system
requirement that our product boot with the time set to the UNIX
epoch.

Instead of trying to complicate things with either an image hook or
overriding the systemd recipe, just make setting the epoch at image
time optional, with the same PACKAGECONFIG that controls hardcoding
the systemd build time as the default epoch.

Signed-off-by: Daniel McGregor <daniel.mcgregor@vecima.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd_256.7.bb

index 3831baa511b786a5582d9fd493fba875589f9442..8b7ed2efe2349d4bc54fa5fbbb32cfd2d438200d 100644 (file)
@@ -870,7 +870,9 @@ ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
 ALTERNATIVE_PRIORITY[runlevel] ?= "300"
 
 pkg_postinst:${PN}:append () {
-       touch $D${libdir}/clock-epoch
+       if ${@bb.utils.contains('PACKAGECONFIG', 'set-time-epoch', 'true', 'false', d)}; then
+               touch $D${nonarch_libdir}/clock-epoch
+       fi
 }
 
 pkg_postinst:${PN}:libc-glibc () {