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