This repository has been archived on 2023-01-08. You can view files and clone it, but cannot push or open issues or pull requests.
ptrcports/ptrc-build/build
2022-04-29 03:28:02 +02:00

47 lines
894 B
Bash

#!/bin/sh
# workaround for /sbin being missing sometimes, which causes all abuild operations
# to fail silently since apk is not in path
export PATH="/usr/bin:/usr/sbin:/bin:/sbin"
. /etc/ptrc-build.conf
arch=$(apk --print-arch)
pub() {
mosquitto_pub -h mqtt.torastian.com \
-u "$MQTT_BUILD_USER" \
-p 8883 \
-P "$MQTT_BUILD_PASSWORD" \
-t build/$arch \
--tls-version tlsv1.3 \
-m "$1"
}
echopub() {
echo "$1"
pub "$1"
}
echopub "pulling git"
cd "$HOME/ptrcports"
git fetch --all
git reset --hard origin/master
echopub "running pre-upgrade"
doas apk upgrade -Ua
echopub "building"
nice -n 10 buildrepo \
--aports "$HOME" \
--destdir /var/www/repo.ptrc.pl \
--logdir "$HOME/logs" \
--purge ptrcports | while read -r line; do
echo "$line"
echo "$line" | grep -q 'ptrcports/' && pub "$line"
done
echopub "running post-upgrade"
doas apk upgrade -Ua
echopub "idle"