]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
10 months agoAllow configuring more than one profile 3057/head
Daan De Meyer [Sat, 21 Sep 2024 11:42:08 +0000 (13:42 +0200)] 
Allow configuring more than one profile

For many use cases it's useful to be able to configure more than one
profile, an example is selecting a generic desktop profile and a more
specific kde profile as well.

10 months agoRead config from mkosi.local/ as well if it exists
Daan De Meyer [Sat, 21 Sep 2024 10:13:19 +0000 (12:13 +0200)] 
Read config from mkosi.local/ as well if it exists

10 months agoParse profiles after mkosi.conf.d
Daan De Meyer [Sat, 21 Sep 2024 09:58:22 +0000 (11:58 +0200)] 
Parse profiles after mkosi.conf.d

Currently profiles can't depend on any of the configuration set in
mkosi.conf.d as they are parsed before mkosi.conf.d is parsed. Let's
parse the profile related configuration last instead so it can match
on all the configuration set in mkosi.conf.d.

To set the distribution and release and such based on the profile,
a dropin in mkosi.conf.d can match on the configured profile instead.

10 months agoUse run0 instead of refusing to run commands that need root unprivileged
Daan De Meyer [Fri, 20 Sep 2024 18:02:05 +0000 (20:02 +0200)] 
Use run0 instead of refusing to run commands that need root unprivileged

10 months agoMerge pull request #3059 from behrmann/moreformat
Daan De Meyer [Sat, 21 Sep 2024 11:09:59 +0000 (13:09 +0200)] 
Merge pull request #3059 from behrmann/moreformat

Formatting followups

10 months agodir-locals: set python-indent-def-block-scale to 1 3059/head
Jörg Behrmann [Sat, 21 Sep 2024 10:58:41 +0000 (12:58 +0200)] 
dir-locals: set python-indent-def-block-scale to 1

This makes the default Emacs indentation compatible with the ruff style so that
no extra indentation is added for function arguments.

10 months agoReduce indentation in finalize_qemu_firmware
Jörg Behrmann [Sat, 21 Sep 2024 10:57:38 +0000 (12:57 +0200)] 
Reduce indentation in finalize_qemu_firmware

10 months agoMerge pull request #3052 from behrmann/ruffformat
Daan De Meyer [Sat, 21 Sep 2024 09:36:54 +0000 (11:36 +0200)] 
Merge pull request #3052 from behrmann/ruffformat

Format with ruff

10 months agoAdd comments demarking config sections 3052/head
Jörg Behrmann [Sat, 21 Sep 2024 05:08:35 +0000 (07:08 +0200)] 
Add comments demarking config sections

10 months agoForce multiline formatting in more places
Jörg Behrmann [Sat, 21 Sep 2024 05:08:22 +0000 (07:08 +0200)] 
Force multiline formatting in more places

10 months agoeditorconfig: configure line length more widely
Jörg Behrmann [Fri, 20 Sep 2024 09:15:17 +0000 (11:15 +0200)] 
editorconfig: configure line length more widely

10 months agoci: add ruff format check
Jörg Behrmann [Thu, 19 Sep 2024 21:24:09 +0000 (23:24 +0200)] 
ci: add ruff format check

10 months agoReformat to 109 columns
Jörg Behrmann [Fri, 20 Sep 2024 08:27:38 +0000 (10:27 +0200)] 
Reformat to 109 columns

10 months agoFormat with ruff
Jörg Behrmann [Wed, 18 Sep 2024 13:31:43 +0000 (15:31 +0200)] 
Format with ruff

This change reformats mkosi using the ruff formatter with the default settings,
except for a line width of 119 columns.

Deviating from the default ruff formatting "fmt: skip" comments were added for
were it semantically makes sense, mainly:
- lists representing cmdlines, where options and their arguments should not be
  split
- when alignment improves readability (by easing comparisons with lines above
  and below)

Deviations from the above two guidelines are
- alignment was discarded for semantically empty statements (enum.auto())
- when all positional arguments where on the same line and options where on
  different lines, the positional arguments where put on separate lines as
  well, to minimize difference from vanilla ruff.

In collections that fit on a single line, trailing commas were removed, since
they force ruff to use multi-line formatting.

10 months agoMerge pull request #3053 from aafeijoo-suse/output-permissions-feat
Daan De Meyer [Fri, 20 Sep 2024 17:27:28 +0000 (19:27 +0200)] 
Merge pull request #3053 from aafeijoo-suse/output-permissions-feat

Add `OutputMode=` option

10 months agomkosi-initrd: set output mode 600 by default 3053/head
Antonio Alvarez Feijoo [Fri, 20 Sep 2024 14:12:24 +0000 (16:12 +0200)] 
mkosi-initrd: set output mode 600 by default

Traditionally, initrds stored in /boot must have their access mode set to 600.
Nowadays, this is useless for initrds stored on the vfat-formatted ESP, but it
doesn't hurt to support the old use case.

10 months agoAdd OutputMode= option
Antonio Alvarez Feijoo [Fri, 20 Sep 2024 14:12:06 +0000 (16:12 +0200)] 
Add OutputMode= option

10 months agoMerge pull request #3055 from DaanDeMeyer/fix
Daan De Meyer [Fri, 20 Sep 2024 14:00:14 +0000 (16:00 +0200)] 
Merge pull request #3055 from DaanDeMeyer/fix

Various sandbox fixes

10 months agoReplace --tmpfs with --dir for tmpfs directories 3055/head
Daan De Meyer [Fri, 20 Sep 2024 11:56:09 +0000 (13:56 +0200)] 
Replace --tmpfs with --dir for tmpfs directories

The root is already a tmpfs so no need to put separate tmpfs directories
on top of individual directories.

10 months agoMerge pull request #3049 from DaanDeMeyer/burn
Daan De Meyer [Fri, 20 Sep 2024 11:34:06 +0000 (13:34 +0200)] 
Merge pull request #3049 from DaanDeMeyer/burn

Don't pick up definitions from the host when running burn

10 months agoMove /etc/static symlink handling to finalize_crypto_mounts()
Daan De Meyer [Fri, 20 Sep 2024 11:23:46 +0000 (13:23 +0200)] 
Move /etc/static symlink handling to finalize_crypto_mounts()

10 months agoAdd back /etc/mtab symlink
Daan De Meyer [Fri, 20 Sep 2024 11:16:37 +0000 (13:16 +0200)] 
Add back /etc/mtab symlink

This got dropped somewhere in all the refactoring so let's add it
back.

10 months agodocs: Add doc on disk images with verity protected root partition
Daan De Meyer [Thu, 19 Sep 2024 13:39:07 +0000 (15:39 +0200)] 
docs: Add doc on disk images with verity protected root partition

10 months agoDon't pick up definitions from the host when running burn 3049/head
Daan De Meyer [Thu, 19 Sep 2024 17:47:58 +0000 (19:47 +0200)] 
Don't pick up definitions from the host when running burn

10 months agoSet repart definitions directory to / if we want to ignore system definitions
Daan De Meyer [Thu, 19 Sep 2024 18:16:20 +0000 (20:16 +0200)] 
Set repart definitions directory to / if we want to ignore system definitions

Setting to empty string resets the argument list and as such doesn't
work.

10 months agocli: add back mkosi-initrd and mkosi-tools to mkosi.resources
Antonio Alvarez Feijoo [Thu, 19 Sep 2024 14:59:24 +0000 (16:59 +0200)] 
cli: add back mkosi-initrd and mkosi-tools to mkosi.resources

Otherwise these resources are not packaged and cannot be included.

E.g., `mkosi-initrd` fails because it adds `--include=mkosi-initrd`:

```
$ mkosi-initrd
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/mkosi/run.py", line 64, in uncaught_exception_handler
    yield
  File "/usr/lib64/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mkosi/__main__.py", line 30, in main
    args, images = parse_config(sys.argv[1:], resources=resources)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mkosi/config.py", line 3907, in parse_config
    context.parse_new_includes()
  File "/usr/lib/python3.11/site-packages/mkosi/config.py", line 3575, in parse_new_includes
    st = path.stat()
         ^^^^^^^^^^^
  File "/usr/lib64/python3.11/pathlib.py", line 1013, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpyqqy4ttp/resources/mkosi-initrd'
```

Fixes 9f48afa4a76b6002edc90ac976a2d1e8fd01f793

10 months agoMerge pull request #3044 from dvzrv/feat/reuse
Daan De Meyer [Wed, 18 Sep 2024 12:25:28 +0000 (14:25 +0200)] 
Merge pull request #3044 from dvzrv/feat/reuse

Add reuse integration to validate the license information of all files

10 months agoRun reuse in CI to detect license issues right away 3044/head
David Runge [Wed, 18 Sep 2024 12:17:29 +0000 (14:17 +0200)] 
Run reuse in CI to detect license issues right away

Signed-off-by: David Runge <dave@sleepmap.de>
10 months agoAdd reuse integration for ensuring license compliance
David Runge [Wed, 18 Sep 2024 12:14:16 +0000 (14:14 +0200)] 
Add reuse integration for ensuring license compliance

Rename use of legacy LGPL-2.1+ SPDX-License-Identifier to the more
widely used LGPL-2.1-or-later.

Add missing licenses and move existing ones to their respective correct
locations in the LICENSES directory.

Add REUSE.toml describing the licensing of all files.

Signed-off-by: David Runge <dave@sleepmap.de>
10 months agoMerge pull request #3043 from dvzrv/feat/codespell
Daan De Meyer [Wed, 18 Sep 2024 11:39:42 +0000 (13:39 +0200)] 
Merge pull request #3043 from dvzrv/feat/codespell

Add codespell to detect spelling mistakes as early as possible

10 months agoRun codespell in CI to detect spelling issues 3043/head
David Runge [Wed, 18 Sep 2024 11:33:04 +0000 (13:33 +0200)] 
Run codespell in CI to detect spelling issues

Signed-off-by: David Runge <dave@sleepmap.de>
10 months agoFix typos identified by codespell
David Runge [Wed, 18 Sep 2024 11:30:34 +0000 (13:30 +0200)] 
Fix typos identified by codespell

Signed-off-by: David Runge <dave@sleepmap.de>
10 months agoAdd codespell configuration
David Runge [Wed, 18 Sep 2024 11:31:27 +0000 (13:31 +0200)] 
Add codespell configuration

Ignore .git directory and documentation stylesheet file.

Signed-off-by: David Runge <dave@sleepmap.de>
10 months agoMerge pull request #3041 from DaanDeMeyer/fix
Daan De Meyer [Wed, 18 Sep 2024 08:49:55 +0000 (10:49 +0200)] 
Merge pull request #3041 from DaanDeMeyer/fix

Two fixes

10 months agoMerge pull request #3040 from DaanDeMeyer/gpg-devices
Daan De Meyer [Wed, 18 Sep 2024 08:49:30 +0000 (10:49 +0200)] 
Merge pull request #3040 from DaanDeMeyer/gpg-devices

Fixups for gpg

10 months agoSet pinentry mode to loopback for gpg 3040/head
Daan De Meyer [Wed, 18 Sep 2024 08:20:36 +0000 (10:20 +0200)] 
Set pinentry mode to loopback for gpg

Otherwise signing with nitro key does not work.

10 months agoHandle top level symlinks in relaxed sandbox 3041/head
Daan De Meyer [Tue, 17 Sep 2024 19:29:39 +0000 (21:29 +0200)] 
Handle top level symlinks in relaxed sandbox

