]>
Commit | Line | Data |
---|---|---|
7629744a | 1 | #!/bin/sh |
2 | set -ex | |
1b0ff615 LP |
3 | |
4 | # This file is part of systemd. | |
5 | # | |
6 | # Copyright 2016 Lennart Poettering | |
7 | # | |
8 | # systemd is free software; you can redistribute it and/or modify it | |
9 | # under the terms of the GNU Lesser General Public License as published by | |
10 | # the Free Software Foundation; either version 2.1 of the License, or | |
11 | # (at your option) any later version. | |
12 | # | |
13 | # systemd is distributed in the hope that it will be useful, but | |
14 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | # Lesser General Public License for more details. | |
17 | # | |
18 | # You should have received a copy of the GNU Lesser General Public License | |
19 | # along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | # This is a build script for OS image generation using mkosi (https://github.com/systemd/mkosi). | |
22 | # Simply invoke "mkosi" in the project directory to build an OS image. | |
23 | ||
70e760e3 LP |
24 | # If mkosi.builddir/ exists mkosi will set $BUILDDIR to it, let's then use it |
25 | # as out-of-tree build dir. Otherwise, let's make up our own builddir. | |
26 | [ -z "$BUILDDIR" ] && BUILDDIR=build | |
27 | ||
474cca49 | 28 | export LC_CTYPE=en_US.UTF-8 |
9400405b | 29 | |
c81a2569 LP |
30 | if [ ! -f "$BUILDDIR"/build.ninja ] ; then |
31 | sysvinit_path=`realpath /etc/init.d` | |
8da0592c | 32 | |
c81a2569 LP |
33 | nobody_user=`id -u -n 65534 2> /dev/null` |
34 | if [ "$nobody_user" != "" ] ; then | |
35 | # Validate that we can translate forth and back | |
36 | if [ "`id -u $nobody_user`" != 65534 ] ; then | |
37 | nobody_user="" | |
38 | fi | |
c82ce4f2 | 39 | fi |
c81a2569 LP |
40 | if [ "$nobody_user" = "" ] ; then |
41 | if id -u nobody 2> /dev/null ; then | |
42 | # The "nobody" user is defined already for something else, pick the Fedora name | |
43 | nobody_user=nfsnobody | |
44 | else | |
45 | # The "nobody" user name is free, use it | |
46 | nobody_user=nobody | |
47 | fi | |
c82ce4f2 | 48 | fi |
c82ce4f2 | 49 | |
c81a2569 LP |
50 | nobody_group=`id -g -n 65534 2> /dev/null` |
51 | if [ "$nobody_group" != "" ] ; then | |
52 | # Validate that we can translate forth and back | |
53 | if [ "`id -g $nobody_group`" != 65534 ] ; then | |
54 | nobody_group="" | |
55 | fi | |
c82ce4f2 | 56 | fi |
c81a2569 LP |
57 | if [ "$nobody_group" = "" ] ; then |
58 | if id -u nobody 2> /dev/null ; then | |
59 | # The "nobody" group is defined already for something else, pick the Fedora name | |
60 | nobody_group=nfsnobody | |
61 | else | |
62 | # The "nobody" group name is free, use it | |
63 | nobody_group=nobody | |
64 | fi | |
c82ce4f2 | 65 | fi |
c81a2569 LP |
66 | |
67 | meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D default-hierarchy=unified -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group" | |
c82ce4f2 LP |
68 | fi |
69 | ||
70e760e3 | 70 | ninja -C "$BUILDDIR" all |
2ba6e738 | 71 | [ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test || ( RET="$?" ; cat "$BUILDDIR"/meson-logs/testlog.txt ; exit "$RET" ) |
70e760e3 | 72 | ninja -C "$BUILDDIR" install |
6344a7eb | 73 | |
70e760e3 | 74 | mkdir -p "$DESTDIR"/etc |
6344a7eb | 75 | |
70e760e3 | 76 | cat > "$DESTDIR"/etc/issue <<EOF |
6344a7eb LP |
77 | \S (built from systemd tree) |
78 | Kernel \r on an \m (\l) | |
79 | ||
80 | EOF |