forked from QubesOS/qubes-linux-template-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_template_rpm
executable file
·57 lines (48 loc) · 1.52 KB
/
build_template_rpm
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
#!/bin/sh
NAME=$1
set -e
if [ "${VERBOSE:-0}" -ge 2 ] || [ "${DEBUG:-0}" -eq 1 ]; then
set -x
fi
if [ -z "$NAME" ] ; then
echo "usage $0 <template_name>"
exit 1
fi
trap "rm -rf appmenus-$$ appmenus template.conf" EXIT
# handle appmenus whitelists from DispVM build
if [ -d "qubeized_images/$NAME/untrusted_appmenus" ]; then
srcdir="qubeized_images/$NAME/untrusted_appmenus"
mkdir -p appmenus-$$
rm -f appmenus
ln -s appmenus-$$ appmenus
for f in whitelisted-appmenus.list vm-whitelisted-appmenus.list netvm-whitelisted-appmenus.list; do
grep '^[a-zA-Z0-9.()_-]\+.desktop$' "$srcdir/$f" > appmenus/$f
done
fi
# handle template.conf from DispVM build
if [ -r "qubeized_images/$NAME/template.conf" ]; then
rm -f template.conf
ln -s qubeized_images/$NAME/template.conf template.conf
fi
# Default compression format for binary payloads
# It applies for Fedora < 31
COMPRESSION=w2.xzdio
if [ -n "$DIST_DOM0" ]; then
if [ "${DIST_DOM0#fc}" != "${DIST_DOM0}" ]; then
DIST_VER="${DIST_DOM0#fc}"
fi
if [ "${DIST_VER}" -ge 31 ]; then
COMPRESSION=w19.zstdio
fi
fi
rpmbuild --target noarch \
--define "template_name $NAME" \
--define "DIST $DIST" \
--define "_topdir $PWD/rpmbuild" \
--define "_tmppath $PWD/rpmbuild/tmp" \
--define "_source_payload $COMPRESSION" \
--define "_binary_payload $COMPRESSION" \
-bb templates.spec
if [ "0$DISCARD_PREPARED_IMAGE" -eq "1" ]; then
rm -rf "qubeized_images/$NAME"
fi