Skip to contentSkip to conversation

rootfs-postcommands: generate /var/lib/systemd/clock

PATCH In review Jan Remmet 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Jan Remmet

author
#0 lore raw

PATCH 1/1 rootfs-postcommands: generate /var/lib/systemd/clock

systemd timesyncd check /var/lib/systemd/clock instead of /etc/timestamp.
If this file is missing it defaults to TIME_EPOCH. It's set while configuring systemd.

---
 meta/classes/rootfs-postcommands.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/rootfs-postcommands.bbclass +6 -0
index db8b551..0c7b764 100644
@@ -234,6 +234,12 @@ python write_image_manifest () {
 # sane default time setting
 rootfs_update_timestamp () {
 	date -u +%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
+
+	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+		# touch needs timestamp as [[CC]YY]MMDDhhmm[.ss]
+		TS=$(sed 's/[.]*/&./13' ${IMAGE_ROOTFS}/etc/timestamp)
+		touch -t $TS ${IMAGE_ROOTFS}/var/lib/systemd/clock
+	fi
 }
 
 # Prevent X from being started
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Jan Remmet

systemd timesyncd check /var/lib/systemd/clock instead of /etc/timestamp.
If this file is missing it defaults to TIME_EPOCH. It's set while configuring systemd.

Wrong ML, re-send to openembedded-core

Quoted 31 lines
---
 meta/classes/rootfs-postcommands.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/rootfs-postcommands.bbclass +6 -0
index db8b551..0c7b764 100644
@@ -234,6 +234,12 @@ python write_image_manifest () {
 # sane default time setting
 rootfs_update_timestamp () {
 	date -u +%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
+
+	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+		# touch needs timestamp as [[CC]YY]MMDDhhmm[.ss]
+		TS=$(sed 's/[.]*/&./13' ${IMAGE_ROOTFS}/etc/timestamp)
+		touch -t $TS ${IMAGE_ROOTFS}/var/lib/systemd/clock
+	fi
 }
 
 # Prevent X from being started
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#2 lore raw
Quoted 7 lines · Martin Jansa
Quoted 4 lines · Jan Remmet

systemd timesyncd check /var/lib/systemd/clock instead of /etc/timestamp.
If this file is missing it defaults to TIME_EPOCH. It's set while configuring systemd.

Wrong ML, re-send to openembedded-core

Thanks,

Jan

Quoted 42 lines
Quoted 31 lines
---
 meta/classes/rootfs-postcommands.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/rootfs-postcommands.bbclass +6 -0
index db8b551..0c7b764 100644
@@ -234,6 +234,12 @@ python write_image_manifest () {
 # sane default time setting
 rootfs_update_timestamp () {
 	date -u +%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
+
+	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+		# touch needs timestamp as [[CC]YY]MMDDhhmm[.ss]
+		TS=$(sed 's/[.]*/&./13' ${IMAGE_ROOTFS}/etc/timestamp)
+		touch -t $TS ${IMAGE_ROOTFS}/var/lib/systemd/clock
+	fi
 }
 
 # Prevent X from being started
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 9 lines
Martin 'JaMa' Jansa     jabber: [email protected]



-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel