]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
2 years agochmod /etc/machine-id and not the root directory 1547/head
Daan De Meyer [Mon, 8 May 2023 20:41:52 +0000 (22:41 +0200)] 
chmod /etc/machine-id and not the root directory

Fixes #1546

2 years agoMore ACL fixes
Daan De Meyer [Mon, 8 May 2023 20:25:43 +0000 (22:25 +0200)] 
More ACL fixes

Let's make sure we actually add ACLs to directories that initally
don't exist yet.

2 years agoMerge pull request #1545 from DaanDeMeyer/erofs
Daan De Meyer [Mon, 8 May 2023 14:06:18 +0000 (16:06 +0200)] 
Merge pull request #1545 from DaanDeMeyer/erofs

action: Install erofs-utils and drop zypper

2 years agoaction: Install erofs-utils and drop zypper 1545/head
Daan De Meyer [Mon, 8 May 2023 13:57:16 +0000 (15:57 +0200)] 
action: Install erofs-utils and drop zypper

2 years agoMerge pull request #1543 from DaanDeMeyer/firstboot
Daan De Meyer [Mon, 8 May 2023 13:39:24 +0000 (15:39 +0200)] 
Merge pull request #1543 from DaanDeMeyer/firstboot

Adopt systemd-firstboot

2 years agoSet tty size and term for /dev/console as well 1543/head
Daan De Meyer [Mon, 8 May 2023 07:40:09 +0000 (09:40 +0200)] 
Set tty size and term for /dev/console as well

When emergency.service is started, it's started connected to
/dev/console, so make sure we configure default term and tty size
for that one as well.

2 years agoACL fixes
Daan De Meyer [Sun, 7 May 2023 19:18:53 +0000 (21:18 +0200)] 
ACL fixes

- Toggle ACLs only if they're actually set in the first place on
inputs
- Toggle ACLs on skeleton and extra trees as well

2 years agoOutput size of each UKI we assemble
Daan De Meyer [Sun, 7 May 2023 18:06:30 +0000 (20:06 +0200)] 
Output size of each UKI we assemble

2 years agoMake KernelModulesInclude take priority over KernelModulesExclude=
Daan De Meyer [Sun, 7 May 2023 17:42:53 +0000 (19:42 +0200)] 
Make KernelModulesInclude take priority over KernelModulesExclude=

If exclude takes priority over include, it becomes hard to exclude
directories of drivers except for a few. If include takes priority
over exclude, we can do stuff like exclude "drivers/gpu/*" and
include "drivers/gpu/nvidia" to only include nvidia drivers.

The current behavior easily be reproduced by adding exclude "*"
followed by include patterns.

2 years agoAdd KernelModulesInclude= and KernelModulesExclude=
Daan De Meyer [Sun, 7 May 2023 16:18:13 +0000 (18:18 +0200)] 
Add KernelModulesInclude= and KernelModulesExclude=

These are like KernelModulesInitrdInclude= and
KernelModulesInitrdExclude= but they apply to the image itself
instead of to the kernel modules initrd.

The main use case is when using mkosi as an initramfs builder and
you want to exclude kernel modules from the initramfs but it can
also be useful when distros only ship large kernel packages that
you want to trim down.

2 years agoarch: Always exclude initramfs generator if we're doing a bootable image
Daan De Meyer [Sun, 7 May 2023 13:16:31 +0000 (15:16 +0200)] 
arch: Always exclude initramfs generator if we're doing a bootable image

The current condition is wrong as we'll generate an initrd ourselves
if none are provided by the user, so update the condition to not install
initramfs generators unless generating a bootable image is explicitly
disabled.

2 years agoKernel modules initramfs improvements
Daan De Meyer [Sun, 7 May 2023 13:05:23 +0000 (15:05 +0200)] 
Kernel modules initramfs improvements

- Use relative paths over full absolute paths
- Put all the firmware directories into the initramfs as well (just
the dirs, not all the firmware files)
- Return sets from resolve kernel modules function
- Operate on sorted lists of the sets to improve reproduciblity
- Split out filter_kernel_modules()
- Take builtin modules into account as well
- Use name field instead of filename from modinfo output
- Stop using joinpath() in favor of parentheses

