Use Arch Linux Archive Snapshot for Image Builds

This is the second PR to fix the issue i am assigned to. It depends on the first PR at kde linux packages.

(Closes #148)
This commit is contained in:
Hadi Chokr
2025-04-30 07:47:10 +00:00
committed by Harald Sitter
parent 701766e7aa
commit eef2c1ac6f

View File

@@ -37,19 +37,22 @@ EOF
cp /etc/pacman.conf mkosi.sandbox/etc
if [ ! -f mkosi.sandbox/etc/pacman.d/mirrorlist ]; then
# Insert a fallback for starters
# shellcheck disable=SC2016
echo 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist
# Then use fastest servers we can find
pacman --sync --refresh --noconfirm reflector
reflector --protocol https --country ${MIRRORS_COUNTRY:-de} --score 10 --fastest 3 >mkosi.sandbox/etc/pacman.d/mirrorlist
# Ensure the packages repo and the base image do not go out of sync
# by using the same snapshot date from build_date.txt for both
BUILD_DATE=$(curl --fail --silent https://cdn.kde.org/kde-linux/packaging/build_date.txt)
if [ -z "$BUILD_DATE" ]; then
echo "ERROR: Could not fetch build_date.txt — refusing to build out-of-sync image." >&2
exit 1
fi
PARALLEL_DOWNLOADS=${PARALLEL_DOWNLOADS:-5}
mkdir -p mkosi.sandbox/etc/pacman.d
echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE}/\$repo/os/\$arch" > mkosi.sandbox/etc/pacman.d/mirrorlist
# Copy same mirrorlist into the system so pacman operates in sync
cp mkosi.sandbox/etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist
# enable parallel downloads for m0ar speed!
sed -i 's/#*\(ParallelDownloads =\) .*/\1 '"${PARALLEL_DOWNLOADS}"'/' mkosi.sandbox/etc/pacman.conf
# ParallelDownloads is enabled by default since pacman 7.0.0.r6.gc685ae6-2,
# so no need to uncomment or manually set it unless we want to change the value.
# Update the system and install packages we'll need for building KDE Linux.
# Even though we use mkosi from Git, we'll grab the package,