From 711a8aa94879c027f7f596452bab1b64586975ac Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Tue, 15 Mar 2022 12:39:55 -0500 Subject: [PATCH] rootfs: Update clock epoch at build time If systemd detects that the system clock is not correct, it sets it to a "known good" time based on the release date of its version. Since this can still be weeks or months in the past, it will use the timestamp of the `/usr/lib/clock-epoch` file, if it exists, as the reference time. To get our system clock closer to the correct time earlier in the boot process, we update the `clock-epoch` file's timestamp during build. This will cause the clock to be set to approximately the build time of the root filesystem image. Presumably, the rootfs image is built relatively frequently, so the time should be a lot closer to correct than the systemd release date. --- rootfs/post-build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rootfs/post-build.sh b/rootfs/post-build.sh index c372ca7..9f7dfae 100755 --- a/rootfs/post-build.sh +++ b/rootfs/post-build.sh @@ -2,3 +2,5 @@ cp -puv "${BUILD_DIR}"/nbd-*/systemd/nbd@.service \ "${TARGET_DIR}"/usr/lib/systemd/system/ + +touch "${TARGET_DIR}"/usr/lib/clock-epoch