From 20b85fe8e279a29e3ae7c863f408eb94848587df Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Thu, 9 Mar 2023 09:22:52 -0600 Subject: [PATCH] Fix setting overlay directory timestamps Using `tar` to copy files and directories from the overlay directory to the destination root preserves their timestamps. This is not really desirable, particularly for directories, because it may result in the destination paths appearing older than the build. This is especially problematic for `/usr`, since its timestamps are important for systemd units that use `ConditionNeedsUpdate` settings. To ensure the timestamps are set correctly, we now use `rsync` to copy the overlay, with the `-O` (`--omit-dir-times`) argument, to avoid changing the timestamps of directories. Additionally, we explicitly update the timestamp of `/usr` to ensure that every new build triggers the "needs update" condition. --- build-rootfs.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-rootfs.sh b/build-rootfs.sh index 5703156..6976606 100755 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -53,8 +53,7 @@ while read name; do fi done < busybox.symlinks -tar -c -C overlay --owner=root --group=root . \ - | tar -x -C /mnt/gentoo +rsync -rltpDO overlay/ /mnt/gentoo/ cp -uv /usr/${target}/usr/bin/grub-editenv /mnt/gentoo/usr/bin/ @@ -104,3 +103,5 @@ setfiles \ -e /mnt/gentoo/etc/portage \ /mnt/gentoo/etc/selinux/strict/contexts/files/file_contexts \ /mnt/gentoo + +touch /mnt/gentoo/usr