refactor: repurpose build.sh as build preparation (#2701)

* refactor: repurpose build.sh as build preparation

It currently does too many things, let's split it up. This needs to be
done as we want to move away from a system that copies (also overrides)
files from fedora RPMs and then may remove said rpms, resulting in
removing our changes, which of course defeats the entire point.

A disadvantage this has is that we need to be more mindful and
disciplined of when things are needed during the build. Currently we
actually do not need any system_files we copy in the stage where we are
installing packages/have network access.

If we do at some point we will probably either inline files in
build-prep.sh or have a 2nd directory with files strictly needed for the
build.

This is why we can copy all the files to the system after that, just
before systemd units get activated, initramfs gets generated, general
things we can do offline after we have installed packages are done.

Resolves: https://github.com/ublue-os/aurora/issues/2687

* remove useless comment

* same treatment for DX

* remove unused DX specific version logic

We don't use this, we have branches now.

* move sysctl before docker install
This commit is contained in:
renner 2026-08-09 21:11:44 +02:00 committed by GitHub
parent 552c0bf31b
commit 14900734d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 74 additions and 89 deletions

View file

@ -31,7 +31,6 @@ COPY --from=common /wallpapers /system_files/shared
# /* https://github.com/ublue-os/brew */
COPY --from=brew /system_files /system_files/shared
# /* Overwrite files from common if necessary */
COPY /system_files /system_files
# /* aurora image section */
@ -51,7 +50,6 @@ ARG IMAGE_FLAVOR=""
# /* so ghcurl wrapper is available to all later RUNs */
ENV PATH="/tmp/scripts/helpers:${PATH}"
# /* Copy files from common/from system_files */
# /* Install Packages, miscellaneous things that need a network */
# /* aurora:latest no zfs or nvidia */
@ -64,7 +62,7 @@ RUN --mount=type=tmpfs,dst=/boot \
--mount=type=bind,from=akmods,src=/rpms/common,dst=/tmp/rpms/common \
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
--mount=type=secret,id=GITHUB_TOKEN \
/ctx/build_scripts/shared/build.sh && \
/ctx/build_scripts/shared/build-prep.sh && \
/ctx/build_scripts/base/01-packages.sh && \
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
/ctx/build_scripts/base/03-fetch.sh
@ -81,7 +79,7 @@ RUN --mount=type=tmpfs,dst=/boot \
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
--mount=type=bind,from=akmods-zfs,src=/rpms/kmods/zfs,dst=/tmp/rpms/kmods/zfs \
--mount=type=secret,id=GITHUB_TOKEN \
/ctx/build_scripts/shared/build.sh && \
/ctx/build_scripts/shared/build-prep.sh && \
/ctx/build_scripts/base/01-packages.sh && \
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
/ctx/build_scripts/base/zfs.sh && \
@ -99,7 +97,7 @@ RUN --mount=type=tmpfs,dst=/boot \
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
--mount=type=bind,from=akmods-nvidia-open,src=/rpms,dst=/tmp/rpms/nvidia \
--mount=type=secret,id=GITHUB_TOKEN \
/ctx/build_scripts/shared/build.sh && \
/ctx/build_scripts/shared/build-prep.sh && \
/ctx/build_scripts/base/01-packages.sh && \
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
/ctx/build_scripts/base/03-fetch.sh && \
@ -118,7 +116,7 @@ RUN --mount=type=tmpfs,dst=/boot \
--mount=type=bind,from=akmods-nvidia-open,src=/rpms,dst=/tmp/rpms/nvidia \
--mount=type=bind,from=akmods-zfs,src=/rpms/kmods/zfs,dst=/tmp/rpms/kmods/zfs \
--mount=type=secret,id=GITHUB_TOKEN \
/ctx/build_scripts/shared/build.sh && \
/ctx/build_scripts/shared/build-prep.sh && \
/ctx/build_scripts/base/01-packages.sh && \
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
/ctx/build_scripts/base/03-fetch.sh && \
@ -136,6 +134,7 @@ RUN --network=none \
/ctx/build_scripts/base/19-initramfs.sh && \
/ctx/build_scripts/shared/validate-repos.sh && \
/ctx/build_scripts/shared/clean-stage.sh && \
/ctx/build_scripts/shared/chunkah-xattr.sh && \
/ctx/build_scripts/base/20-tests.sh
CMD ["/sbin/init"]

View file

@ -218,4 +218,9 @@ if [[ "${IMAGE_FLAVOR}" == "dx" ]]; then
/ctx/build_scripts/dx/00-dx.sh
fi
# Keep *-logos in RPM DB for downstream package installations
# We are not allowed to ship an empty fedora-logos package
dnf -y swap fedora-logos generic-logos
rpm --erase --nodeps --nodb generic-logos
echo "::endgroup::"

View file

@ -10,10 +10,9 @@ curl --retry 3 -Lo /etc/flatpak/remotes.d/flathub.flatpakrepo https://dl.flathub
# Offline Aurora documentation
ghcurl "https://github.com/ublue-os/aurora-docs/releases/download/0.1/aurora.pdf" --retry 3 -o /tmp/aurora.pdf
install -Dm0644 -t /usr/share/doc/aurora/ /tmp/aurora.pdf
setfattr -n user.component -v "aurora-offline-docs" /usr/share/doc/aurora/aurora.pdf
cp /usr/share/applications/dev.getaurora.offline-docs.desktop /usr/share/kglobalaccel/
# Weekly user count for fastfetch
mkdir -p /usr/share/ublue-os
ghcurl https://raw.githubusercontent.com/ublue-os/countme/main/badge-endpoints/aurora.json | jq -r ".message" > /usr/share/ublue-os/fastfetch-user-count
# bazaar weekly downloads used for fastfetch
@ -27,19 +26,15 @@ ghcurl "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/NerdFon
unzip /tmp/nerdfontsymbols.zip -d /tmp
mkdir -p /usr/share/fonts/nerd-fonts/NerdFontsSymbolsOnly/
mv /tmp/SymbolsNerdFont*.ttf /usr/share/fonts/nerd-fonts/NerdFontsSymbolsOnly/
setfattr -n user.component -v "nerdfonts" /usr/share/fonts/nerd-fonts/NerdFontsSymbolsOnly
setfattr -n user.update-interval -v "yearly" /usr/share/fonts/nerd-fonts/NerdFontsSymbolsOnly
# Bash Preexec v0.6.0
ghcurl https://raw.githubusercontent.com/rcaloras/bash-preexec/b73ed5f7f953207b958f15b1773721dded697ac3/bash-preexec.sh --retry 3 -Lo /usr/share/bash-preexec
setfattr -n user.component -v "aurora-config" /usr/share/bash-preexec
# use CoreOS' generator for emergency/rescue boot
# see detail: https://github.com/ublue-os/main/issues/653
mkdir -p /usr/lib/systemd/system-generators
ghcurl "https://raw.githubusercontent.com/coreos/fedora-coreos-config/refs/heads/stable/overlay.d/05core/usr/lib/systemd/system-generators/coreos-sulogin-force-generator" --retry 3 -Lo /usr/lib/systemd/system-generators/coreos-sulogin-force-generator
chmod +x /usr/lib/systemd/system-generators/coreos-sulogin-force-generator
setfattr -n user.component -v "aurora-config" /usr/lib/systemd/system-generators/coreos-sulogin-force-generator
echo "::endgroup::"

View file

@ -4,6 +4,9 @@ echo "::group:: ===$(basename "$0")==="
set -eoux pipefail
# Copy Files to Container
rsync -rvKl /ctx/system_files/shared/ /
# Footgun, See: https://github.com/ublue-os/main/issues/598
rm -f /usr/bin/chsh /usr/bin/lchsh
@ -17,10 +20,6 @@ ln -s "/usr/share/fonts/google-noto-sans-cjk-fonts" "/usr/share/fonts/noto-cjk"
# KDE Documentation is available online
rm -rf /usr/share/doc/HTML
# ######
# BASE IMAGE CHANGES
# ######
rm -f /usr/lib64/qt6/plugins/kf6/krunner/krunner_appstream.so
# Use Bazaar for Flatpak refs
@ -38,4 +37,7 @@ setsebool -P samba_export_all_ro=1
setsebool -P samba_export_all_rw=1
sed -i '/^\[homes\]/,/^\[/{/^\[homes\]/d;/^\[/!d}' /etc/samba/smb.conf
# So we can bind offline docs to a shortcut
cp /usr/share/applications/dev.getaurora.offline-docs.desktop /usr/share/kglobalaccel/
echo "::endgroup::"

View file

@ -4,6 +4,9 @@ echo "::group:: ===$(basename "$0")==="
set -ouex pipefail
# Apply IP Forwarding before installing Docker to prevent messing with LXC networking
sysctl -p
# Load secure COPR helpers
# shellcheck source=build_scripts/shared/copr-helpers.sh
source /ctx/build_scripts/shared/copr-helpers.sh
@ -105,13 +108,6 @@ copr_install_isolated "ublue-os/packages" "ublue-os-libvirt-workarounds"
# DX packages to exclude - common to all versions
EXCLUDED_PACKAGES=()
# Version-specific package exclusions for DX
case "$FEDORA_MAJOR_VERSION" in
43)
EXCLUDED_PACKAGES+=()
;;
esac
# Remove excluded packages if they are installed
if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
readarray -t INSTALLED_EXCLUDED < <(rpm -qa --queryformat='%{NAME}\n' "${EXCLUDED_PACKAGES[@]}" 2>/dev/null || true)
@ -122,6 +118,20 @@ if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
fi
fi
rsync -rvK /ctx/system_files/dx/ /
# Load iptable_nat module for docker-in-docker.
# See:
# - https://github.com/ublue-os/bluefin/issues/2365
# - https://github.com/devcontainers/features/issues/1235
mkdir -p /etc/modules-load.d
tee /etc/modules-load.d/ip_tables.conf <<EOF
iptable_nat
EOF
# Branding Changes
echo "Variant=Developer Experience" >> /usr/share/kde-settings/kde-profile/default/xdg/kcm-about-distrorc
# Enable DX services
if rpm -q docker-ce >/dev/null; then
systemctl enable docker.socket

