Commit Graph

48 Commits

Author SHA1 Message Date
Daan De Meyer
1b6f9b9880 mkosi: Install sd-boot using postinst script instead of in build script
This allows us to reuse bootctl install instead of replicating the
logic in the build script.
2021-11-25 13:54:03 +01:00
Zbigniew Jędrzejewski-Szmek
8f5bcd615b licensing: add forgotten spdx headers
Those are all "our" files, but we forgot to add the headers,
most likely because of non-standard file extensions.
2021-10-01 14:45:00 +02:00
Daan De Meyer
64782655e1 mkosi: Remove build script umask workaround
A fix for this landed in meson 3 years ago so the workaround in the
build script can now be removed (https://github.com/mesonbuild/meson/pull/3225).
2021-09-28 23:09:11 +09:00
Zbigniew Jędrzejewski-Szmek
068d133881 mkosi: make mkosi.build shellcheck-clean
Also remove the space after redirection operators. (Some redirections
were with, some without, and I think it's nicer without.)
2021-09-03 09:54:43 +02:00
Zbigniew Jędrzejewski-Szmek
fc5f5c2a3c mkosi: drop the code to determine nobody user name
The comments were outdated: at least "nfsnobody" is not used in Fedora since a
few years. So I hope we don't need this anymore. The meson build scripts do
autodetection on their own.
2021-09-03 09:54:42 +02:00
Lennart Poettering
f533cda5a8 mkosi: initialize /usr/lib/os-release' IMAGE_ID + IMAGE_VERSION fields from build
If it's passed into the build, use it, so that the mkosi build version
is propagated into the image itself.
2021-07-03 11:07:00 +01:00
Lennart Poettering
7211773a55 mkosi: work-around to make systemd build in Fedora images that lack populated /etc
On Fedora /usr/bin/ld is a symlink managed via the "alternatives"
system. This unfortunately means the binary is not usable in
environments where /var or /etc are unpopulated. Let's address this by
redirecting "ld" to "ld.bfd" manually if such an environment is
detected, via $PATH.

This is useful for building systemd in mkosi with UsrOnly=1 set.
2021-04-07 17:45:28 +02:00
Daan De Meyer
44bc7f4fcf meson: Fix update-man-rules when the build dir is not a subdir of the project dir
Until now, update-man-rules assumed that the build directory was
a subdirectory of the project directory. When using mkosi, this is
not the case. We use find instead of git ls-files because git ls-files
does not seem to support outputting absolute paths.

Also, this makes update-man-rules a bit more user-friendly as new manpages
don't have to be added to the git staging area before they are processed by
update-man-rules.py.
2021-01-24 17:33:49 +00:00
Daan De Meyer
5a89c7972a mkosi: Pass build script arguments to ninja
mkosi recently gained support to pass arguments to the build script.
Let's take advantage of this in systemd's build script to allow
passing which target to build to ninja in the build script.
2021-01-24 14:13:02 +00:00
Daan De Meyer
ef1bd2349b mkosi: Allow setting version-tag option via VERSION_TAG env variable
With https://github.com/systemd/mkosi/pull/630, we can set environment
variables for the build script in mkosi. Let's modify the build script
so we can set the version-tag option via an environment variable of the
same name. The default is the empty string which causes meson to fall
back to the default behavior (git version).
2021-01-15 21:42:30 +01:00
Daan De Meyer
e2ebc406ac mkosi: Only reset file permissions when $SRCDIR is not a mountpoint
If $SRCDIR is mounted into the build image (via mkosi overrides),
let's not reset the permissions fo the source tree so as to not
modify the original files on the host.
2021-01-14 20:08:20 +01:00
Daan De Meyer
db52af5af5 mkosi: Disable translations
Speeds up incremental builds by half a second. Let's assume translations
won't be necessary in the resulting test images.
2021-01-10 12:44:21 +01:00
Daan De Meyer
1e48ef3f5d mkosi.build: Only create groups if they don't exist yet 2021-01-09 18:06:28 +01:00
Daan De Meyer
c3e2dc71de mkosi.build: Silence "Entering directory" message from ninja
When using `ninja -C "$BUILDDIR"`, ninja prints an annoying log
message about entering the directory that cannot be silenced. Let's
manually move in and out of the build directory instead.
2021-01-09 18:05:57 +01:00
Daan De Meyer
2234c6a094 mkosi: Use --only-changed meson option when installing
Recently, mkosi gained support for specifying an --install-directory
option to save the contents of the install directory between bulids.
By enabling the --only-changed meson install option, meson won't
overwrite the contents of files that haven't changed since the last
build when using --install-directory.
2020-12-19 16:16:07 +00:00
Daan De Meyer
5e577e1737 mkosi: Silence locale checking in mkosi.build
Avoid warning and error logs from locale charmap and export LC_CTYPE
by piping to dev/null and checking if locales are available before
using them.
2020-12-06 22:11:11 +00:00
Daan De Meyer
3dab2a4697 mkosi: Remove explicit default_hierarchy=unified option from mkosi.build
default_hierarchy is set to unified in meson_options already so
we can remove it from mkosi.build.
2020-12-06 22:11:11 +00:00
Daan De Meyer
fe2b7631ad mkosi: Add --quiet and --no-rebuild options to meson install in mkosi.build
By default, meson install prints a line for every file it installs.
This is verbose and doesn't provide much value. Let's silence the
meson install step to remove this output from the mkosi build step.

The --no-rebuild option removes some additional duplicate output
by the meson install step.

Ubuntu Focal still has meson 0.53.0 so we add a version check and
only use the new feature if the meson version supports it.
2020-12-06 22:11:11 +00:00
Daan De Meyer
1394a3ec35 mkosi: Remove bash -x option from mkosi.build
-x is for debugging purposes. During regular usage, using -x mostly
prints useless output when building the mkosi image.
2020-12-06 22:11:11 +00:00
Daan De Meyer
06ac1b1f2c mkosi: Use meson install instead of ninja install in build script
Allows using extra options not available when using ninja.
2020-12-06 22:11:11 +00:00
Michal Koutný
ff5499824f mkosi: Unify environment for unit tests
Some testcases in test-execute rely on existence of user groups with
certain gids. However, their existence is not universally granted [1].
Although the test could be skipped in their absence and give up testing
some code paths, different approach was chosen -- create dummy groups in
the testing image.

[1] See how systemd-sysusers allocates gids (e.g.
src/test/test-uid-range.c).
2020-04-22 10:35:12 +02:00
Michal Koutný
bac567a53b mkosi: Use distro-invariant rootprefix
Distributions may be build with various configs, e.g. customized
rootprefix. It'd be unmaintanable to have specific mkosi.build for each
supported distro. Hence, make the build script flexible yet distro
oblivious.
2020-04-22 10:35:12 +02:00
Lennart Poettering
1b14a4b097 mkosi: let's update the boot loader also in /efi
This is after all where we preferable mount the ESP today.
2019-03-01 12:41:32 +01:00
Lennart Poettering
d10ba83a1b mkosi: update the boot loader from our freshly built one 2018-10-16 16:44:34 +02:00
Lennart Poettering
0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering
818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering
5b3325fedf mkosi: drop dumping all test output to console again
As it appears meson's test cases nowadays (?) show useful logs for
failing tests anyway, hence there's no need to show them unconditionally
in full every time anymore. Let's hence simplify and drop this.
2018-04-19 11:41:28 +02:00
Zbigniew Jędrzejewski-Szmek
11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Filipe Brandenburger
b454cfb05c mkosi: set file permissions in copy of source tree (#8370)
Meson keeps permissions around during the build, so details of how umask
was set when cloning the original git tree will leak all the way to the
installed files in the mkosi image.

So reset the permissions of the files in the copy of the tree before
starting the build.

Also set the umask explicitly.

Tested by creating a mkosi image and booting it on a tree that was
cloned with a umask of 027, confirmed that the *.target files were not
created as world-unreadable anymore.
2018-03-20 17:21:36 +01:00
Filipe Brandenburger
2ea09665e2 mkosi: use locale that supports UTF-8, detect one that is available (#8340)
Using C.UTF-8 (as was done before #7244) breaks Arch Linux, but using
en_US.UTF-8 (after #7244) breaks Debian in our .mkosi/mkosi.debian.

So try to detect which one is available and works, first checking
whether we're already running under a valid UTF-8 locale, then trying
C.UTF-8 and finally en_US.UTF-8.

If we fail to find a valid UTF-8 locale, then fail early, instead of
letting the whole build complete only for Mesos to fail midway through
the `ninja test` step.

Tested on all of mkosi.fedora, mkosi.debian and mkosi.arch.

Fixes: #7238
2018-03-05 17:03:52 +01:00
Lennart Poettering
c81a256914 mkosi: no need to determine meson parameters if we don't run meson
Small optimization.
2018-02-09 19:22:40 +01:00
bleep_blop
7629744a3d separate flags from shebang 2017-12-25 19:48:49 +01:00
Lennart Poettering
c82ce4f215 mkosi.build: add code to determine the right nobody user/group name 2017-12-06 13:53:39 +01:00
Zbigniew Jędrzejewski-Szmek
c7e501475a mkosi: do not build man pages 2017-11-29 14:33:55 +01:00
Lennart Poettering
deb3b156ac mkosi: let's switch to the unified mode for mkosi
This is a toolconfiguration for developers, and hence most likely should
be the first thing to be switched over. Do so.
2017-11-25 17:08:21 +01:00
Lennart Poettering
8da0592c5d mkosi: fix build script to use right sysvinit path
On Fedora /etc/init.d is a symlink to /etc/rc.d/init.d. Our build
scripts default to /etc/init.d since that is the LSB default. Let's make
sure the build script thus follows the symlink correctly and configures
to path explicitly, since otherwise our build artifacts in $DESTDIR are
incompatible with the setup we actually need for Fedora.
2017-11-10 19:00:06 +01:00
John Lin
474cca49ee mkosi: set locale to be en_US.UTF-8 (#7244)
Fixes: #7238
2017-11-07 19:17:40 +03:00
Lennart Poettering
2ba6e7381b mkosi: when the build fails, show its log output, and propagate error 2017-09-22 15:24:55 +02:00
Lennart Poettering
9400405b4a mkosi: use '[' rather than 'test' everywhere 2017-07-20 14:37:05 +02:00
Lennart Poettering
a818a2ae60 mkosi: support mkosi's --without-tests switch
This adds support for the mkosi switch --without-tests that is
introduced by:

https://github.com/systemd/mkosi/pull/122

With this in place doing "mkosi -ifT shell" is the fastest way from a
git clone to a shell within a freshly compiled systemd system.
2017-07-20 14:37:05 +02:00
Lennart Poettering
70e760e3a7 mkosi: make use of BUILDDIR if it is set
This way, the new "mkosi.builddir" support proposed in PR:

https://github.com/systemd/mkosi/pull/114

will be made use of automatically.
2017-07-17 18:56:12 +02:00
Zbigniew Jędrzejewski-Szmek
848d875fde mkosi.build: set encoding
Otherwise python3 (via meson) complains.
2017-05-05 21:19:04 -04:00
Zbigniew Jędrzejewski-Szmek
6c3444cb03 mkosi: switch build to meson
For Fedora, the version is bumped to 26. In F25, ninja is still called ninja-build
(while the package with the rename is going through QA).
2017-05-05 21:18:44 -04:00
Lennart Poettering
6344a7eb5c mkosi: change /etc/issue text a bit for mkosi images build from systemd tree 2016-12-14 18:29:30 +01:00
Lennart Poettering
ab13cfb85a mkosi: run tests when building mkosi images 2016-12-14 18:29:30 +01:00
Zbigniew Jędrzejewski-Szmek
a10744be42 mkosi: drop git clean
This is required after systemd/mkosi#25.
2016-10-06 11:54:24 -04:00
Lennart Poettering
bb557f90f8 mkosi: make sure we fail on error 2016-07-19 12:30:34 +02:00
Lennart Poettering
1b0ff615c7 build-sys: add mkosi hookup (#3731)
This adds a build script and a settings file for "mkosi", a tool for putting
together full, bootable disk images for container managers of EFI systems and
VMs.

With these files it's enough to type "mkosi" in the project directory to
generate a bootable Fedora 24 OS image with a version of systemd compiled fresh
from the working tree.

See https://github.com/systemd/mkosi
2016-07-15 20:00:44 -04:00