10 months agoMake entire /run available to gpg command
Daan De Meyer [Tue, 17 Sep 2024 18:54:37 +0000 (20:54 +0200)] 
Make entire /run available to gpg command

gpg connects to various sockets in /run so let's make the entirety
of /run available to it.

10 months agoUse workdir() for calculate_signature()
Daan De Meyer [Tue, 17 Sep 2024 15:30:39 +0000 (17:30 +0200)] 
Use workdir() for calculate_signature()

10 months agoPass filename to oserror() in a few more cases
Daan De Meyer [Tue, 17 Sep 2024 15:03:04 +0000 (17:03 +0200)] 
Pass filename to oserror() in a few more cases

10 months agoFix typo
Daan De Meyer [Tue, 17 Sep 2024 14:32:57 +0000 (16:32 +0200)] 
Fix typo

10 months agoRemove incorrect use of workdir()
Daan De Meyer [Tue, 17 Sep 2024 18:46:55 +0000 (20:46 +0200)] 
Remove incorrect use of workdir()

10 months agoDrop support for ; comments
Daan De Meyer [Tue, 17 Sep 2024 18:45:25 +0000 (20:45 +0200)] 
Drop support for ; comments

Can be part of a pkcs11 URI so let's drop support for ';' for comments.
I've never seen anyone use this so it shouldn't be a problem to drop
this.

10 months agoFix more typos.
Jörg Behrmann [Tue, 17 Sep 2024 14:15:01 +0000 (16:15 +0200)] 
Fix more typos.

10 months agoFix typo
Daan De Meyer [Tue, 17 Sep 2024 14:10:55 +0000 (16:10 +0200)] 
Fix typo

10 months agoMake sure we only use workdir() for keys if they're a path on disk
Daan De Meyer [Tue, 17 Sep 2024 07:47:04 +0000 (09:47 +0200)] 
Make sure we only use workdir() for keys if they're a path on disk

Fixes #3033

10 months agoMake relaxed sandbox even more relaxed
Daan De Meyer [Tue, 17 Sep 2024 11:50:27 +0000 (13:50 +0200)] 
Make relaxed sandbox even more relaxed

Let's move to a denylist instead of an allowlist so that we also
cover all kinds of non-standard locations which might be referenced
when running qemu, nspawn, ....

10 months agoMention roothash= and usrhash= in the kernel command line doc
Daan De Meyer [Tue, 17 Sep 2024 13:04:52 +0000 (15:04 +0200)] 
Mention roothash= and usrhash= in the kernel command line doc

10 months agoLog error when qemu itself fails
Daan De Meyer [Tue, 17 Sep 2024 10:33:04 +0000 (12:33 +0200)] 
Log error when qemu itself fails

Let's log about errors from qemu itself, since those are generally
unexpected and with qemu we have a way to figure out whether the error
came from qemu itself or from within the virtual machine since the errors
from within the virtual machine are communicated via vsock.

10 months agoMerge pull request #3032 from DaanDeMeyer/uuid
Daan De Meyer [Tue, 17 Sep 2024 07:34:46 +0000 (09:34 +0200)] 
Merge pull request #3032 from DaanDeMeyer/uuid

Add back MachineId= setting

11 months agoAdd back MachineId= setting 3032/head
Daan De Meyer [Mon, 16 Sep 2024 16:56:01 +0000 (18:56 +0200)] 
Add back MachineId= setting

To build an image with a dm-verity protected root partition that has
a persistent machine ID, the machine ID has to be embedded in the image,
so let's add back the MachineId= setting to support this use case.

11 months agoVarious improvements for Seed=
Daan De Meyer [Mon, 16 Sep 2024 16:54:19 +0000 (18:54 +0200)] 
Various improvements for Seed=

Let's read the UUID from mkosi.seed if it's available. Also various
other small improvements.

