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.
master
Dustin 2023-03-09 09:22:52 -06:00
parent 9bdf0fbfd0
commit 20b85fe8e2
1 changed files with 3 additions and 2 deletions

View File

@ -53,8 +53,7 @@ while read name; do
fi fi
done < busybox.symlinks done < busybox.symlinks
tar -c -C overlay --owner=root --group=root . \ rsync -rltpDO overlay/ /mnt/gentoo/
| tar -x -C /mnt/gentoo
cp -uv /usr/${target}/usr/bin/grub-editenv /mnt/gentoo/usr/bin/ cp -uv /usr/${target}/usr/bin/grub-editenv /mnt/gentoo/usr/bin/
@ -104,3 +103,5 @@ setfiles \
-e /mnt/gentoo/etc/portage \ -e /mnt/gentoo/etc/portage \
/mnt/gentoo/etc/selinux/strict/contexts/files/file_contexts \ /mnt/gentoo/etc/selinux/strict/contexts/files/file_contexts \
/mnt/gentoo /mnt/gentoo
touch /mnt/gentoo/usr