blob: 05c3f54b143446d6fed5d07cbf62a41a70de1a88 (
plain)
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
|
#!/bin/bash
test -f /etc/aurbuilder/config && source /etc/aurbuilder/config
PODMAN=$(which podman)
CONFFILE=${CONFFILE:-/etc/aurbuilder/packages}
OUTPUT=${OUTPUT:-/srv/pkg/}
FORCE_REBUILD=${FORCE_REBUILD:-no}
CHOWN_TO=${CHOWN_TO:-$USER}
PACKAGER=${PACKAGER:-"John Doe <John.Doe@example.com>"}
if ! ($PODMAN image list | grep aurbuilder > /dev/null); then
echo Container image \"aurbuilder\" was not found. Was it built?
exit 1
fi
ERROR=0
ERR_PKGS=()
while read -r LINE; do
[[ $LINE == \#* ]] && continue
echo ""
echo "BUILDING $LINE"
echo "======================="
echo ""
echo ""
CONT_NAME="aurbuilder-$RANDOM"
$PODMAN run --userns=host --name "$CONT_NAME" \
--env PACKAGE_NAME="$LINE" \
--env FORCE_REBUILD="$FORCE_REBUILD" \
--env CHOWN="$(id -u "$CHOWN_TO"):$(id -g "$CHOWN_TO")" \
--env PACKAGER="$PACKAGER" \
-v "$OUTPUT:/pkgout:z" \
aurbuilder
RET=$?
$PODMAN rm "$CONT_NAME"
if [ "$RET" -ne 0 ]; then
ERROR=1
ERR_PKGS+=("$LINE")
fi
done < "$CONFFILE"
if [ "$ERROR" -ne 0 ]; then
echo There were Errors while building following packages: "${ERR_PKGS[@]}"
exit 1
fi
|