View file

@ -1,25 +0,0 @@
#!/usr/bin/bash
set -xeou pipefail
echo "::group:: Copy Files"
# Copy Files to Image
rsync -rvK /ctx/system_files/dx/ /
echo "::endgroup::"
# Apply IP Forwarding before installing Docker to prevent messing with LXC networking
sysctl -p
# Load iptable_nat module for docker-in-docker.
# See:
# - https://github.com/ublue-os/bluefin/issues/2365
# - https://github.com/devcontainers/features/issues/1235
mkdir -p /etc/modules-load.d
tee /etc/modules-load.d/ip_tables.conf <<EOF
iptable_nat
EOF
# Branding Changes
echo "Variant=Developer Experience" >> /usr/share/kde-settings/kde-profile/default/xdg/kcm-about-distrorc

View file

@ -0,0 +1,14 @@
# This script should generally set up the build so we can move on to start installing packages
#!/usr/bin/bash
set -eoux pipefail
# Speeds up local builds and workaround network flakes, mainly for COPR and negativo
cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf.bak
dnf config-manager setopt keepcache=1 timeout=60
mkdir -p /tmp/scripts/helpers
install -Dm0755 /ctx/build_scripts/shared/utils/ghcurl /tmp/scripts/helpers/ghcurl
echo "::endgroup::"