2 years agoFall back to regular copying if doing a btrfs snapshot fails
Daan De Meyer [Sun, 7 May 2023 13:02:35 +0000 (15:02 +0200)] 
Fall back to regular copying if doing a btrfs snapshot fails

2 years agoGive disk images some extra free disk space when we boot them
Daan De Meyer [Sun, 7 May 2023 07:10:19 +0000 (09:10 +0200)] 
Give disk images some extra free disk space when we boot them

truncate creates the extra disk space sparse so this doesn't affect
the host's disk usage. The extra disk space will have to be partitioned
to be usable inside the image though (but this is perfect for systemd's
use case as we want to partition the free space with systemd-repart).

2 years agoIntroduce separate settings for configuring the verity key/certificate
Daan De Meyer [Sat, 6 May 2023 12:06:28 +0000 (14:06 +0200)] 
Introduce separate settings for configuring the verity key/certificate

These also default to mkosi.key and mkosi.crt but give the option to
use different files if required.

2 years agoFix sections for a number of settings
Daan De Meyer [Sat, 6 May 2023 11:45:13 +0000 (13:45 +0200)] 
Fix sections for a number of settings

Let's move a bunch of settings to a section that makes more sense
for them. No functional change, just moving stuff around.

2 years agoMake secure boot key and certificate required if set
Daan De Meyer [Sat, 6 May 2023 11:34:27 +0000 (13:34 +0200)] 
Make secure boot key and certificate required if set

If these are explicitly configured, we should make sure the paths
exist.

2 years agoMake key generation generic
Daan De Meyer [Sat, 6 May 2023 11:31:22 +0000 (13:31 +0200)] 
Make key generation generic

Let's put generated keys in mkosi.key and mkosi.crt, and remove the
secure boot nomenclature from the key generation options. This allows
us to reuse the keys for other signing operations as well.

2 years agoReduce ESP default size to 512MB
Daan De Meyer [Sat, 6 May 2023 11:17:43 +0000 (13:17 +0200)] 
Reduce ESP default size to 512MB

Now that we compress the Debian kernel modules initramfs, we can
reduce the default ESP size to 512MB again as it's large enough to
fit the Debian initramfs even with all kernel modules included.

2 years agoAllow skipping presets with a [Match] section
Daan De Meyer [Sat, 6 May 2023 10:07:59 +0000 (12:07 +0200)] 
Allow skipping presets with a [Match] section

If a preset's main config file has a [Match] section and it doesn't
match, do not add the preset to the list of presets.

2 years agoOnly check if given initrds exist if we're building a bootable image
Daan De Meyer [Sat, 6 May 2023 09:55:48 +0000 (11:55 +0200)] 
Only check if given initrds exist if we're building a bootable image

This allows disabling the initrd build without failing the final
image build that uses it.

2 years agoWrite all systemd units and dropins to /usr/ instead of /etc
Daan De Meyer [Sat, 6 May 2023 09:54:15 +0000 (11:54 +0200)] 
Write all systemd units and dropins to /usr/ instead of /etc

We want to accomodate images that only ship a /usr partition so let's
start by writing all of our dropins and units to /usr.

2 years agoAdopt systemd-firstboot
Daan De Meyer [Fri, 5 May 2023 20:14:18 +0000 (22:14 +0200)] 
Adopt systemd-firstboot

We keep it simple and just adopt the same settings that firstboot
has and pass them through directly.

This commit also reworks how we reset the machine ID, random seed
and a few other files.

2 years agoKernel modules initrd improvements
Daan De Meyer [Fri, 5 May 2023 14:15:41 +0000 (16:15 +0200)] 
Kernel modules initrd improvements

- Let's compress the kernel modules initrd on Debian to at least
reduce the disk usage required for the initrd. Not required for other
distros since those compress their kernel modules already individually.
- Add option --kernel-modules-initrd to enable/disable usage of the
kernel modules initrd. Can be used to disable it if the main initrd
already contains the necessary kernel modules
- Add options --kernel-modules-initrd-include/exclude to allow
including/excluding the initrds to put in the kernel modules initrd
by regex patterns.

