diff options
Diffstat (limited to '.extras/image-builder/build-full-image.sh')
| -rwxr-xr-x | .extras/image-builder/build-full-image.sh | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/.extras/image-builder/build-full-image.sh b/.extras/image-builder/build-full-image.sh index 8c4476e..c5f1c36 100755 --- a/.extras/image-builder/build-full-image.sh +++ b/.extras/image-builder/build-full-image.sh @@ -91,6 +91,8 @@ needs_rebuild() { build_variant() { local VERSION="$1" + local REPO_KEY="slackware64-${VERSION}" + require_mount "${VERSION}" # NFS must be up: we serve it over HTTP below derive_tags "${VERSION}" _log "=== ${FULL_TAG} ===" @@ -110,14 +112,37 @@ build_variant() { local WORKDIR WORKDIR="$(mktemp -d /tmp/slackware-full.XXXXXX)" + + # Serve the NFS mirror over HTTP on the docker bridge for the duration of + # the build, so slackpkg in the build container fetches packages from LAN + # instead of the internet. Killed (with WORKDIR cleanup) on any exit. + local MIRROR_ROOT; MIRROR_ROOT="$(strip_scheme "$(mirror_path "${MIRROR}" "${REPO_KEY}")")" + [[ -f "${MIRROR_ROOT}/PACKAGES.TXT" ]] \ + || _err "mirror root has no PACKAGES.TXT: ${MIRROR_ROOT}" + python3 -m http.server "${HTTP_MIRROR_PORT}" \ + --bind "${HTTP_MIRROR_HOST}" --directory "${MIRROR_ROOT}" \ + >/dev/null 2>&1 & + local HTTP_PID=$! # shellcheck disable=SC2064 - trap "rm -rf '${WORKDIR}'" EXIT + trap "kill ${HTTP_PID} 2>/dev/null; rm -rf '${WORKDIR}'" EXIT + # Wait for the server to accept connections before building. + local i + for i in 1 2 3 4 5 6 7 8 9 10; do + curl -sf -o /dev/null "http://${HTTP_MIRROR_HOST}:${HTTP_MIRROR_PORT}/PACKAGES.TXT" && break + [[ $i -eq 10 ]] && _err "HTTP mirror did not come up on ${HTTP_MIRROR_HOST}:${HTTP_MIRROR_PORT}" + sleep 0.5 + done # Generate the Dockerfile for this variant cat > "${WORKDIR}/Dockerfile" <<DOCKERFILE FROM ${BASE_TAG} LABEL maintainer="Eric Hameleers <alien@slackware.com>" +# Import the Slackware GPG key against THIS mirror first: without it slackpkg +# cannot verify CHECKSUMS.md5 and silently installs almost nothing (only the +# packages already in base). 'yes YES |' answers the import prompt. +RUN yes YES | LC_ALL=C slackpkg -batch=on -default_answer=y update gpg + # Update the slackpkg package list before installing so that we always # get the versions current at build time, not the versions cached in the # base image. |