11 months agoFix relative path calculation in filter_kernel_modules()
Daan De Meyer [Sat, 14 Sep 2024 14:48:34 +0000 (16:48 +0200)] 
Fix relative path calculation in filter_kernel_modules()

I'm not sure what possessed me when I last touched this, but to get
the path relative to the kernel/ directory we have to strip of the
first 5 parts, not just 1.

11 months agoMerge pull request #3031 from DaanDeMeyer/metadata
Daan De Meyer [Mon, 16 Sep 2024 10:25:15 +0000 (12:25 +0200)] 
Merge pull request #3031 from DaanDeMeyer/metadata

Cache repository metadata snapshot again

11 months agoUse workdir() in make_image() 3031/head
Daan De Meyer [Sun, 15 Sep 2024 20:28:55 +0000 (22:28 +0200)] 
Use workdir() in make_image()

11 months agoMake sure /var/tmp is not an overlayfs unless required
Daan De Meyer [Sun, 15 Sep 2024 20:27:03 +0000 (22:27 +0200)] 
Make sure /var/tmp is not an overlayfs unless required

If we put an overlayfs on /var because the user provided files in
/var via their sandbox tree, make sure /var/tmp is not an overlayfs
unless really required so tools like systemd-repart can make full
use of the underlying filesystem features which are disabled if
/var/tmp is on an overlayfs.

11 months agoMove /var/log creation from sandbox tree to sandbox_cmd()
Daan De Meyer [Sun, 15 Sep 2024 20:25:35 +0000 (22:25 +0200)] 
Move /var/log creation from sandbox tree to sandbox_cmd()

We now always put an overlayfs on top of the sandbox tree so writes
done from within the sandbox aren't persisted, so there's no point
anymore in creating /var/log in the sandbox tree anymore. Instead,
make sure it exists within sandbox_cmd() so we can still access logs
when using --debug-shell.

11 months agoDrop dbus-broker and dbus-broker-units from Arch tools tree
Daan De Meyer [Sun, 15 Sep 2024 17:39:15 +0000 (19:39 +0200)] 
Drop dbus-broker and dbus-broker-units from Arch tools tree

Taking mkosi dependencies into account, forcefully installing dbus-broker
on user systems seems like a bad idea so let's revert this change.

11 months agoCache repository metadata snapshot again
Daan De Meyer [Sun, 15 Sep 2024 14:58:02 +0000 (16:58 +0200)] 
Cache repository metadata snapshot again

In https://github.com/systemd/mkosi/pull/2973, we stopped putting
a repository snapshot into the image. However, this also means that
when rebuilding a cached image, we don't operate on the same repository
metadata snapshot anymore if the shared cache was resynced in the
meantime.

Let's fix this by adding a new cache directory for the top level image
which stores a repository metadata snapshot. Then, if incremental mode
is enabled and using the snapshot is not explicitly disabled, if we have
just a single cached image that we'll be reusing, reuse the repository
metadata snapshot as well. Otherwise, optionally sync and then copy the
repository metadata from the shared cache.

At the same time, we merge run_sync() and sync_repository_metadata() as
they don't make much sense as separate functions anymore.

11 months agoMerge pull request #3030 from DaanDeMeyer/work
Daan De Meyer [Sun, 15 Sep 2024 09:39:26 +0000 (11:39 +0200)] 
Merge pull request #3030 from DaanDeMeyer/work

Two improvements

11 months agoAdd some checks to check_inputs() for secure boot key and certificate 3030/head
Daan De Meyer [Sat, 14 Sep 2024 20:29:54 +0000 (22:29 +0200)] 
Add some checks to check_inputs() for secure boot key and certificate

11 months agoMake code to deal with overlayfs "work" directory more robust
Daan De Meyer [Sat, 14 Sep 2024 20:28:51 +0000 (22:28 +0200)] 
Make code to deal with overlayfs "work" directory more robust

The work directory can be populated if files are deleted in the
upperdir. In that case we need to acquire privileges to be able to
delete the directory so add a fallback for that scenario.

