aurora/build_scripts/shared/unpackaged.sh
renner 3ef1256cd3
feat: timestamp all files with epoch 0 (#3028)
* feat: timestamp all files with epoch 0

We have been using this chunkah feature [1] to put non-rpm content like
the brew tarball in dedicated layers, we didn't actually save any
bandwith on downloads with this as the copying sets the file
modification and access time. Which makes it non-reproducible and every
single update would re-download everything not in RPMs.

This should make updates smaller especially noticeable on daily/multiple
daily image builds. I'm not sure how much of a positive effect this is
gonna have on the stable weekly images as the brew tarball is refreshed
weekly. Things like the wallpapers should at least no longer be
downloaded when they haven't changed. There are still some files we
could do but I think it's mostly not worth it.

xref: https://github.com/ublue-os/aurora/issues/2579

[1] https://github.com/coreos/chunkah#customizing-the-layers

* typo

Co-authored-by: Adam Fidel <ledif@users.noreply.github.com>

---------

Co-authored-by: Adam Fidel <ledif@users.noreply.github.com>
2026-10-16 07:11:44 +00:00

56 lines
2.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# See: https://github.com/coreos/chunkah#customizing-the-layers
echo "::group:: ===$(basename "$0")==="
set -eoux pipefail
HOMEBREW_TARBALL=/usr/share/homebrew.tar.zst
setfattr -n user.component -v "homebrew" "${HOMEBREW_TARBALL}"
# rpm-ostree creates tmpfiles from packages having owned files in /{var,run}
RPM_OSTREE_TMPFILES=/usr/lib/rpm-ostree/tmpfiles.d
setfattr -n user.component -v "rpm-ostree-tmpfiles.d" "${RPM_OSTREE_TMPFILES}"
# vibes, shouldn't change super often
setfattr -n user.update-interval -v "quarterly" "${RPM_OSTREE_TMPFILES}"
FONTCONFIG_CACHE=/usr/lib/fontconfig/cache
setfattr -n user.component -v "fontconfig-cache" "${FONTCONFIG_CACHE}"
# also vibes, no idea how often this changes, but it seems to change often
setfattr -n user.update-interval -v "daily" "${FONTCONFIG_CACHE}"
WALLPAPERS=/usr/share/backgrounds/aurora
setfattr -n user.component -v "aurora-wallpapers" "${WALLPAPERS}"
setfattr -n user.update-interval -v "monthly" "${WALLPAPERS}"
AURORA_CHARS=(/usr/share/plasma/avatars/{echo,lumina,scope,tina,vincent}.png)
setfattr -n user.component -v "aurora-assets" "${AURORA_CHARS[@]}"
BAZAAR=(/etc/bazaar/*.jxl)
setfattr -n user.component -v "aurora-assets" "${BAZAAR[@]}"
setfattr -n user.update-interval -v "quarterly" "${BAZAAR[@]}"
AURORA_DOCS_PDF="/usr/share/doc/aurora/aurora.pdf"
setfattr -n user.component -v "aurora-offline-docs" "${AURORA_DOCS_PDF}"
# TODO: everything else we can probably add here
FRAMEWORK_ICC=(/usr/share/color/icc/colord/framework1{3,6}.icc)
setfattr -n user.component -v "never-change" "${FRAMEWORK_ICC[@]}"
setfattr -n user.update-interval -v "yearly" "${FRAMEWORK_ICC[@]}"
# This is absolutely nasty, ideally we'd use SOURCE_DATE_EPOCH=0 on chunkah for
# all the touch invocations but this (potentially) affects the layer plan
# negatively
# See: https://github.com/coreos/chunkah/issues/160
#
# on the composefs backend this also makes it so that bootc (uupd notification)
# flags the image as outdated with label org.opencontainers.image.created and
# ".Created" (it's set to 1970 after all) this doesn't happen on ostree
# https://github.com/bootc-dev/bootc/issues/2227
# This shouldn't hurt anything, Epoch 0 is what RPMs are using, we don't want to override that
find /usr /etc /opt -exec touch -h -a -m -d '1970-01-01T00:00:00Z' {} +
# getfattr -R -d /usr 2> /dev/null || true
# getfattr -R -d /etc 2> /dev/null || true
echo "::endgroup::"