diff --git a/bootstrap.sh b/bootstrap.sh index dc6a161..6a199b9 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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,