2 years agoMerge pull request #1541 from DaanDeMeyer/subvolume
Daan De Meyer [Fri, 5 May 2023 14:15:11 +0000 (16:15 +0200)] 
Merge pull request #1541 from DaanDeMeyer/subvolume

Various new features and cleanups

2 years agoDrop man page from the repo 1541/head
Daan De Meyer [Fri, 5 May 2023 09:02:34 +0000 (11:02 +0200)] 
Drop man page from the repo

Let's just generate it on demand with pandoc when needed instead of
storing it in the repo. I initially pushed for putting in the repo
because the mkosi AUR package pulled in hundreds of Haskell dependencies
for pandoc when installing mkosi to build the manpage, but that's an
Arch issue and not something to solve in mkosi. Also, mkosi moved
from the AUR to the community repo these days so it's not an issue
on Arch anymore either.

2 years agoAdd Bootable= match
Daan De Meyer [Fri, 5 May 2023 08:06:44 +0000 (10:06 +0200)] 
Add Bootable= match

2 years agoIntroduce --use-subvolumes
Daan De Meyer [Fri, 5 May 2023 06:57:10 +0000 (08:57 +0200)] 
Introduce --use-subvolumes

Let's optionally use subvolumes to speed up copies when incremental
builds or base trees are used.

2 years agoSet dnf logdir to the workspace directory
Daan De Meyer [Fri, 5 May 2023 08:57:56 +0000 (10:57 +0200)] 
Set dnf logdir to the workspace directory

Let's not clutter the image with dnf logs.

2 years agoIntroduce ConfigFeature
Daan De Meyer [Fri, 5 May 2023 06:56:48 +0000 (08:56 +0200)] 
Introduce ConfigFeature

2 years agoRemove dead code
Daan De Meyer [Fri, 5 May 2023 08:42:39 +0000 (10:42 +0200)] 
Remove dead code

2 years agoMerge pull request #1538 from DaanDeMeyer/stable
Daan De Meyer [Fri, 5 May 2023 08:40:46 +0000 (10:40 +0200)] 
Merge pull request #1538 from DaanDeMeyer/stable

Make sure a stable path to the output path exists

2 years agoRework output related logic 1538/head
Daan De Meyer [Thu, 4 May 2023 10:47:24 +0000 (12:47 +0200)] 
Rework output related logic

- Let's store the output as a "base" name without any suffixes from
which we construct all other output paths.
- Let's not allow --output to be specified as a path anymore and
always put it in the configured output directory.
- Let's return all output paths as strings instead of paths. As
strings, we'll get typing errors if we try to use these as paths
without joining them with a directory first, which can be either the
output directory or the staging directory.
- Let's always create a symlink from the "base" name to the full
output path so it can be referred to regardless of the output
format, compression or image version that's used.
- Let's make sure we compress split partitions if requested

2 years agoCall unlink_output() before calling build_stuff() for prebuilt initrds
Daan De Meyer [Fri, 5 May 2023 06:15:11 +0000 (08:15 +0200)] 
Call unlink_output() before calling build_stuff() for prebuilt initrds

2 years agofedora: do not explicitly pull in filelists on F>=38
Zbigniew Jędrzejewski-Szmek [Thu, 4 May 2023 15:09:20 +0000 (17:09 +0200)] 
fedora: do not explicitly pull in filelists on F>=38

After the discussion in https://bugzilla.redhat.com/show_bug.cgi?id=2180842
glibc was updated to provide /sbin/ldconfig in F38 and rawhide. The
issue remains for only a few packages, and any that are frequently
installed are likely to be fixed quickly. So let's drop the work-around
for F>=38, which allows a smaller download to be made.

Follow-up for 04983128e59630c4227557573d7a69796911d5d1.

2 years agofedora: remove unused output variable
Zbigniew Jędrzejewski-Szmek [Thu, 4 May 2023 15:01:57 +0000 (17:01 +0200)] 
fedora: remove unused output variable

