aurora/build_scripts/base/02-install-common-kernel-akmods.sh
Philip Peterson e06d965f7d
All checks were successful
Build Aurora / build (push) Successful in 8m22s
arm64: a weekly emulated build, as aurora:stable-arm64
Upstream has no arm64 Aurora or akmods. A stand-in akmods image carries
Fedora's own aarch64 kernel (the one Kinoite ships) and no extra kmods;
buildah-arm64 makes `just build` target linux/arm64. Vendoring now copies
every architecture, and both builds prune their images when done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 18:04:15 -09:00

60 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/bash
echo "::group:: ===$(basename "$0")==="
set -eoux pipefail
KERNEL_PKGS_ORIG=(kernel kernel-{core,modules,modules-core,modules-extra,tools-libs,tools})
# removing them all at once is slower
for pkg in "${KERNEL_PKGS_ORIG[@]}"; do
rpm --erase "${pkg}" --nodeps
done
# cleanup leftovers that are not covered by kernel-* packages for some reason
rm -rf /usr/lib/modules
KERNEL_PKGS=(
/tmp/kernel-rpms/kernel-[0-9]*.rpm
/tmp/kernel-rpms/kernel-core-*.rpm
/tmp/kernel-rpms/kernel-modules-*.rpm
)
# Quine: arm64's stand-in akmods image (.forgejo/akmods-arm64.sh) has no
# kmods; without nullglob an unmatched pattern stays literal and fails dnf.
shopt -s nullglob
KMODS=(
/tmp/rpms/{common,kmods}/*xone*.rpm
/tmp/rpms/{common,kmods}/*v4l2loopback*.rpm
)
if [[ "${IMAGE_FLAVOR}" == "dx" ]]; then
KERNEL_PKGS+=(/tmp/kernel-rpms/kernel-devel-*.rpm)
fi
KERNEL_PKGS_ALL=( "${KERNEL_PKGS[@]}" "${KMODS[@]}" )
# shims to bypass kernel install triggering dracut/rpm-ostree
# this is really ugly, skipping scriplets might be not a good idea
cd /usr/lib/kernel/install.d \
&& mv 05-rpmostree.install 05-rpmostree.install.bak \
&& mv 50-dracut.install 50-dracut.install.bak \
&& printf '%s\n' '#!/bin/sh' 'exit 0' > 05-rpmostree.install \
&& printf '%s\n' '#!/bin/sh' 'exit 0' > 50-dracut.install \
&& chmod +x 05-rpmostree.install 50-dracut.install
dnf -y install "${KERNEL_PKGS_ALL[@]}"
# restore original kernel install
mv -f 05-rpmostree.install.bak 05-rpmostree.install \
&& mv -f 50-dracut.install.bak 50-dracut.install
cd -
KERNEL_VERSIONLOCK=( "${KERNEL_PKGS_ORIG[@]}" kernel-devel{-matched,} )
dnf versionlock add "${KERNEL_VERSIONLOCK[@]}"
mkdir -p /etc/pki/akmods/certs
ghcurl "https://github.com/ublue-os/akmods/raw/refs/heads/main/certs/public_key.der" --retry 3 -Lo /etc/pki/akmods/certs/akmods-ublue.der
echo "::endgroup::"