On Fri, 2020-09-04 at 09:08 +0200, Rasmus Villemoes wrote: > Not every image necessarily wants a timestamp file,
Wouldn't you just not have rootfs_update_timestamp in ROOTFS_POSTPROCESS_COMMAND in that case? > and even if it does, it's possible to create filesystem images that do not > have a > /etc directory or where some other location for the file is more > appropriate. So add a ROOTFS_TIMESTAMP_FILE variable weakly defaulting > to /etc/timestamp - setting that to the empty string opts out of > creating the timestamp file. > > I wasn't sure whether to spell /etc as ${sysconfdir}, but chose /etc > to stay completely backwards compatible. > > Signed-off-by: Rasmus Villemoes <rasmus.villem...@prevas.dk> > --- > meta/classes/rootfs-postcommands.bbclass | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/meta/classes/rootfs-postcommands.bbclass > b/meta/classes/rootfs-postcommands.bbclass > index 984730ebe8..cf54f22566 100644 > --- a/meta/classes/rootfs-postcommands.bbclass > +++ b/meta/classes/rootfs-postcommands.bbclass > @@ -12,6 +12,7 @@ ROOTFS_POSTPROCESS_COMMAND += > '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'deb > ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ > 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}' > > # Create /etc/timestamp during image construction to give a reasonably sane > default time setting > +ROOTFS_TIMESTAMP_FILE ??= "/etc/timestamp" > ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp; " > > # Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is > enabled > @@ -275,14 +276,18 @@ python write_image_manifest () { > # Can be used to create /etc/timestamp during image construction to give a > reasonably > # sane default time setting > rootfs_update_timestamp () { > + if [ -z "${ROOTFS_TIMESTAMP_FILE}" ]; then > + return > + fi > 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" > + mkdir -p $(dirname ${IMAGE_ROOTFS}${ROOTFS_TIMESTAMP_FILE}) > + echo $sformatted > ${IMAGE_ROOTFS}${ROOTFS_TIMESTAMP_FILE} > + bbnote "rootfs_update_timestamp: set ${ROOTFS_TIMESTAMP_FILE} to > $sformatted" > } > > # Prevent X from being started I have a feeling there are other consumers of this file which would also need to be changed to reference ROOTFS_TIMESTAMP_FILE? Cheers, Richard
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#142184): https://lists.openembedded.org/g/openembedded-core/message/142184 Mute This Topic: https://lists.openembedded.org/mt/76624850/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-