]> git.ipfire.org Git - thirdparty/systemd.git/blob - mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.prepare
docs/RANDOM_SEEDS: update NetBSD link
[thirdparty/systemd.git] / mkosi.images / system / mkosi.conf.d / 10-opensuse / mkosi.prepare
1 #!/bin/bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -e
4
5 if [ "$1" = "build" ]; then
6 exit 0
7 fi
8
9 # shellcheck source=/dev/null
10 . "$BUILDROOT/usr/lib/os-release"
11 ID="${ID%-*}"
12
13 if [ ! -f "pkg/$ID/systemd.spec" ]; then
14 echo "spec not found at pkg/$ID/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2
15 exit 1
16 fi
17
18 for DEPS in --requires --buildrequires; do
19 mkosi-chroot \
20 rpmspec \
21 --with upstream \
22 --query \
23 "$DEPS" \
24 --define "_topdir /var/tmp" \
25 --define "_sourcedir pkg/$ID" \
26 "pkg/$ID/systemd.spec" |
27 grep --invert-match --regexp systemd --regexp /bin/sh --regexp "rpmlib(" --regexp udev |
28 sort --unique |
29 tee /tmp/buildrequires |
30 xargs --delimiter '\n' mkosi-install
31 done
32
33 until mkosi-chroot \
34 rpmbuild \
35 -bd \
36 --build-in-place \
37 --with upstream \
38 --define "_topdir /var/tmp" \
39 --define "_sourcedir pkg/$ID" \
40 --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
41 "pkg/$ID/systemd.spec"
42 do
43 EXIT_STATUS=$?
44 if [ $EXIT_STATUS -ne 11 ]; then
45 exit $EXIT_STATUS
46 fi
47
48 mkosi-chroot \
49 rpm \
50 --query \
51 --package \
52 --requires \
53 /var/tmp/SRPMS/systemd-*.buildreqs.nosrc.rpm |
54 grep --invert-match '^rpmlib(' |
55 sort --unique >/tmp/dynamic-buildrequires
56
57 sort /tmp/buildrequires /tmp/dynamic-buildrequires |
58 uniq --unique |
59 tee --append /tmp/buildrequires |
60 xargs --delimiter '\n' mkosi-install
61 done