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"
|
|
|
|
|
2022-04-28 00:12:28 +00:00
|
|
|
. /etc/ptrc-build.conf
|
|
|
|
|
2022-04-27 23:32:43 +00:00
|
|
|
arch=$(apk --print-arch)
|
|
|
|
|
|
|
|
pub() {
|
2022-04-28 00:12:28 +00:00
|
|
|
mosquitto_pub -h mqtt.torastian.com \
|
2022-04-29 01:28:02 +00:00
|
|
|
-u "$MQTT_BUILD_USER" \
|
2022-04-28 00:12:28 +00:00
|
|
|
-p 8883 \
|
|
|
|
-P "$MQTT_BUILD_PASSWORD" \
|
|
|
|
-t build/$arch \
|
|
|
|
--tls-version tlsv1.3 \
|
|
|
|
-m "$1"
|
2022-04-27 23:32:43 +00:00
|
|
|
}
|
|
|
|
|
2022-04-28 00:40:58 +00:00
|
|
|
echopub() {
|
|
|
|
echo "$1"
|
|
|
|
pub "$1"
|
|
|
|
}
|
2022-04-27 23:32:43 +00:00
|
|
|
|
2022-04-28 00:40:58 +00:00
|
|
|
echopub "pulling git"
|
2022-04-27 23:32:43 +00:00
|
|
|
cd "$HOME/ptrcports"
|
|
|
|
git fetch --all
|
|
|
|
git reset --hard origin/master
|
|
|
|
|
2022-04-28 00:40:58 +00:00
|
|
|
echopub "running pre-upgrade"
|
|
|
|
doas apk upgrade -Ua
|
|
|
|
|
|
|
|
echopub "building"
|
2022-04-27 23:32:43 +00:00
|
|
|
nice -n 10 buildrepo \
|
2022-04-28 00:40:58 +00:00
|
|
|
--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
|
|
|
|
|
2022-04-28 00:40:58 +00:00
|
|
|
echopub "running post-upgrade"
|
|
|
|
doas apk upgrade -Ua
|
|
|
|
|
|
|
|
echopub "idle"
|