2 years agoDrop fallocate() call
Daan De Meyer [Thu, 4 May 2023 10:16:32 +0000 (12:16 +0200)] 
Drop fallocate() call

repart already generates sparse loopback files for us, no need to
spend time looping over the file to do it again.

2 years agoDrop subvolume output format
Daan De Meyer [Thu, 4 May 2023 09:38:22 +0000 (11:38 +0200)] 
Drop subvolume output format

We'll add this back eventually as a --subvolume option that applies
to all output formats.

2 years agoRevert "Ensure output is compatible with systemd-sysupdate"
Daan De Meyer [Thu, 4 May 2023 11:01:29 +0000 (13:01 +0200)] 
Revert "Ensure output is compatible with systemd-sysupdate"

This reverts commit f4414bee11c97a5872a74931f8bb78995b2e98c2.

2 years agoMerge pull request #1536 from DaanDeMeyer/opensuse-dnf
Zbigniew Jędrzejewski-Szmek [Thu, 4 May 2023 14:41:19 +0000 (16:41 +0200)] 
Merge pull request #1536 from DaanDeMeyer/opensuse-dnf

opensuse: Use dnf instead of zypper

2 years agoopensuse: Use dnf instead of zypper 1536/head
Daan De Meyer [Wed, 3 May 2023 12:15:22 +0000 (14:15 +0200)] 
opensuse: Use dnf instead of zypper

Let's reduce the number of package managers we use by using dnf to
build opensuse images.

The only caveat is that extra GPG keys are listed in repomd.xml for
the opensuse repos, so we have to download that file and parse it to
figure out the extra keys that we have to write to the repo configs.

2 years agoEnsure output is compatible with systemd-sysupdate 1386/head
Michael A Cassaniti [Mon, 1 May 2023 04:36:16 +0000 (14:36 +1000)] 
Ensure output is compatible with systemd-sysupdate

When using `systemd-sysupdate` it is wise to use split artifacts and to
compress artifacts. These changes ensure that split artifacts are compressed
and the file paths are stored in the checksum.

Please note that `systemd-sysupdate` expects a checksum name of `SHA256SUMS`
and uses the contained file names to determine which files to download. The
compression suffix is also used to determine how to decompress files.

Additional CI checks have been added to make sure no regressions in output
format occur.

2 years agoopensuse: Use kernel-kvmsmall in CI
Daan De Meyer [Wed, 3 May 2023 13:25:57 +0000 (15:25 +0200)] 
opensuse: Use kernel-kvmsmall in CI

Smaller kernel package that still has all features we need.

2 years agoMake sure we download filelists when using dnf5
Daan De Meyer [Wed, 3 May 2023 12:50:33 +0000 (14:50 +0200)] 
Make sure we download filelists when using dnf5

Some packages depend on this information to be available.

2 years agomageia: Use cauldron as the default release
Daan De Meyer [Wed, 3 May 2023 12:24:03 +0000 (14:24 +0200)] 
mageia: Use cauldron as the default release

Let's use the development release of mageia as the default release
to avoid it getting outdated all the time.

2 years agoAllow passing multiple GPG urls
Daan De Meyer [Wed, 3 May 2023 11:33:14 +0000 (13:33 +0200)] 
Allow passing multiple GPG urls

2 years agoDrop gpg path locations
Daan De Meyer [Wed, 3 May 2023 11:25:07 +0000 (13:25 +0200)] 
Drop gpg path locations

All of our gpg paths point to locations in rpms gpg database so they
should already be known by dnf and as such there's no point in listing
them explicitly in the config file. Let's only keep the urls in mkosi.

2 years agoMake gpgurl non-optional
Daan De Meyer [Tue, 2 May 2023 08:43:41 +0000 (10:43 +0200)] 
Make gpgurl non-optional

2 years agoUpdate files docs
Daan De Meyer [Sat, 29 Apr 2023 13:48:46 +0000 (15:48 +0200)] 
Update files docs