View file

@ -1,41 +0,0 @@
#!/usr/bin/bash
set -eoux pipefail
echo "::group:: Copy Files"
# Speeds up local builds and workaround network flakes, mainly for COPR and negativo
cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf.bak
dnf config-manager setopt keepcache=1 timeout=60
# We need to remove this package here because lots of files we add from `{projectbluefin,get-aurora-dev}/common` override the rpm files
# they go away when you do dnf remove
# Keep *-logos in RPM DB for downstream package installations
# We are not allowed to ship an empty fedora-logos package
dnf -y swap fedora-logos generic-logos
rpm --erase --nodeps --nodb generic-logos
# Copy Files to Container
rsync -rvKl /ctx/system_files/shared/ /
setfattr -n user.component -v "aurora-wallpapers" /usr/share/backgrounds/aurora
setfattr -n user.update-interval -v "monthly" /usr/share/backgrounds/aurora
setfattr -n user.component -v "aurora-assets" /usr/share/plasma/avatars/{echo,lumina,scope,tina,vincent}.png
setfattr -n user.component -v "aurora-assets" /etc/bazaar/*.jxl
setfattr -n user.update-interval -v "quarterly" /etc/bazaar/*.jxl
setfattr -n user.component -v "aurora-plasma-theme" /usr/share/plasma/look-and-feel/dev.getaurora.aurora{,light}.desktop
setfattr -n user.update-interval -v "quarterly" /usr/share/plasma/look-and-feel/dev.getaurora.aurora{,light}.desktop
setfattr -n user.component -v "aurora-config" /usr/share/ublue-os
setfattr -n user.component -v "homebrew" /usr/share/homebrew.tar.zst
if [[ "${IMAGE_FLAVOR}" == "dx" ]]; then
/ctx/build_scripts/shared/build-dx.sh
fi
mkdir -p /tmp/scripts/helpers
install -Dm0755 /ctx/build_scripts/shared/utils/ghcurl /tmp/scripts/helpers/ghcurl
echo "::endgroup::"

View file

@ -0,0 +1,26 @@
# See: https://github.com/coreos/chunkah#customizing-the-layers
#!/usr/bin/env bash
set -eoux pipefail
setfattr -n user.component -v "aurora-wallpapers" /usr/share/backgrounds/aurora
setfattr -n user.update-interval -v "monthly" /usr/share/backgrounds/aurora
setfattr -n user.component -v "aurora-assets" /usr/share/plasma/avatars/{echo,lumina,scope,tina,vincent}.png
setfattr -n user.component -v "aurora-assets" /etc/bazaar/*.jxl
setfattr -n user.update-interval -v "quarterly" /etc/bazaar/*.jxl
setfattr -n user.component -v "aurora-plasma-theme" /usr/share/plasma/look-and-feel/dev.getaurora.aurora{,light}.desktop
setfattr -n user.update-interval -v "quarterly" /usr/share/plasma/look-and-feel/dev.getaurora.aurora{,light}.desktop
setfattr -n user.component -v "aurora-config" /usr/share/ublue-os
setfattr -n user.component -v "homebrew" /usr/share/homebrew.tar.zst
setfattr -n user.component -v "aurora-offline-docs" /usr/share/doc/aurora/aurora.pdf
setfattr -n user.component -v "nerdfonts" /usr/share/fonts/nerd-fonts/NerdFontsSymbolsOnly
setfattr -n user.update-interval -v "yearly" /usr/share/fonts/nerd-fonts/NerdFontsSymbolsOnly
setfattr -n user.component -v "aurora-config" /usr/lib/systemd/system-generators/coreos-sulogin-force-generator
setfattr -n user.component -v "aurora-config" /usr/share/bash-preexec