11 months agoMerge pull request #3026 from DaanDeMeyer/history
Jörg Behrmann [Sat, 14 Sep 2024 18:19:13 +0000 (20:19 +0200)] 
Merge pull request #3026 from DaanDeMeyer/history

Enable history for the default image

11 months agoEnable history for the default image 3026/head
Daan De Meyer [Fri, 13 Sep 2024 18:05:42 +0000 (20:05 +0200)] 
Enable history for the default image

The integration tests are also rewritten to take advantage of the
functionality provided by enabling History=.

11 months agomkosi.conf: Move CacheDirectory= to the [Build] section
Daan De Meyer [Sat, 14 Sep 2024 15:06:13 +0000 (17:06 +0200)] 
mkosi.conf: Move CacheDirectory= to the [Build] section

11 months agoUse workdir for start_virtiofsd()
Daan De Meyer [Sat, 14 Sep 2024 12:28:13 +0000 (14:28 +0200)] 
Use workdir for start_virtiofsd()

virtiofsd might be executed as root within a newuidmap user namespace.
This means mkosi-sandbox will run as root within the newuidmap user
namespace and any directories created by mkosi-sandbox will be owned by
root in the newuidmap user namespace. If these directories are created
in a directory that's persisted (for example /var/tmp) and later cleaned
up by mkosi, this could fail with a permission error.

By using workdir(), the directories are guaranteed to be created within
a tmpfs which is automatically cleaned up when the sandbox is destroyed
with no chance for permission errors.

11 months agoRemove references of bubblewrap in docs/tools configuration
Jelle van der Waa [Sat, 14 Sep 2024 11:05:08 +0000 (13:05 +0200)] 
Remove references of bubblewrap in docs/tools configuration

Since b3a3e7e7fcb2a4e8f mkosi no longer relies on bubblewrap for
sandboxing.

11 months agoRevert "tests: Show debug messages on console"
Daan De Meyer [Sat, 14 Sep 2024 08:42:37 +0000 (10:42 +0200)] 
Revert "tests: Show debug messages on console"

The issue hasn't occurred since we enabled this so let's disable
it again. If the issue starts happening again, we'll need to do
more targeted enabling of debug output.

This reverts commit f4934828f75bd27fd5325598ae7ffcc3cef064b3.

11 months agoAdd more detail to NEWS
Daan De Meyer [Fri, 13 Sep 2024 15:39:44 +0000 (17:39 +0200)] 
Add more detail to NEWS

11 months agoDon't install fish on centos
Daan De Meyer [Fri, 13 Sep 2024 14:43:17 +0000 (16:43 +0200)] 
Don't install fish on centos

Not available in C10s

11 months agoMake sure /work is removed from the image
Daan De Meyer [Fri, 13 Sep 2024 09:58:51 +0000 (11:58 +0200)] 
Make sure /work is removed from the image

11 months agoMerge pull request #3010 from keszybz/mkosi-sandbox-wrapper
Daan De Meyer [Thu, 12 Sep 2024 16:51:23 +0000 (18:51 +0200)] 
Merge pull request #3010 from keszybz/mkosi-sandbox-wrapper

Add bin/mkosi-initrd and bin/mkosi-sandbox wrappers and some cleanups

11 months agoWrap long comments, add more punctuation 3010/head
Zbigniew Jędrzejewski-Szmek [Mon, 9 Sep 2024 13:33:32 +0000 (15:33 +0200)] 
Wrap long comments, add more punctuation

.dir-locals specifies "fill-column" as 99 for .py files.
This seems resonable, because then the comments mostly match the
general width of the surrounding code.

11 months agoAdd bin/mkosi-initrd and bin/mkosi-sandbox
Zbigniew Jędrzejewski-Szmek [Sun, 8 Sep 2024 11:02:03 +0000 (13:02 +0200)] 
Add bin/mkosi-initrd and bin/mkosi-sandbox

