> -----Original Message-----
> From: [email protected] <openembedded-
> [email protected]> On Behalf Of "Gaël PORTAY
> Sent: den 21 oktober 2024 19:02
> To: Alexander Kanavin <[email protected]>;
> [email protected]
> Cc: [email protected]
> Subject: Re: [OE-core] [PATCH] classes: rootfs-postcommands: set better
> sane time to systemd
>
> Hello Alex,
>
> On Mon Oct 21, 2024 at 12:25 PM CEST, Alexander Kanavin wrote:
> > Can this be done from systemd recipe itself? Items in
> > rootfs-postprocess list should not be recipe-specific.
> >
>
> Sure it could be done in the recipe itself ;) but...
>
> The recipe harcodes already a sane value at configure time thanks to the
> meson option -Dtime-epoch and the environment variable $SOURCE_DATE_EPOC
> (or the date the creation of the latest git-tag or the modification time
> of the NEWS file). systemd sets the date somewhere in 2022 (kirkstone).
>
> I have created a rootfs-postcommand to be able to set a better time **at
> image creation** to keep the systemd package untouched (not rebuilt) by
> updateing the variable $REPRODUCIBLE_TIMESTAMP_ROOTFS.
Can't you add a pkg_postinst:${PN} function to the systemd recipe and that
way do it in the recipe while stile executing it at image creation time?
>
> That variable is suffixed by _ROOTFS; and I guess that variable **SHOULD
> NOT** be used by package recipes.
>
> The rootfs_systemd_timestamp() is based on rootfs_update_timestamp(); it
> touches the file and it leaves the file empty.
>
> Also, to decrease the systemd-specific thing, I wonder if this is
> acceptable:
>
> rootfs_update_timestamp () {
> if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
> # Convert UTC into %4Y%2m%2d%2H%2M%2S
> sformatted=`date -u -d
> @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
> else
> sformatted=`date -u +%4Y%2m%2d%2H%2M%2S`
> fi
> echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp
> bbnote "rootfs_update_timestamp: set /etc/timestamp to
> $sformatted"
> +
> + if [ -x /lib/systemd/systemd ]; then
Umm, why are you looking at the host's files?
> + if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
> + # Convert UTC into %4Y%2m%2d%2H%2M.%2S
> + sformatted=`date -u -d
> @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M.%2S`
> + else
> + sformatted=`date -u +%4Y%2m%2d%2H%2M.%2S`
> + fi
> + touch -m -t "$sformatted"
> ${IMAGE_ROOTFS}/usr/lib/clock-epoch
> + bbnote "rootfs_systemd_timestamp: set /usr/lib/clock-epoch
> mtime to $sformatted"
> + }
> }
>
> Or, linking the file instead:
>
> rootfs_update_timestamp () {
> if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
> # Convert UTC into %4Y%2m%2d%2H%2M%2S
> sformatted=`date -u -d
> @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
> else
> sformatted=`date -u +%4Y%2m%2d%2H%2M%2S`
> fi
> echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp
> bbnote "rootfs_update_timestamp: set /etc/timestamp to
> $sformatted"
> +
> + if [ -x /lib/systemd/systemd ]; then
> + ln -sf /etc/timestamp /usr/lib/clock-epoch
This too is trying to create a link in the host's filesystem.
> + }
> }
>
> Does it look better for you?
>
> > Alex
> >
>
> Regards,
> Gaël
//Peter
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206171):
https://lists.openembedded.org/g/openembedded-core/message/206171
Mute This Topic: https://lists.openembedded.org/mt/109095282/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-