From 5526d4900ae1cc66b7e4023100c55a957cae71ec Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Mon, 11 Nov 2019 17:05:28 +0100 Subject: [PATCH] Improve stage3 download process. --- entrypoint.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1d4ac5a..b1f8827 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,33 +7,30 @@ die() { set -e -BUILDDIR=/var/lib/catalyst/store/builds/default +BUILD_DIR=/var/lib/catalyst/store/builds/default +RELEASE_BASE_URI=https://gentoo.osuosl.org/releases -if [ ! -r ${BUILDDIR}/stage3-amd64-latest.tar.xz ] \ - && [ ! -r ${BUILDDIR}/stage3-amd64-latest.tar.bz2 ] +if [ ! -r ${BUILD_DIR}/stage3-amd64-latest.tar.xz ] \ + && [ ! -r ${BUILD_DIR}/stage3-amd64-latest.tar.bz2 ] then # Get latest stage3 tag STAGE3_TAG=$(wget -q -O - \ - http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64.txt \ + ${RELEASE_BASE_URI}/amd64/autobuilds/latest-stage3-amd64.txt \ | grep -v "^#" | cut -d ' ' -f 1) # Download latest stable stage3 build - wget -q -N -P /var/lib/catalyst/store/builds/ \ - http://distfiles.gentoo.org/releases/amd64/autobuilds/${STAGE3_TAG} \ - -O ${BUILDDIR}/stage3-amd64-latest.tar.xz + for SUFFIX in "" ".CONTENTS" ".DIGESTS"; do + wget -q -N -P ${BUILD_DIR} \ + ${RELEASE_BASE_URI}/amd64/autobuilds/${STAGE3_TAG}${SUFFIX} - wget -q -N -P /var/lib/catalyst/store/builds/ \ - http://distfiles.gentoo.org/releases/amd64/autobuilds/${STAGE3_TAG}.CONTENTS \ - -O ${BUILDDIR}/stage3-amd64-latest.tar.xz.CONTENTS - - wget -q -N -P /var/lib/catalyst/store/builds/ \ - http://distfiles.gentoo.org/releases/amd64/autobuilds/${STAGE3_TAG}.DIGESTS \ - -O ${BUILDDIR}/stage3-amd64-latest.tar.xz.DIGESTS + ln -sf "${BUILDDIR}/$(basename ${STAGE3_TAG})${SUFFIX}" \ + "${BUILDDIR}/stage3-amd64-latest.tar.xz${SUFFIX}" + done fi # Download latest portage snapshot wget -q -N -P /var/lib/catalyst/store/snapshots/ \ - https://gentoo.osuosl.org/releases/snapshots/current/portage-latest.tar.bz2 + ${RELEASE_BASE_URI}/snapshots/current/portage-latest.tar.bz2 # Build stage1 snapshot catalyst -c /catalyst.conf -f /stage1.spec -p $*