2 years agodistro: debian: allow RemovePackages
Tj [Tue, 2 May 2023 07:52:28 +0000 (08:52 +0100)] 
distro: debian: allow RemovePackages

When using RemovePackages= apt may refuse to remove what it considers
essential packages even when they are effectively empty meta packages or
contain only usr/share/doc/${package}/

This causes build failure like this:
Reading state information...
Package 'netcat-openbsd' is not installed, so not removed
Package 'net-tools' is not installed, so not removed
Package 'man-db' is not installed, so not removed
Package 'groff-base' is not installed, so not removed
The following packages will be REMOVED:
  cron* dmidecode* fdisk* ifupdown* init* iproute2* iputils-ping*
  isc-dhcp-client* isc-dhcp-common* kmod* libbpf0* libbsd0* libcap2-bin*
  libdns-export1110* libedit2* libelf1* libfdisk1* libisc-export1105*
  libjansson4* libmd0* libmnl0* libnftables1* libnftnl11* libxtables12*
nano*
  netbase* nftables* udev* vim-common* vim-tiny* xxd*
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  init
0 upgraded, 0 newly installed, 31 to remove and 0 not upgraded.
E: Essential packages were removed and -y was used without
--allow-remove-essential.
‣ "apt-get purge vim-tiny vim-common nano nftables netcat-openbsd
netbase net-tools isc-dhcp-common isc-dhcp-client iputils-ping iprout
e2 udev kmod fdisk dmidecode man-db init ifupdown groff-base cron"
returned non-zero exit code 100.
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,

As we do know what we are doing to have configured these removals, tell
apt to allow it.

2 years agoMerge pull request #1513 from keszybz/more-man
Daan De Meyer [Mon, 1 May 2023 11:16:54 +0000 (13:16 +0200)] 
Merge pull request #1513 from keszybz/more-man

More man page adjustments

2 years agoMerge pull request #1506 from DaanDeMeyer/profiles
Daan De Meyer [Mon, 1 May 2023 11:15:33 +0000 (13:15 +0200)] 
Merge pull request #1506 from DaanDeMeyer/profiles

Add preset support

2 years agoAdd preset support 1506/head
Daan De Meyer [Tue, 25 Apr 2023 13:04:19 +0000 (15:04 +0200)] 
Add preset support

Presets can be defined in mkosi.presets/. A preset is just like a
regular config file/directory, except that mkosi can build multiple
presets sequentially.

If mkosi.presets/ exists, for each preset mkosi will read the global
configuration, followed by the individual preset configuration. It
will then build each of the presets in alpha-numerical order. Later
presets can use outputs of earlier presets, specifically using the
BaseTrees= and Initrds= options.

While this has many use cases, one promising use case is to allow
building an initrd and a final image that uses that initrd within a
single invocation of mkosi.

2 years agoDo prebuilt initrds by default
Daan De Meyer [Sun, 30 Apr 2023 20:41:54 +0000 (22:41 +0200)] 
Do prebuilt initrds by default

Let's stop running kernel-install in favor of always doing prebuilt
initrds by default. We reimplement the depmod hook of kernel-install
ourselves (required for centos stream 8).

If no initrd is provided by the user, we build a minimal one ourselves
that's sufficient to boot in a qemu VM. If the default initrd is not
sufficient, the upcoming preset support can be used to build a custom
initrd instead.

2 years agoAllow specifying --bootable without an argument
Daan De Meyer [Sun, 30 Apr 2023 20:39:16 +0000 (22:39 +0200)] 
Allow specifying --bootable without an argument

2 years agoDon't fail if we can't retrieve default credentials
Daan De Meyer [Mon, 1 May 2023 07:45:06 +0000 (09:45 +0200)] 
Don't fail if we can't retrieve default credentials

Let's not fail if we can't run ssh-add or timedatectl to get the
SSH key or timezone.

2 years agoAllow specifying empty --directory to not parse any config files
Daan De Meyer [Sun, 30 Apr 2023 19:15:27 +0000 (21:15 +0200)] 
Allow specifying empty --directory to not parse any config files

