64 lines
1.4 KiB
Bash
64 lines
1.4 KiB
Bash
#!/bin/sh
|
|
|
|
target=aarch64-unknown-linux-gnu
|
|
|
|
MIRROR=http://mirror.leaseweb.com/gentoo
|
|
URLPATH=releases/amd64/autobuilds
|
|
GENTOO_KEY=13EBBDBEDE7A12775DFDB1BABB572E0E2D182910
|
|
GENTOO_KEYSERVER=hkps://keys.gentoo.org
|
|
|
|
target=aarch64-unknown-linux-gnu
|
|
stage3=amd64-nomultilib-openrc
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-t|--target)
|
|
shift
|
|
target="$1"
|
|
;;
|
|
-b|--base)
|
|
shift
|
|
stage3="$1"
|
|
;;
|
|
*)
|
|
printf 'Unknown argument: %s\n' "$1" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
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 "${MIRROR}/${URLPATH}/${tarball}"
|
|
fi
|
|
if [ ! -f "${tarball##*/}.asc" ]; then
|
|
curl -fLO "${MIRROR}/${URLPATH}/${tarball}.asc"
|
|
fi
|
|
gpg --verify "${tarball##*/}.asc"
|
|
|
|
cid=$(buildah from scratch)
|
|
buildah add ${cid} "${tarball##*/}"
|
|
buildah run \
|
|
--mount type=cache,target=/var/db/repos/gentoo \
|
|
--mount type=cache,target=/var/cache\
|
|
-- ${cid} \
|
|
sh -s - "${target}" \
|
|
< build.sh \
|
|
|| {
|
|
rc=$?
|
|
buildah rm ${cid}
|
|
exit $rc
|
|
}
|
|
|
|
buildah config \
|
|
--add-history \
|
|
--cmd /bin/bash \
|
|
--label target=${target} \
|
|
${cid}
|
|
buildah commit --rm --squash ${cid} aimee-os.org/build/cross-${target}
|