ptrcports/alpine/ptrc-build/build

48 lines
894 B
Text
Raw Normal View History

2022-04-27 23:32:43 +00:00
#!/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
2022-04-27 23:32:43 +00:00
arch=$(apk --print-arch)
pub() {
mosquitto_pub -h mqtt.torastian.com \
2022-04-29 01:28:02 +00:00
-u "$MQTT_BUILD_USER" \
-p 8883 \
-P "$MQTT_BUILD_PASSWORD" \
-t build/$arch \
--tls-version tlsv1.3 \
-m "$1"
2022-04-27 23:32:43 +00:00
}
echopub() {
echo "$1"
pub "$1"
}
2022-04-27 23:32:43 +00:00
echopub "pulling git"
2022-04-27 23:32:43 +00:00
cd "$HOME/ptrcports"
git fetch --all
git reset --hard origin/master
echopub "running pre-upgrade"
doas apk upgrade -Ua
echopub "building"
2022-04-27 23:32:43 +00:00
nice -n 10 buildrepo \
--aports "$HOME" \
--destdir /var/www/repo.ptrc.pl \
--logdir "$HOME/logs" \
--purge ptrcports | while read -r line; do
2022-04-27 23:32:43 +00:00
echo "$line"
echo "$line" | grep -q 'ptrcports/' && pub "$line"
done
echopub "running post-upgrade"
doas apk upgrade -Ua
echopub "idle"