2 years agorepart: Support mkfs options from configured environment
Michael A Cassaniti [Mon, 1 May 2023 00:16:04 +0000 (10:16 +1000)] 
repart: Support mkfs options from configured environment

2 years agoSwitch back to using ttyS0 as the default serial console
Daan De Meyer [Sun, 30 Apr 2023 15:07:01 +0000 (17:07 +0200)] 
Switch back to using ttyS0 as the default serial console

virtio_console is not always a builtin kernel module on all the
distributions we support. This means that the kernel can only
start logging to it after the initramfs has been unpacked and the
virtio_console module has been loaded from it. Any message that's
logged to kmsg before that dissapears into the void which makes
debugging boot failures rather difficult.

Instead, until systemd-stub is recent enough in all supported distros
to receive extra kernel cmdline arguments via smbios, let's use a
default kernel cmdline of "console=ttyS0" so that the serial console
works by default but can still be overridden by users.

2 years agoAlways create /init symlink if systemd is installed
Daan De Meyer [Sun, 30 Apr 2023 14:38:36 +0000 (16:38 +0200)] 
Always create /init symlink if systemd is installed

Let's always create the /init symlink if systemd is installed so that
the kernel picks it up at /init when we try to use this output as the
initramfs.

2 years agoRefactor ACLs + make sure they apply to base trees
Daan De Meyer [Sun, 30 Apr 2023 11:24:07 +0000 (13:24 +0200)] 
Refactor ACLs + make sure they apply to base trees

Let's refactor ACLs so that they're all applied/removed in the same
function. Let's also make sure they apply to base trees as well.

2 years agoAdd gzip compression support
Daan De Meyer [Sat, 29 Apr 2023 09:26:02 +0000 (11:26 +0200)] 
Add gzip compression support

2 years agoDefault to xz fast compression
Daan De Meyer [Sat, 29 Apr 2023 09:24:56 +0000 (11:24 +0200)] 
Default to xz fast compression

Let's default to fast compression instead of better compression.

Also drop pixz support since it's superseded by xz's own multithreading
support.

2 years agoFixup rpmdb location on Debian when running zypper as well
Daan De Meyer [Fri, 28 Apr 2023 18:39:27 +0000 (20:39 +0200)] 
Fixup rpmdb location on Debian when running zypper as well

zypper uses rpmdb under the hood, just like dnf, so it suffers from
the same rpmdb problem on Debian/Ubuntu, so let's apply the same fix.

2 years agoAdd missing newline
Daan De Meyer [Fri, 28 Apr 2023 18:37:43 +0000 (20:37 +0200)] 
Add missing newline

2 years agocentos: Make sure glibc-all-langpacks doesn't get installed
Daan De Meyer [Fri, 28 Apr 2023 09:21:20 +0000 (11:21 +0200)] 
centos: Make sure glibc-all-langpacks doesn't get installed

On CentOS 8, glibc-all-langpacks is pulled in as a dependency of
filesystem. Let's make sure dnf prefers glibc-minimal-langpack by
installing it explicitly.

2 years agoFix genkey
Daan De Meyer [Fri, 28 Apr 2023 08:36:56 +0000 (10:36 +0200)] 
Fix genkey

2 years agoClean up unlinking outputs a bit
Daan De Meyer [Fri, 28 Apr 2023 08:20:08 +0000 (10:20 +0200)] 
Clean up unlinking outputs a bit

2 years agoAdd missing colon
Daan De Meyer [Fri, 28 Apr 2023 06:25:57 +0000 (08:25 +0200)] 
Add missing colon

2 years agoFix PathExists
Daan De Meyer [Thu, 27 Apr 2023 19:03:51 +0000 (21:03 +0200)] 
Fix PathExists

We now chdir() to the current config directory so we don't have to
take the current path into account anymore.

2 years agoDon't try to install build packages if we have none
Daan De Meyer [Thu, 27 Apr 2023 18:09:34 +0000 (20:09 +0200)] 
Don't try to install build packages if we have none

2 years agoCache only files installed on top of base trees
Daan De Meyer [Thu, 27 Apr 2023 13:21:03 +0000 (15:21 +0200)] 
Cache only files installed on top of base trees

