We build tdnf along with the centos dependencies as it needs libsolv as
well and splitting everything up in separate steps is relatively more
complexity for a little extra run time.
We should look into caching the dependency building so we don't rebuild
the same dependencies each build.
Using grub on generated_root() images currently has problems as there is
a circular dependency between the root partition wanting to have grub
installed before being generated and grub wanting the root partition to
be generated before being installed.
It might be possible to get this working but until we do it's better to
explicitly fail when users try to do this.
The udev daemon and rules are split off from the main systemd package
because they aren't necessary in containers. When we're doing bootable
images, we definitely want systemd-udev to be installed.
Remove mkosi.default from repo and add it to .gitignore
Causes more issues that it solves. Currently, one always has to be
careful to specify --default /dev/null when running in the mkosi project
directory to avoid options from the mkosi.default file taking effect.
The mkosi.default file also only works on distros with dnf. Removing it
and putting it into the .gitignore also makes it easier for developers
to put their own symlink to their distro of choice in place.
Delay KeyboardInterrupt() handling when running a subprocess
Because we weren't giving subprocess time to gracefully exit, we'd
often get "Device or resource is busy" errors when CTRL+C'ing mkosi
as we we'd try to unmount directories while a subprocess was still
running in it. By delaying handling of SIGINT while a subprocess is
running, the subprocess can exit gracefully which prevents EBUSY errors
from occurring when running cleanup code. To allow interrupting hanging
subprocesses, we only delay the first SIGINT we receive. If a user
presses CTRL+C again, we exit immediately as before.
- Use single exception: MkosiException
- Throw MkosiException from die
- Print error immediately in die instead of in main exception handler.
This makes sure the error message is written to the terminal before
all the cleanup messages from the context managers.
- Convert some existing exceptions to MkosiException so they don't print
a stacktrace.
Drops the user into a shell if the build script fails with a non-zero
exit code. We still fail the build afterwards so the user can
immediately start again after he fixes his build script.
This option streamlines launching headless qemu virtual machines from
the command line via mkosi's qemu verb. When this option is specified,
mkosi configures the image for headless connections and adds the
-nographic option when launching the vm via mkosi's qemu verb. Instead
of launching a separate window, qemu connects the host's terminal to the
vm via the serial console. This allows working with the vm from the
comfort of your own terminal instead of the linux console which is used
when qemu starts the vm in a separate window.
We make sure all terminal features still work by overriding the TERM
value for serial-getty@ttyS0 in the vm with the TERM value from the
host's terminal emulator which we get from the TERM environment variable
that mkosi is started with.
Joerg Behrmann [Tue, 29 Oct 2019 10:20:00 +0000 (11:20 +0100)]
mkosi: make mkosi mypy --strict compliant
This commit makes mkosi compliant against running mypy in strict mode (with mypy
0.750).
- All missing type declarations are added,
- generic types are made explicit,
- __class__ usage is made explicit, and
- no longer necessary casts are removed.
mkosi: add explicit check for loopdev being not None to placate mypy
mypy throws an error on checking the mount_image function
> mkosi:969: error: Argument 1 to "partition" has incompatible type "Optional[str]"; expected "str"
> mkosi:972: error: Argument 1 to "partition" has incompatible type "Optional[str]"; expected "str"
because as of yet it cannot deduce, that loopdev will only be non-None if
args.esp_partno or args.xbootldr_partno are non-None as well, since they will
only be non-None on bootable images, which necessarily will be disk images, and
loopdev will only be None on non-disk images, i.e.
disk image -> loopdev is not None and args.esp_partno maybe None
non-disk image -> loopdev is None and args.esp_partno is None
Márton Morvai [Thu, 11 Jun 2020 14:42:54 +0000 (16:42 +0200)]
Call finalize script as described in documentation
Finalize script is now called as last step before build script in first
stage and as last step before image is made read-only/generated image is
made in second stage.
Finalize script is not called when creating cached images.
Daan De Meyer [Tue, 30 Jun 2020 20:13:56 +0000 (22:13 +0200)]
Stop ignoring umount errors
This was hiding a rather nasty bug in pacstrap/unshare. Silencing
the umount errors complicated finding the actual error so let's not
ignore unmounting errors.
Daan De Meyer [Tue, 30 Jun 2020 09:44:36 +0000 (11:44 +0200)]
Pass root around instead of workspace
Most of the functions operate on the image root instead of the
workspace so it makes sense to pass the root directory instead of
the workspace. Access to the workspace directory is done via the
workspace function that simply returns the parent directory of the
root directory.
This commit only refactors code and does not change behavior.
Ivan Shapovalov [Tue, 23 Jun 2020 16:11:27 +0000 (19:11 +0300)]
mkosi: fix `-t submodule` output
By the time we get to creating the root submodule, the directory already exists
because we self-bind-mount it in mount_image(), and it is too late to convert it
because of the same.
Thus, move the root subvolume creation into its own step just prior to
mount_image().