-
Notifications
You must be signed in to change notification settings - Fork 1
/
arm-image-buildscript
executable file
·78 lines (59 loc) · 1.29 KB
/
arm-image-buildscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set -e
set -x
declare -a errors
DISTS='sid trixie bookworm'
ARCHS='armhf arm64'
SDIR=$1
test -d "$SDIR"
TDIR=$2
test -d "$TDIR"
mv -v "$SDIR"/arm-queue2/* "$TDIR"/ || true
for DIST in $DISTS; do
for QF in "$TDIR"/*."$DIST"; do
test -f "$QF" || continue
URL=$(<"$QF")
FN=$(basename "$QF")
for ARCH in $ARCHS; do
IMAGE=~/var/cache/pbuilder/debian-$DIST-$ARCH.tar.zst
BUILDDIR=~/tmp/build.$RANDOM
OUTPUTDIR=~/tmp/artefacts.$RANDOM
mkdir "$BUILDDIR"
mkdir "$OUTPUTDIR"
cd "$BUILDDIR"
zstdcat "$IMAGE" | tar -xv
mkdir build
cd build
dget --allow-unauthenticated "$URL"
set +e
LOGFILE=build.log.$$."$DIST"-"$ARCH"
echo debuild \*.dsc > script
sudo chroot . bash script > ../../"$LOGFILE" 2>&1
CODE=$?
set -e
cd .
cd ..
rm -rf "$BUILDDIR"
if test "$CODE" -eq 0; then
MVDIR="$SDIR"/arm-results/.results.$RANDOM
mkdir "$MVDIR"
mv -v "$OUTPUTDIR"/* "$MVDIR"
mv -v "$MVDIR" "$SDIR"/arm-results/results."$FN".$RANDOM."$DIST"
rmdir "$OUTPUTDIR"
rm -f "$LOGFILE"
else
echo build failed
echo build log: "$LOGFILE"
mv "$LOGFILE" ~/
errors+=("build failed: $LOGFILE")
fi
done
rm -f "$QF"
done
done
if test ${#errors[@]} -gt 0; then
echo errors:
echo "${errors[@]}"
exit 1
fi
exit 0