This repository has been archived on 2025-09-06. You can view files and clone it, but cannot push or open issues/pull-requests.
container-images/stage3-image.sh

38 lines
1.0 KiB
Bash

#!/bin/sh
SELF=$(readlink -f "$0")
SRCDIR=${SELF%/*}
. "${SRCDIR}"/common.sh
: "${GENTOO_MIRROR:=http://mirror.leaseweb.com/gentoo}"
URLPATH=releases/amd64/autobuilds
GENTOO_KEY=13EBBDBEDE7A12775DFDB1BABB572E0E2D182910
GENTOO_KEYSERVER=hkps://keys.gentoo.org
stage3="${1:-amd64-nomultilib-openrc}"
set -e
gpg --keyserver ${GENTOO_KEYSERVER} --recv-keys ${GENTOO_KEY}
curl -fLO "${MIRROR}/${URLPATH}/latest-stage3-${stage3}.txt"
gpg --verify "latest-stage3-${stage3}.txt"
tarball=$(gpg --decrypt "latest-stage3-${stage3}.txt" | awk '$1!="#"{print $1}')
if [ ! -f "${tarball##*/}" ]; then
curl -fLO "${GENTOO_MIRROR}/${URLPATH}/${tarball}"
fi
if [ ! -f "${tarball##*/}.asc" ]; then
curl -fLO "${GENTOO_MIRROR}/${URLPATH}/${tarball}.asc"
fi
gpg --verify "${tarball##*/}.asc"
cid=$(buildah from scratch)
buildah add ${cid} "${tarball##*/}"
buildah_run_script ${cid} sync.sh
buildah_run_script ${cid} update.sh
buildah config \
--add-history \
--cmd /bin/bash \
${cid}
buildah commit --rm --squash ${cid} "aimee-os.org/gentoo/stage3-${stage3}"