#!/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 build \
-p 8883 \
-P "$MQTT_BUILD_PASSWORD" \
-t build/$arch \
--tls-version tlsv1.3 \
-m "$1"
}
echo "pulling git"
pub "pulling git"
cd "$HOME/ptrcports"
git fetch --all
git reset --hard origin/master
nice -n 10 buildrepo \
-a "$HOME" \
-d /var/www/repo.ptrc.pl \
-l "$HOME/logs" \
-p ptrcports | while read -r line; do
echo "$line"
echo "$line" | grep -q 'ptrcports/' && pub "$line"
done
echo "idle"
pub "idle"