Daan De Meyer [Thu, 13 Aug 2020 19:57:23 +0000 (20:57 +0100)]
Interpret CLI args as nspawn args when verb == "boot"
Normal command line args are ignored by nspawn when --boot is used.
Instead of doing nothing with them, let's allow users to pass nspawn
args via the command line directly when boot is used.
Daan De Meyer [Sat, 8 Aug 2020 19:33:14 +0000 (20:33 +0100)]
Add setup-mkosi Github Action
We want to make it easy to set up mkosi based CI for other Linux
userspace projects on Github. By extracting all the tedious building of
dependencies out into a Github Actions, other projects can start using
mkosi for CI by simply adding 'uses: actions/setup-mkosi' to their
Github Actions workflow.
because the entrypoint console_script does not work properly when called with
sudo when not installed in a virtual environment, since the python binary is
unable to find the mkosi module in its search path.
According to the man page, --source-file-transfer "defaults to
copy-git-cached if a git source tree is detected, otherwise copy-all".
However the existing code only sets it to copy-git-cached if a .git
folder exists and leaves it at None otherwise, meaning a non-Git source
is never transferred.
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.