Currently, when base trees are used in incremental mode, we cache
the base trees as well. When running from a cache copy, any changes
to the base trees are not taken into account. Let's change this and
only cache the files we add/change/delete on top of the base layers.
This makes sure that we can still use our cache even if the base layer
changes, since we won't ignore all changes made to the base layer.

2 years agoStore file hash and signature in output directory
Michael A Cassaniti [Wed, 26 Apr 2023 08:11:10 +0000 (18:11 +1000)] 
Store file hash and signature in output directory

2 years agoCI fixes
Daan De Meyer [Wed, 26 Apr 2023 12:53:34 +0000 (14:53 +0200)] 
CI fixes

2 years agoMerge pull request #1516 from mcassaniti/fix-signing
Daan De Meyer [Wed, 26 Apr 2023 08:47:49 +0000 (10:47 +0200)] 
Merge pull request #1516 from mcassaniti/fix-signing

Fix signing of checksums, especially for non-root user

2 years agohash signing: Use keyring of running user for non-root builds 1516/head
Michael A Cassaniti [Wed, 26 Apr 2023 04:32:12 +0000 (14:32 +1000)] 
hash signing: Use keyring of running user for non-root builds

`gpg` will attempt to use the root user keyring When running as a non-root
user instead of using the keyring of the user that is executing `mkosi`.
This change will attempt to use the keyring given by `GNUPGHOME` and
fallback to using `~/.gnupg`.

2 years agobase-trees: Fix typo in path
Michael A Cassaniti [Wed, 26 Apr 2023 04:41:48 +0000 (14:41 +1000)] 
base-trees: Fix typo in path

2 years agoEnsure that username and uid are consistent
Joerg Behrmann [Tue, 25 Apr 2023 16:53:57 +0000 (18:53 +0200)] 
Ensure that username and uid are consistent

While SUDO_UID and SUDO_GID are useful, since sudo allows to run things as
different UID and GID, SUDO_USER is less useful, since it can't change the
mapping from UID to name in the namespace it's in. Let's cut out the middleman
of getpass.getuser, that looks through several more environment
variables (LOGNAME, USER, LNAME, USERNAME) before falling back to os.getuid and
looking up the corresponding name and do that right away.

2 years agohash signing: Fix using default key
Michael A Cassaniti [Wed, 26 Apr 2023 04:27:04 +0000 (14:27 +1000)] 
hash signing: Fix using default key

The default key needs to be specified before the file to sign

2 years agoman: add more info about qemu monitor 1513/head
Zbigniew Jędrzejewski-Szmek [Tue, 25 Apr 2023 16:55:41 +0000 (18:55 +0200)] 
man: add more info about qemu monitor

This is very hard to discover, but useful. Let's give the
users a hint.

2 years agoman: drop explicit Fedora version from example
Zbigniew Jędrzejewski-Szmek [Tue, 25 Apr 2023 16:52:17 +0000 (18:52 +0200)] 
man: drop explicit Fedora version from example

We don't really care which version is used exactly, but 24 is almost
certainly not the right one. By not specifying the version we let mkosi
pick something suitable.

2 years agoman: use '$' to signify unprivileged commands, '#' for privileged
Zbigniew Jędrzejewski-Szmek [Tue, 25 Apr 2023 16:51:02 +0000 (18:51 +0200)] 
man: use '$' to signify unprivileged commands, '#' for privileged

It's always nicer to do things not as root.

Also adjust some phrasing and minor details in a few places.

2 years agoman: drop line about authors
Zbigniew Jędrzejewski-Szmek [Tue, 25 Apr 2023 16:23:18 +0000 (18:23 +0200)] 
man: drop line about authors

This header is rendered in the github preview in a fairly ugly way.
Nevertheless, we can't get rid of the whole thing because then pandoc generates
a man page without a header. But let's at least drop the info about authors and
date to make the whole thing less prominent.

2 years agoMerge pull request #1509 from DaanDeMeyer/profiles-prep
Jörg Behrmann [Tue, 25 Apr 2023 16:01:57 +0000 (18:01 +0200)] 
Merge pull request #1509 from DaanDeMeyer/profiles-prep