It is convenient to be able to invoke those two during development
too, just like mkosi itself.

11 months agosandbox: use ValueError
Zbigniew Jędrzejewski-Szmek [Mon, 9 Sep 2024 13:34:29 +0000 (15:34 +0200)] 
sandbox: use ValueError

RuntimeError is for "unexpected errors". When the argument has a
wrong value, ValueError is the standard exception to use.

11 months agoUpdate NEWS.md
Daan De Meyer [Thu, 12 Sep 2024 11:30:56 +0000 (13:30 +0200)] 
Update NEWS.md

11 months agomkosi-initrd: allow configuration from /usr/local
Jörg Behrmann [Thu, 12 Sep 2024 07:07:21 +0000 (09:07 +0200)] 
mkosi-initrd: allow configuration from /usr/local

11 months agoBeef up tty checks for color handling
Daan De Meyer [Wed, 11 Sep 2024 17:48:08 +0000 (19:48 +0200)] 
Beef up tty checks for color handling

Let's use the same checks used by systemd.

Fixes #3013

11 months agodissect: do not attempt to load verity for just-built images
Luca Boccassi [Wed, 11 Sep 2024 16:23:35 +0000 (18:23 +0200)] 
dissect: do not attempt to load verity for just-built images

Verity is useful to establish trust at runtime in production
environments where we don't know if a payload is trusted in advance,
but we can implicitly trust the image we just built ourselves, so set
the env vars to disable loading images using verity when building
sub-images

11 months agomkosi-initrd: allow transient configuration
Antonio Alvarez Feijoo [Wed, 11 Sep 2024 14:59:17 +0000 (16:59 +0200)] 
mkosi-initrd: allow transient configuration

Include `/run/mkosi-initrd` if it exists.

11 months agoAdd sysupdate verb
Daan De Meyer [Sun, 8 Sep 2024 14:38:55 +0000 (16:38 +0200)] 
Add sysupdate verb

11 months agoMerge pull request #3012 from DaanDeMeyer/config
Daan De Meyer [Wed, 11 Sep 2024 09:03:40 +0000 (11:03 +0200)] 
Merge pull request #3012 from DaanDeMeyer/config

Introduce History= setting

11 months agoIntroduce History= setting 3012/head
Daan De Meyer [Tue, 10 Sep 2024 12:26:08 +0000 (14:26 +0200)] 
Introduce History= setting

Currently, to boot an image with mkosi qemu after building it with
mkosi build, various settings have to be identical to when mkosi build
was invoked to make sure that mkosi can find the outputs of the previous
build. Because this is rather error prone and annoying, let's introduce
a History= setting to allow mkosi to remember the configuration of the
last build which can then be read again when running a verb that operates
on a built image.

Another case where this is extremely useful is when some part of the
configuration changes every single time, for example if mkosi.version
is an executable script that outputs the current time, which is then
encoded in the output name, we have to remember the previous config,
otherwise mkosi wouldn't be able to find the outputs of the previous
build.

Note that while we load the configuration of the previous build, we
ignore all settings from the [Host] section which we read again from
the configuration files, as the user should be able to change these
without rebuilding the image.

11 months agoMake JSON loading methods more robust against changes in Config and Args
Daan De Meyer [Wed, 11 Sep 2024 07:59:12 +0000 (09:59 +0200)] 
Make JSON loading methods more robust against changes in Config and Args

We don't want failures to load JSON every time we add a new field, so let's
consider every JSON object we read as potentially partial and merge it with
a default instance of Config/Args. Also, sometimes we drop or rename fields
so let's show a proper error in the case that happens.

11 months agoFix comments
Daan De Meyer [Wed, 11 Sep 2024 07:41:16 +0000 (09:41 +0200)] 
Fix comments

11 months agoOnly append distro~release~arch suffix to build dir if not already there
Daan De Meyer [Tue, 10 Sep 2024 12:39:50 +0000 (14:39 +0200)] 
Only append distro~release~arch suffix to build dir if not already there

