gentoo-builder/entrypoint.sh

49 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
die() {
echo $* >&2
exit 1
}
set -e
if [ ! -r /var/lib/catalyst/store/builds/default/stage3-amd64-latest.tar.xz ]
then
# Get latest stage3 tag
STAGE3_TAG=$(wget -q -O - \
http://distfiles.gentoo.org/releases/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 /var/lib/catalyst/store/builds/default/stage3-amd64-latest.tar.xz
wget -q -N -P /var/lib/catalyst/store/builds/ \
http://distfiles.gentoo.org/releases/amd64/autobuilds/${STAGE3_TAG}.CONTENTS \
-O /var/lib/catalyst/store/builds/default/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 /var/lib/catalyst/store/builds/default/stage3-amd64-latest.tar.xz.DIGESTS
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
# Build stage1 snapshot
catalyst -c /var/lib/catalyst/catalyst.conf -f /stage1.spec $*
# Build stage2 snapshot
catalyst -c /var/lib/catalyst/catalyst.conf -f /stage2.spec $*
# Cleanup stage3 package cache
#rm -Rf /var/lib/catalyst/store/packages/default/stage3-amd64/*
# Build stage3 snapshot
catalyst -c /var/lib/catalyst/catalyst.conf -f /stage3.spec $*
# Build custom packages
catalyst -c /var/lib/catalyst/catalyst.conf -f /var/lib/catalyst/stage4.spec $*