builder/entrypoint.sh

88 lines
2.3 KiB
Bash
Raw Normal View History

2023-03-27 04:28:02 +02:00
#!/bin/sh
set -u
set -e
2023-03-27 07:15:54 +02:00
set -v
2023-03-27 04:28:02 +02:00
sudo pacman-key --init
# Pull Repo
## Needed so pacman doesnt complain.
repo-add "/repo/${AUR_REPO_NAME}.db.tar.xz"
2023-03-27 04:53:33 +02:00
sudo pacman -Syu --noconfirm minio-client pacman-contrib
2023-03-27 04:28:02 +02:00
mcli alias set s3 https://s3.tobiasmanske.de $REPO_ACCESS_KEY $REPO_SECRET_KEY
2023-03-27 07:15:54 +02:00
mcli cp s3/repo/x86_64/rad4day.db.tar.xz /repo/rad4day.db.tar.xz
mcli cp s3/repo/x86_64/rad4day.files.tar.xz /repo/rad4day.files.tar.xz
2023-03-27 04:28:02 +02:00
2023-03-27 07:15:54 +02:00
mcli cp s3/repo/x86_64/rad4day.db.tar.xz.sig /repo/rad4day.db.tar.xz.sig
mcli cp s3/repo/x86_64/rad4day.files.tar.xz.sig /repo/rad4day.files.tar.xz.sig
2023-03-27 04:28:02 +02:00
if ! (aur repo > /dev/null 2>&1); then
printf "Aur repo not initialized, initializing /repo...\n"
repo-add "/repo/${AUR_REPO_NAME}.db.tar.xz"
fi
# Keyring Signing Key
sudo pacman-key --add trustroot.asc
gpg --import --batch trustroot.asc
sudo pacman-key --lsign 10BE06BC275CE0E17373B368F67996C486D1B56B
2023-03-27 07:15:54 +02:00
# repoctl conf new "$(readlink -f \"/repo/${AUR_REPO_NAME}.db.tar.xz\")"
2023-03-27 04:28:02 +02:00
# Setup signing
echo "$BUILD_GPG_KEY" | base64 -d | gpg --import --batch
echo "C3FE87CFB8F8D503AE03EC1C033E7F3DC71FE89E:6:" | gpg --import-ownertrust --batch
sudo pacman --noconfirm -Sy archlinux-keyring
sudo pacman --noconfirm -Syu
git clone --recursive https://git.tobiasmanske.de/archlinux-repo/package_sources.git packages
cd packages
2023-03-27 07:15:54 +02:00
touch buildqueue
## OBTAIN PACKAGES TO BUILD
2023-03-27 04:28:02 +02:00
git submodule update --remote --merge # Make sure we are up to date if something is linked as a submodule
2023-03-27 04:52:34 +02:00
#
# Rebuild all git packages
2023-03-27 07:15:54 +02:00
aur repo --list
aur repo --list | awk '{print $1}' | grep -e "-git$" | aur fetch -
2023-03-27 04:28:02 +02:00
find . -name PKGBUILD -execdir sh -c 'makepkg --printsrcinfo > .SRCINFO' \;
2023-03-27 07:15:54 +02:00
find . -iname PKGBUILD -exec dirname {} \; | aur srcver - > vcs
aur repo --list | aur vercmp -q -p vcs | tee -a buildqueue
aur repo --list | aur vercmp -q | tee -a buildqueue | aur fetch - # pull outdated packages
# Build all packages defined in buildqueue
while read -r i; do
cat "$i"/.SRCINFO
done < buildqueue | aur graph | tsort | tac > queue
2023-03-27 04:28:02 +02:00
echo
echo QUEUE
echo
cat queue
2023-03-27 07:15:54 +02:00
## BUILD
2023-03-27 04:28:02 +02:00
aur build -S --noconfirm -a queue --no-sync --margs -s
# build all packages defined in our repo
#paclist custom | awk '{print $1}' | xargs -r aur sync --noconfirm
aur sync -u -S --noview --noconfirm
## Upload to repo
mcli mirror --overwrite /repo s3/repo/x86_64
exec "$@"