Fix: use builder's own mirror for mkimage, not dl-cdn

Root cause of linux-lts pin failure: mkimage was using dl-cdn.alpinelinux.org
while the builder uses mirrors.hosterion.ro — different mirrors can have different
package availability at any given moment.

Now mkimage reads repositories directly from /etc/apk/repositories on the builder,
ensuring both module build and ISO package install use the same mirror.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-07 11:22:31 +03:00
parent cdc2996cd3
commit ac6aeefa1a

View File

@@ -115,22 +115,20 @@ echo ""
echo "=== building NVIDIA ${NVIDIA_DRIVER_VERSION} modules ==="
sh "${BUILDER_DIR}/build-nvidia-module.sh" "${NVIDIA_DRIVER_VERSION}" "${DIST_DIR}" "${KERNEL_PKG_VERSION}"
# Determine kernel version from installed headers (must match KERNEL_PKG_VERSION)
# Determine kernel version from installed headers
KVER=$(ls /usr/src/ 2>/dev/null | grep '^linux-headers-' | sed 's/linux-headers-//' | sort -V | tail -1)
# Build-time verification: ensure modules were compiled for the pinned kernel version.
# KERNEL_PKG_VERSION is like "6.12.76-r0"; KVER is like "6.12.76-0-lts".
# Extract numeric part from both and compare.
# Build-time verification: headers must match the repo version we detected.
PINNED_KVER="$(echo "${KERNEL_PKG_VERSION}" | sed 's/-r[0-9]*//')"
RUNNING_KVER="$(echo "${KVER}" | sed 's/-[0-9]*-lts//')"
if [ "${PINNED_KVER}" != "${RUNNING_KVER}" ]; then
echo "ERROR: kernel version mismatch!"
echo " VERSIONS pins: ${KERNEL_PKG_VERSION} (numeric: ${PINNED_KVER})"
echo " Repo version: ${KERNEL_PKG_VERSION} (numeric: ${PINNED_KVER})"
echo " Installed headers: ${KVER} (numeric: ${RUNNING_KVER})"
echo " Update KERNEL_PKG_VERSION in iso/builder/VERSIONS to match installed headers."
echo " This should not happen — apk should have installed the repo version."
exit 1
fi
echo "=== kernel version OK: ${KVER} matches pin ${KERNEL_PKG_VERSION} ==="
echo "=== kernel version OK: ${KVER} ==="
NVIDIA_CACHE="${DIST_DIR}/nvidia-${NVIDIA_DRIVER_VERSION}-${KVER}"
@@ -201,8 +199,8 @@ sh /usr/share/aports/scripts/mkimage.sh \
--tag "v${ALPINE_VERSION}" \
--outdir "${DIST_DIR}" \
--arch x86_64 \
--repository "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" \
--repository "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" \
--repository "$(sed -n '2p' /etc/apk/repositories)" \
--repository "$(sed -n '3p' /etc/apk/repositories)" \
--workdir /var/tmp/bee-iso-work \
--profile bee