Skip to contentSkip to conversation

systemd: wrap mtime based time with packageconfig

PATCH Superseded Dan McGregor 1 participant 1 message Nov 19, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd: wrap mtime based time with packageconfig

From: Daniel McGregor <[email protected]>

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.

---
 meta/recipes-core/systemd/systemd_256.7.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/systemd/systemd_256.7.bb +3 -1
index 3831baa511b..37036e6fb3a 100644
@@ -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${libdir}/clock-epoch
+	fi
 }
 
 pkg_postinst:${PN}:libc-glibc () {
Signature · 1 line
2.47.0