11 months agoMake parse_new_includes() a regular function
Daan De Meyer [Tue, 10 Sep 2024 12:01:15 +0000 (14:01 +0200)] 
Make parse_new_includes() a regular function

There's no need for this to be a context manager anymore.

11 months agoMove Include= setting to [Include] section
Daan De Meyer [Tue, 10 Sep 2024 11:59:00 +0000 (13:59 +0200)] 
Move Include= setting to [Include] section

This allows us to treat includes distinctly from other [Config]
settings in the next commit.

11 months agoIntroduce new Build section and move various settings to it
Daan De Meyer [Tue, 10 Sep 2024 10:02:12 +0000 (12:02 +0200)] 
Introduce new Build section and move various settings to it

11 months agoRemove "Include" from JSON serialization
Daan De Meyer [Tue, 10 Sep 2024 09:42:27 +0000 (11:42 +0200)] 
Remove "Include" from JSON serialization

We already have Files to cover everything so no need to include what
we included separately.

11 months agoDrop InitrdInclude=
Daan De Meyer [Tue, 10 Sep 2024 09:39:45 +0000 (11:39 +0200)] 
Drop InitrdInclude=

11 months agoMerge pull request #3008 from DaanDeMeyer/sandbox
Daan De Meyer [Mon, 9 Sep 2024 17:08:50 +0000 (19:08 +0200)] 
Merge pull request #3008 from DaanDeMeyer/sandbox

Use more directories of sandbox trees in the sandbox

11 months agoPort more code over to workdir() 3008/head
Daan De Meyer [Sun, 8 Sep 2024 15:18:50 +0000 (17:18 +0200)] 
Port more code over to workdir()

Let's not rely on tools not writing logs or errors to /dev/stdout
and instead use workdir() as well to mount the required parent
directory into the expected location so the output can be written
there.

11 months agoInstall various shells in the default image
Daan De Meyer [Sun, 8 Sep 2024 14:38:41 +0000 (16:38 +0200)] 
Install various shells in the default image

11 months agoLog when we're copying repository metadata
Daan De Meyer [Sun, 8 Sep 2024 14:37:34 +0000 (16:37 +0200)] 
Log when we're copying repository metadata

11 months agoUse package cache from /root if we're running as root from /root
Daan De Meyer [Sun, 8 Sep 2024 14:37:16 +0000 (16:37 +0200)] 
Use package cache from /root if we're running as root from /root

11 months agoAdd RuntimeHome= option
Daan De Meyer [Fri, 6 Sep 2024 15:19:06 +0000 (17:19 +0200)] 
Add RuntimeHome= option

11 months agoUse more directories of sandbox trees in the sandbox
Daan De Meyer [Fri, 6 Sep 2024 11:53:23 +0000 (13:53 +0200)] 
Use more directories of sandbox trees in the sandbox

Previously, we only picked up /usr and /etc from the sandbox trees.
Let's make this more generic and pick up a bunch of extra directories
as well. To avoid any changes persisting outside of the sandbox, let's
use overlayfs with a temporary writable directory as the upperdir of the
overlayfs (and make sure we use a tmpfs as the upperdir for /tmp and /run).

11 months agoStop using sandbox tree to shovel out list of essential packages
Daan De Meyer [Fri, 6 Sep 2024 12:01:16 +0000 (14:01 +0200)] 
Stop using sandbox tree to shovel out list of essential packages

We don't want to persist changes to the sandbox tree so in preparation
for that let's stop using the sandbox tree as a channel to shovel out
the list of essential packages when building debian images.

11 months agosandbox: Allow using tmpfs as overlayfs upperdir and workdir
Daan De Meyer [Fri, 6 Sep 2024 11:47:15 +0000 (13:47 +0200)] 
sandbox: Allow using tmpfs as overlayfs upperdir and workdir