Profiles preparation

2 years agoUnbreak Invokinguser
Joerg Behrmann [Tue, 25 Apr 2023 15:10:34 +0000 (17:10 +0200)] 
Unbreak Invokinguser

2 years agochdir() without going back in parse() 1509/head
Daan De Meyer [Tue, 25 Apr 2023 12:58:35 +0000 (14:58 +0200)] 
chdir() without going back in parse()

We never need to leave the directory specified with --directory, so
let's not leave it.

2 years agoMake sure path to parse_config() is correct after chdir()
Daan De Meyer [Tue, 25 Apr 2023 12:57:00 +0000 (14:57 +0200)] 
Make sure path to parse_config() is correct after chdir()

2 years agoMove cache, build and install directories to [Output] section.
Daan De Meyer [Tue, 25 Apr 2023 11:53:37 +0000 (13:53 +0200)] 
Move cache, build and install directories to [Output] section.

2 years agoRemove distro specific output directory
Daan De Meyer [Tue, 25 Apr 2023 11:41:42 +0000 (13:41 +0200)] 
Remove distro specific output directory

Let's move the cache images to mkosi.cache/ and go back to non
distro specific output directories. This gives us a stable path
for the build outputs that doesn't depend on the specific distro or
version used.

2 years agoRestore old PATH when prepend_to_environ_path finishes
Daan De Meyer [Tue, 25 Apr 2023 10:42:17 +0000 (12:42 +0200)] 
Restore old PATH when prepend_to_environ_path finishes

2 years agoMake bump and genkey CLI image independent verbs
Daan De Meyer [Tue, 25 Apr 2023 10:19:30 +0000 (12:19 +0200)] 
Make bump and genkey CLI image independent verbs

In preparation for adding multiple images support, let's make these
commands work only with command line arguments.

2 years agoSplit MkosiArgs from MkosiConfig
Daan De Meyer [Tue, 25 Apr 2023 09:21:50 +0000 (11:21 +0200)] 
Split MkosiArgs from MkosiConfig

Let's put the arguments that are not associated with an image into
a separate dataclass.

2 years agoReturn MkosiConfig from MkosiConfigParser.parse()
Daan De Meyer [Tue, 25 Apr 2023 09:03:50 +0000 (11:03 +0200)] 
Return MkosiConfig from MkosiConfigParser.parse()

2 years agoRemove support for passing arguments to the build script.
Daan De Meyer [Tue, 25 Apr 2023 09:14:09 +0000 (11:14 +0200)] 
Remove support for passing arguments to the build script.

This doesn't end up working well in practice, so let's drop support
for this.

2 years agoUse default_factory for selecting default mirror
Daan De Meyer [Mon, 24 Apr 2023 20:57:57 +0000 (22:57 +0200)] 
Use default_factory for selecting default mirror

2 years agoMerge pull request #1508 from behrmann/evenmorematch
Jörg Behrmann [Tue, 25 Apr 2023 14:05:27 +0000 (16:05 +0200)] 
Merge pull request #1508 from behrmann/evenmorematch

Allow globs if image ID matches and implement not equal for image version matches

2 years agoMerge pull request #1500 from behrmann/followupsv1
Daan De Meyer [Tue, 25 Apr 2023 13:35:55 +0000 (15:35 +0200)] 
Merge pull request #1500 from behrmann/followupsv1

Assorted followups

2 years agodoc: add a table which match supports what 1508/head
Joerg Behrmann [Tue, 25 Apr 2023 13:21:09 +0000 (15:21 +0200)] 
doc: add a table which match supports what

2 years agoconfig: allow globs when matching image IDs
Joerg Behrmann [Tue, 25 Apr 2023 12:39:56 +0000 (14:39 +0200)] 
config: allow globs when matching image IDs

2 years agoci: drop unneeded build dependency
Joerg Behrmann [Tue, 25 Apr 2023 12:21:08 +0000 (14:21 +0200)] 
ci: drop unneeded build dependency