Pull request #152: feat: set default time for initial startup

Merge in ICO/coreos from set_initial_time to master

* commit 'd37d5515f5b2d31b2875365dd724dd504e136a83':
  feat: set default time for initial startup
This commit is contained in:
Patrick Vogelaar 2024-01-11 14:56:46 +01:00
commit 027ffafd72
3 changed files with 29 additions and 3 deletions

View File

@ -13,6 +13,8 @@ addhandler check_coreos_sanity_eventhandler
check_coreos_sanity_eventhandler[eventmask] = "bb.event.SanityCheck"
python check_coreos_sanity_eventhandler() {
import datetime
# Checks related to the distribution configuration files
# ==========================================================================
@ -29,13 +31,22 @@ python check_coreos_sanity_eventhandler() {
"systemd is not set as `INIT_MANAGER`. "
"Using SystemD is mandatory on CoreOS based distribution"
)
if e.data.getVar("TCLIBC") != "glibc":
bb.fatal(
"glibc is not set as `TCLIBC`. "
"Using glibc is mandatory on CoreOS based distribution"
)
# Check if the timestamp for REPRODUCIBLE_TIMESTAMP_ROOTFS is still up to date
first_of_year = datetime.datetime(datetime.date.today().year, 1, 1, tzinfo=datetime.timezone.utc)
foy_ts = str(int(first_of_year.timestamp()))
if e.data.getVar("REPRODUCIBLE_TIMESTAMP_ROOTFS") != foy_ts:
bb.warn(
"`REPRODUCIBLE_TIMESTAMP_ROOTFS` outdated!"
"Set to current 01. january of the year."
)
# Checks related to the machine configuration files
# ==========================================================================
@ -47,7 +58,7 @@ python check_coreos_sanity_eventhandler() {
"CoreOS recommands to use compressed wic image, please add "
"`wic.xz` to your machine `IMAGE_FSTYPES` variables"
)
if not "wic.bmap":
bb.warn(
"wic image should be flashed with bmaptools, but this require "

View File

@ -7,3 +7,8 @@ MAINTAINER = "Belden CoreOS Team"
DISTRO_VERSION = "0.0.1"
DISTRO_CODENAME = "kirkstone"
# This TS represents 01.01.2024 generating it dynamically would cause a lot of
# things to get re-build, we need a good solution for this or change it every
# year
REPRODUCIBLE_TIMESTAMP_ROOTFS = "1704067200"

View File

@ -0,0 +1,10 @@
do_install:append(){
# the creation date/time of this file will be used as initial boot time.
# Creation time will be set to REPRODUCIBLE_TIMESTAMP_ROOTFS
# More info about the date/time handling here:
# https://www.freedesktop.org/software/systemd/man/latest/systemd-timesyncd.service.html
touch ${D}/${base_libdir}/clock-epoch
}
FILES:${PN} += "${base_libdir}/clock-epoch"