]> git.ipfire.org Git - thirdparty/systemd.git/blob - mkosi.build
journal: losen restrictions on journal file suffix (#8013)
[thirdparty/systemd.git] / mkosi.build
1 #!/bin/sh
2 set -ex
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
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
28 export LC_CTYPE=en_US.UTF-8
29
30 sysvinit_path=`realpath /etc/init.d`
31
32 nobody_user=`id -u -n 65534 2> /dev/null`
33 if [ "$nobody_user" != "" ] ; then
34 # Validate that we can translate forth and back
35 if [ "`id -u $nobody_user`" != 65534 ] ; then
36 nobody_user=""
37 fi
38 fi
39 if [ "$nobody_user" = "" ] ; then
40 if id -u nobody 2> /dev/null ; then
41 # The "nobody" user is defined already for something else, pick the Fedora name
42 nobody_user=nfsnobody
43 else
44 # The "nobody" user name is free, use it
45 nobody_user=nobody
46 fi
47 fi
48
49 nobody_group=`id -g -n 65534 2> /dev/null`
50 if [ "$nobody_group" != "" ] ; then
51 # Validate that we can translate forth and back
52 if [ "`id -g $nobody_group`" != 65534 ] ; then
53 nobody_group=""
54 fi
55 fi
56 if [ "$nobody_group" = "" ] ; then
57 if id -u nobody 2> /dev/null ; then
58 # The "nobody" group is defined already for something else, pick the Fedora name
59 nobody_group=nfsnobody
60 else
61 # The "nobody" group name is free, use it
62 nobody_group=nobody
63 fi
64 fi
65
66 [ -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"
67 ninja -C "$BUILDDIR" all
68 [ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test || ( RET="$?" ; cat "$BUILDDIR"/meson-logs/testlog.txt ; exit "$RET" )
69 ninja -C "$BUILDDIR" install
70
71 mkdir -p "$DESTDIR"/etc
72
73 cat > "$DESTDIR"/etc/issue <<EOF
74 \S (built from systemd tree)
75 Kernel \r on an \m (\l)
76
77 EOF