]> git.ipfire.org Git - thirdparty/systemd.git/commit - mkosi.images/base/mkosi.postinst.chroot
mkosi: Switch to use mkosi presets with prebuilt initrds 27442/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Apr 2023 14:04:49 +0000 (16:04 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 1 May 2023 13:39:50 +0000 (15:39 +0200)
commitd052cc88932926f964bcf227c1c5032c5400cd4a
treeffff1487d6835c6359cf25334fd75ee589391540
parentd9081eb0ae848b5066edc1b20b36a35729577edd
mkosi: Switch to use mkosi presets with prebuilt initrds

Instead of building the initrds for the mkosi images with dracut,
let's switch to using mkosi presets to build the initrd with mkosi
as well.

This commit splits up our single image build into three separate
mkosi presets:

1. The "base" preset. This image contains systemd and all its runtime
dependencies. The sole purpose of this image is to serve as a base image
for the initrd and the final image. It's also responsible for building
systemd from source with the build script. The results are installed into
the base image. Note that we install the systemd and udev packages into this
image as well to prevent package managers from overriding the systemd we built
from source with the distro packaged systemd if it's pulled in as a dependency
by another package from the initrd or final profiles.
2. The "initrd" preset. This image provides the initrd. It's trivial and does
nothing more than packaging the base image up as a zstd compressed initramfs and
adds /init and /etc/initrd-release symlinks to the image.
3. The "final" preset. This image builds on top of the base image and adds
a kernel and extra packages that are useful for testing and debugging.

We also split out the optional kernel build into a separate set of config files
that are only included if a kernel to build is actually provided.

Note that this commit doesn't really change anything about how mkosi is used.
The commands remain the same, except that mkosi will now build all the presets
in order. "mkosi summary" will show the summary of all the presets. "mkosi qemu,
boot, shell" will always boot the final preset. With "-f", all presets will be
built and the final one is booted. "-i" makes a cache of each preset.

The only thing to keep in mind is that specifying config via the mkosi CLI will
apply to each of the presets. e.g. any extra packages added with "-p" will be
installed in both the initrd and the final image. To apply local configuration
to a single preset, create a file 00-local.conf in
mkosi.presets/<profile>/mkosi.conf.d and put all the preset specific configuration
in there.
53 files changed:
.github/workflows/mkosi.yml
mkosi.conf.d/05-qemu-mem.conf [new file with mode: 0644]
mkosi.conf.d/10-centos.conf [moved from mkosi.conf.d/20-centos.conf with 100% similarity]
mkosi.conf.d/10-debian.conf [new file with mode: 0644]
mkosi.conf.d/10-fedora.conf [new file with mode: 0644]
mkosi.conf.d/10-opensuse.conf [new file with mode: 0644]
mkosi.conf.d/10-systemd.conf
mkosi.conf.d/10-ubuntu.conf [new file with mode: 0644]
mkosi.conf.d/11-centos-8/mkosi.conf [new file with mode: 0644]
mkosi.conf.d/11-centos-8/mkosi.reposdir/powertools.repo [moved from mkosi.conf.d/21-centos-8/mkosi.reposdir/powertools.repo with 100% similarity]
mkosi.conf.d/20-arch.conf [deleted file]
mkosi.conf.d/20-debian-ubuntu/mkosi.extra/usr/lib/systemd/system-preset/99-ignore.preset [deleted file]
mkosi.extra/root/.gdbinit [deleted file]
mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset [deleted file]
mkosi.prepare [deleted file]
mkosi.presets/00-base/mkosi.build [moved from mkosi.build with 81% similarity]
mkosi.presets/00-base/mkosi.conf [new file with mode: 0644]
mkosi.presets/00-base/mkosi.conf.d/10-arch.conf [new file with mode: 0644]
mkosi.presets/00-base/mkosi.conf.d/10-centos-fedora.conf [moved from mkosi.conf.d/20-centos-fedora.conf with 66% similarity]
mkosi.presets/00-base/mkosi.conf.d/10-debian-ubuntu.conf [moved from mkosi.conf.d/20-debian-ubuntu/mkosi.conf with 63% similarity]
mkosi.presets/00-base/mkosi.conf.d/10-debian.conf [moved from mkosi.conf.d/20-debian.conf with 69% similarity]
mkosi.presets/00-base/mkosi.conf.d/10-fedora.conf [moved from mkosi.conf.d/20-fedora.conf with 67% similarity]
mkosi.presets/00-base/mkosi.conf.d/10-opensuse.conf [moved from mkosi.conf.d/20-opensuse.conf with 61% similarity]
mkosi.presets/00-base/mkosi.conf.d/10-ubuntu.conf [moved from mkosi.conf.d/20-ubuntu.conf with 71% similarity]
mkosi.presets/00-base/mkosi.conf.d/11-centos-8.conf [moved from mkosi.conf.d/21-centos-8/mkosi.conf with 71% similarity]
mkosi.presets/00-base/mkosi.conf.d/11-centos-9.conf [new file with mode: 0644]
mkosi.presets/00-base/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset [new file with mode: 0644]
mkosi.presets/00-base/mkosi.extra/usr/lib/systemd/system-preset/99-mkosi.preset [new file with mode: 0644]
mkosi.presets/00-base/mkosi.extra/usr/lib/tmpfiles.d/locale.conf [moved from mkosi.conf.d/20-debian-ubuntu/mkosi.extra/usr/lib/tmpfiles.d/locale.conf with 100% similarity]
mkosi.presets/00-base/mkosi.prepare [new file with mode: 0755]
mkosi.presets/10-initrd.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.build [new file with mode: 0755]
mkosi.presets/20-final/mkosi.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-arch.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-centos-fedora.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-debian-ubuntu.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-debian.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-fedora.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-opensuse.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/10-ubuntu.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/11-centos-8.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/11-centos-9.conf [moved from mkosi.conf.d/21-centos-9.conf with 69% similarity]
mkosi.presets/20-final/mkosi.conf.d/20-kernel-arch.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/20-kernel-centos-fedora.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/20-kernel-debian-ubuntu.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/20-kernel-fedora.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/20-kernel-opensuse.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.conf.d/20-kernel.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.extra/etc/issue [moved from mkosi.extra/etc/issue with 100% similarity]
mkosi.presets/20-final/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh [moved from mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh with 100% similarity]
mkosi.presets/20-final/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service [moved from mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service with 100% similarity]
mkosi.presets/20-final/mkosi.kernel.config [moved from mkosi.kernel.config with 100% similarity]
mkosi.presets/20-final/mkosi.postinst [moved from mkosi.postinst with 92% similarity]