]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
12 months agodebian: Fix up os-release for unstable/sid builds 2947/head
Daan De Meyer [Thu, 8 Aug 2024 11:09:46 +0000 (13:09 +0200)] 
debian: Fix up os-release for unstable/sid builds

The version codename for unstable/sid builds is indistinguishable from
testing. Let's make sure we fix that up ourselves so that unstable image
builds can be properly distinguished from testing builds.

12 months agoCheck /etc/os-release as well in configure_os_release()
Daan De Meyer [Thu, 8 Aug 2024 11:09:02 +0000 (13:09 +0200)] 
Check /etc/os-release as well in configure_os_release()

It might not be a symlink. If that's the case, fix it up as well.

12 months agoMerge pull request #2944 from DaanDeMeyer/fix
Daan De Meyer [Wed, 7 Aug 2024 05:34:46 +0000 (07:34 +0200)] 
Merge pull request #2944 from DaanDeMeyer/fix

Don't pass down empty lists to subimages unless explicitly configured

12 months agoDon't pass down empty lists to subimages unless explicitly configured 2944/head
Daan De Meyer [Tue, 6 Aug 2024 07:57:46 +0000 (09:57 +0200)] 
Don't pass down empty lists to subimages unless explicitly configured

This makes sure that subimages use default values for list based
settings unless they were explicitly configured in configuration or
on the command line or have a non-empty default value in the main
image.

Fixes #2874

12 months agoDon't use for loop to create subimages in test
Daan De Meyer [Tue, 6 Aug 2024 07:56:56 +0000 (09:56 +0200)] 
Don't use for loop to create subimages in test

This gives us more flexibility in configuring the individual subimages.

12 months agoStore finalized values only on config object
Daan De Meyer [Tue, 6 Aug 2024 07:55:56 +0000 (09:55 +0200)] 
Store finalized values only on config object

This allows us to use context.config to determine whether a value
was specified in a configuration file or not.

12 months agoStore default values in separate namespace
Daan De Meyer [Tue, 6 Aug 2024 07:55:01 +0000 (09:55 +0200)] 
Store default values in separate namespace

This allows us to check whether a value was explicitly configured
in configuration files or on the CLI.

12 months agoProperly escape paths in virtiofsd scope names
Daan De Meyer [Mon, 5 Aug 2024 14:04:47 +0000 (16:04 +0200)] 
Properly escape paths in virtiofsd scope names

12 months agoClarify that inherited settings take priority over CLI/main settings
Daan De Meyer [Mon, 5 Aug 2024 12:24:41 +0000 (14:24 +0200)] 
Clarify that inherited settings take priority over CLI/main settings

If "inherited" settings are configured explicitly in subimages, those
values should take priority over values configured in the main config
and CLI.

12 months agoMake `{SYSEXT,CONFEXT}_SCOPE` configurable
Michael Ferrari [Mon, 5 Aug 2024 08:53:45 +0000 (10:53 +0200)] 
Make `{SYSEXT,CONFEXT}_SCOPE` configurable

By setting `SYSEXT_SCOPE` and `CONFEXT_SCOPE` environment variables the
values to write to the extension-release file can be configured.

12 months agoMerge pull request #2941 from DaanDeMeyer/scope
Daan De Meyer [Mon, 5 Aug 2024 10:43:15 +0000 (12:43 +0200)] 
Merge pull request #2941 from DaanDeMeyer/scope

Make ImageId= and ImageVersion= overridable by subimages

12 months agoAllow SectorSize= to be overridden by subimages 2941/head
Daan De Meyer [Mon, 5 Aug 2024 08:46:46 +0000 (10:46 +0200)] 
Allow SectorSize= to be overridden by subimages

Fixes #2939

12 months agoMake ImageId= and ImageVersion= overridable by subimages
Daan De Meyer [Mon, 5 Aug 2024 08:15:11 +0000 (10:15 +0200)] 
Make ImageId= and ImageVersion= overridable by subimages

Fixes #2938

12 months agoIntroduce SettingScope
Daan De Meyer [Mon, 5 Aug 2024 08:10:54 +0000 (10:10 +0200)] 
Introduce SettingScope

Let's also have a concept of inheritable settings which are inherited
by subimages but can be overridden.

12 months agoAdd "Building vagrant images with mkosi" to the readme
Daan De Meyer [Fri, 2 Aug 2024 18:39:50 +0000 (20:39 +0200)] 
Add "Building vagrant images with mkosi" to the readme

12 months agoMerge pull request #2935 from DaanDeMeyer/repository-key-fetch
Daan De Meyer [Fri, 2 Aug 2024 19:20:46 +0000 (21:20 +0200)] 
Merge pull request #2935 from DaanDeMeyer/repository-key-fetch

Enable RepositoryKeyFetch= by default on Ubuntu without a tools tree

12 months agoEnable RepositoryKeyFetch= by default on Ubuntu without a tools tree 2935/head
Daan De Meyer [Fri, 2 Aug 2024 08:14:49 +0000 (10:14 +0200)] 
Enable RepositoryKeyFetch= by default on Ubuntu without a tools tree

Ubuntu does not have distribution-gpg-keys yet, so let's enable
RepositoryKeyFetch= for it by default when a tools tree is not used.

12 months agoUse debian as the default tools tree again on Ubuntu
Daan De Meyer [Fri, 2 Aug 2024 08:13:20 +0000 (10:13 +0200)] 
Use debian as the default tools tree again on Ubuntu

Debian has distribution-gpg-keys which Ubuntu doesn't. As we'll likely
keep running into similar scenarios in the future, let's just stick with
Debian as Ubuntu's default tools tree.

12 months agoExit early if output format is none and there are no build scripts
Daan De Meyer [Fri, 2 Aug 2024 11:16:17 +0000 (13:16 +0200)] 
Exit early if output format is none and there are no build scripts

In systemd, the build script is part of a subimage so the build is
done as part of the subimage and there's nothing to do for the main
image. To speed things up a bit, exit early if there are no build
scripts and the output format is none.

12 months agoMerge pull request #2931 from DaanDeMeyer/debian
Jörg Behrmann [Fri, 2 Aug 2024 08:03:42 +0000 (10:03 +0200)] 
Merge pull request #2931 from DaanDeMeyer/debian

 Introduce RepositoryKeyFetch=

12 months agoIntroduce RepositoryKeyFetch= 2931/head
Daan De Meyer [Thu, 1 Aug 2024 10:37:50 +0000 (12:37 +0200)] 
Introduce RepositoryKeyFetch=

This setting controls whether we'll fetch GPG keys remotely or not.
We disable it by default so that we only rely on locally available GPG
keys for checking package and repository metadata signatures.

This new setting only affects dnf/zypper based distributions as apt
and pacman do not support retrieving GPG keys remotely in the first
place.

zypper does not trust GPG keys listed in gpgkey= by default so we import
local GPG keys manually with rpm to work around that.

Fixes #757

12 months agotests: Reduce duplication
Daan De Meyer [Thu, 1 Aug 2024 14:38:30 +0000 (16:38 +0200)] 
tests: Reduce duplication

Let's reduce the amount of duplication in the tests.

12 months agotests: Pass host environment when invoking mkosi
Daan De Meyer [Thu, 1 Aug 2024 14:37:14 +0000 (16:37 +0200)] 
tests: Pass host environment when invoking mkosi

12 months agoOnly use unshare to become root if we're actually going to use a scope
Daan De Meyer [Thu, 1 Aug 2024 14:35:36 +0000 (16:35 +0200)] 
Only use unshare to become root if we're actually going to use a scope

If the relevant environment variables are not set, scope_cmd() will
return an empty list and we won't use a scope after all. In that case
we don't need to use unshare either to become root and can rely on our
own become_root() function so check whether we're actually going to use
a scope or not.

12 months agotests: Simplify initrd tests
Daan De Meyer [Thu, 1 Aug 2024 13:26:32 +0000 (15:26 +0200)] 
tests: Simplify initrd tests

Let's get rid of the fixtures and just rely on the default initrd
built as part of the image itself. This also means any settings
picked up from mkosi.local.conf are applied to the initrd build.

12 months agoBump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Thu, 1 Aug 2024 22:38:02 +0000 (22:38 +0000)] 
Bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/60c9f2b924a9c5a2ddbb25e7b23e8e11b56faab9...cc6721c45a8800cc666de45493545a07a638d121)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agoBump github/codeql-action from 3.25.11 to 3.25.15
dependabot[bot] [Thu, 1 Aug 2024 22:37:58 +0000 (22:37 +0000)] 
Bump github/codeql-action from 3.25.11 to 3.25.15

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.11 to 3.25.15.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/b611370bb5703a7efb587f9d136a52ea24c5c38c...afb54ba388a7dca6ecae48f608c4ff05ff4cc77a)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agotests: Drop workaround for older Ubuntu
Daan De Meyer [Thu, 1 Aug 2024 13:13:24 +0000 (15:13 +0200)] 
tests: Drop workaround for older Ubuntu

12 months agoci: add nop versions of all scripts to our integration tests
Jörg Behrmann [Thu, 1 Aug 2024 07:53:38 +0000 (09:53 +0200)] 
ci: add nop versions of all scripts to our integration tests

12 months agoopensuse: Rename gpgurls to gpgkeys
Daan De Meyer [Thu, 1 Aug 2024 10:32:13 +0000 (12:32 +0200)] 
opensuse: Rename gpgurls to gpgkeys

12 months agoFix RepositoryKeyCheck docs
Daan De Meyer [Thu, 1 Aug 2024 09:44:28 +0000 (11:44 +0200)] 
Fix RepositoryKeyCheck docs

12 months agoInstall distribution-gpg-keys in Debian/Ubuntu tools tree if available
Daan De Meyer [Thu, 1 Aug 2024 09:11:16 +0000 (11:11 +0200)] 
Install distribution-gpg-keys in Debian/Ubuntu tools tree if available

It recently got into debian testing so let's add it to the tools tree.

12 months agoUse apt search patterns a little more
Daan De Meyer [Thu, 1 Aug 2024 09:10:13 +0000 (11:10 +0200)] 
Use apt search patterns a little more

Let's use apt search patterns more to match packages that are only
available on specific ubuntu/debian releases.

12 months agoMerge pull request #2929 from DaanDeMeyer/fixes
Daan De Meyer [Thu, 1 Aug 2024 08:55:45 +0000 (10:55 +0200)] 
Merge pull request #2929 from DaanDeMeyer/fixes

Two fixes

12 months agoDon't try to chmod /tmp if it's being bind mounted in 2929/head
Daan De Meyer [Thu, 1 Aug 2024 07:45:01 +0000 (09:45 +0200)] 
Don't try to chmod /tmp if it's being bind mounted in

12 months agoHandle SIGHUP as well
Daan De Meyer [Thu, 1 Aug 2024 07:44:29 +0000 (09:44 +0200)] 
Handle SIGHUP as well

Let's do a graceful shutdown on SIGHUP as well.

12 months agoStop always setting autologin credentials
Daan De Meyer [Wed, 31 Jul 2024 14:53:13 +0000 (16:53 +0200)] 
Stop always setting autologin credentials

Let's require users to set these automatically if they want to
have autologin without enabling the Autologin= setting. This gives
more flexibility after https://github.com/systemd/systemd/pull/33873
is merged in systemd as users can choose to enable the settings
globally or per tty depending on what they need.

12 months agoMerge pull request #2924 from DaanDeMeyer/kernel-install
Daan De Meyer [Tue, 30 Jul 2024 06:11:31 +0000 (08:11 +0200)] 
Merge pull request #2924 from DaanDeMeyer/kernel-install

Set up proper environment variables for kernel-install

12 months agoBump version to 25~devel
Daan De Meyer [Mon, 29 Jul 2024 19:14:20 +0000 (21:14 +0200)] 
Bump version to 25~devel

12 months agoRelease 24.3 v24.3
Daan De Meyer [Mon, 29 Jul 2024 19:14:20 +0000 (21:14 +0200)] 
Release 24.3

12 months agoMerge pull request #2927 from DaanDeMeyer/home
Daan De Meyer [Mon, 29 Jul 2024 19:13:58 +0000 (21:13 +0200)] 
Merge pull request #2927 from DaanDeMeyer/home

Check for $HOME environment variable as well

12 months agoaction: Show environment 2927/head
Daan De Meyer [Mon, 29 Jul 2024 18:16:55 +0000 (20:16 +0200)] 
action: Show environment

12 months agoDon't use .cache if HOME=/
Daan De Meyer [Mon, 29 Jul 2024 17:57:53 +0000 (19:57 +0200)] 
Don't use .cache if HOME=/

If the user's home directory is /, don't use .cache but use /var/cache
instead.

12 months agoCheck for $HOME environment variable as well
Daan De Meyer [Mon, 29 Jul 2024 17:43:51 +0000 (19:43 +0200)] 
Check for $HOME environment variable as well

Similar to our check for $USER, let's check for $HOME to allow
setting a custom home directory in weird build environments.

12 months agoOnly look at $USER if we can't find a user in /etc/passwd
Daan De Meyer [Mon, 29 Jul 2024 18:28:02 +0000 (20:28 +0200)] 
Only look at $USER if we can't find a user in /etc/passwd

12 months agoNudge kernel-install towards using the BLS layout 2924/head
Daan De Meyer [Mon, 29 Jul 2024 15:06:06 +0000 (17:06 +0200)] 
Nudge kernel-install towards using the BLS layout

12 months agoSet up proper environment variables for kernel-install
Daan De Meyer [Mon, 29 Jul 2024 13:38:49 +0000 (15:38 +0200)] 
Set up proper environment variables for kernel-install

If we're not explicitly disabling kernel-install during package
manager invocations, let's set up the environment to make it do the
right thing instead.

12 months agoSet $BOOT_ROOT when invoking kernel-install
Daan De Meyer [Mon, 29 Jul 2024 13:58:26 +0000 (15:58 +0200)] 
Set $BOOT_ROOT when invoking kernel-install

Instead of setting $SYSTEMD_XBOOTLDR_PATH and $SYSTEMD_ESP_PATH, let's
just set $BOOT_ROOT which does the same thing.

12 months agoBump version to 25~devel
Daan De Meyer [Mon, 29 Jul 2024 17:09:40 +0000 (19:09 +0200)] 
Bump version to 25~devel

12 months agoRelease 24.2 v24.2
Daan De Meyer [Mon, 29 Jul 2024 17:09:39 +0000 (19:09 +0200)] 
Release 24.2

12 months agoLook for $USER for the username before reading /etc/passwd
Daan De Meyer [Mon, 29 Jul 2024 15:47:47 +0000 (17:47 +0200)] 
Look for $USER for the username before reading /etc/passwd

Let's take $USER into account if set before reading /etc/passwd
for the username. This gives a way out for environments where the
uid of the user does not have an entry in /etc/passwd.

12 months agoBump version to 25~devel
Daan De Meyer [Mon, 29 Jul 2024 15:33:19 +0000 (17:33 +0200)] 
Bump version to 25~devel

12 months agoRelease 24.1
Daan De Meyer [Mon, 29 Jul 2024 15:33:18 +0000 (17:33 +0200)] 
Release 24.1

12 months agoMake do-a-release.sh handle point releases properly
Daan De Meyer [Mon, 29 Jul 2024 15:30:53 +0000 (17:30 +0200)] 
Make do-a-release.sh handle point releases properly

12 months agoHandle failure to detect the distribution in test_parse_config()
Daan De Meyer [Mon, 29 Jul 2024 10:26:51 +0000 (12:26 +0200)] 
Handle failure to detect the distribution in test_parse_config()

If /usr/lib/os-release isn't available, we can't detect the current
distribution, so let's make sure we handle that scenario as well by
checking for Distribution.custom instead of None.

Fixes #2921

12 months agoHandle dangling symlinks in rmtree() and run_clean()
Daan De Meyer [Mon, 29 Jul 2024 10:14:43 +0000 (12:14 +0200)] 
Handle dangling symlinks in rmtree() and run_clean()

12 months agoAdd missing __init__.py to mkosi/initrd/resources
Daan De Meyer [Mon, 29 Jul 2024 09:43:32 +0000 (11:43 +0200)] 
Add missing __init__.py to mkosi/initrd/resources

12 months agoAdd some documentation on how to implement a new distribution
Daan De Meyer [Mon, 29 Jul 2024 08:19:07 +0000 (10:19 +0200)] 
Add some documentation on how to implement a new distribution

12 months agocompletion: fix bash completion script
Jörg Behrmann [Sat, 27 Jul 2024 20:18:37 +0000 (22:18 +0200)] 
completion: fix bash completion script

Template the options definitions directly into the completion function, since
for some weird scoping reasons even though the script is read fine and when
running a shell with set -x one can see e.g. _mkosi_options being assigned the
proper values, the completion function still uses '' for
"${_mkosi_options[*]}".

This wasn't caught during development because the script works fine when
sourced.

12 months agoBump version to 25~devel
Daan De Meyer [Fri, 26 Jul 2024 16:05:39 +0000 (18:05 +0200)] 
Bump version to 25~devel

12 months agoRelease 24 v24
Daan De Meyer [Fri, 26 Jul 2024 16:05:36 +0000 (18:05 +0200)] 
Release 24

12 months agoUpdate NEWS
Daan De Meyer [Fri, 26 Jul 2024 15:13:07 +0000 (17:13 +0200)] 
Update NEWS

12 months agomkosi-initrd: Always add virtio_mmio to initramfs
Daan De Meyer [Fri, 26 Jul 2024 11:56:12 +0000 (13:56 +0200)] 
mkosi-initrd: Always add virtio_mmio to initramfs

12 months agomkosi-initrd: Sort module list
Daan De Meyer [Fri, 26 Jul 2024 11:55:48 +0000 (13:55 +0200)] 
mkosi-initrd: Sort module list

12 months agoFix typo
Daan De Meyer [Fri, 26 Jul 2024 11:07:50 +0000 (13:07 +0200)] 
Fix typo

12 months agoDocumentation update
Eugeny Shcheglov [Fri, 26 Jul 2024 10:33:40 +0000 (13:33 +0300)] 
Documentation update

Add IMAGE_ID and IMAGE_VERSION to the available variables list

12 months agoMerge pull request #2910 from DaanDeMeyer/qemu
Daan De Meyer [Thu, 25 Jul 2024 09:08:23 +0000 (11:08 +0200)] 
Merge pull request #2910 from DaanDeMeyer/qemu

Look up qemu and virt-fw-vars in extra search paths

12 months agoLook up qemu and virt-fw-vars in extra search paths 2910/head
Daan De Meyer [Thu, 25 Jul 2024 05:41:21 +0000 (07:41 +0200)] 
Look up qemu and virt-fw-vars in extra search paths

Because qemu uses OVMF firmware descriptions from /usr, we look
those up in the same root that we'll be invoking qemu from. Because
virt-fw-vars operates on the same files, we also invoke it in the
same root that we find qemu in.

12 months agoRemove noisy debug logging
Daan De Meyer [Thu, 25 Jul 2024 08:31:38 +0000 (10:31 +0200)] 
Remove noisy debug logging

There could potentially be a huge amount of modules and firmware
which makes these log messages very noisy. Let's drop them to make
debug logs less annoying to parse.

12 months agoAssign return code before calling sys.excepthook()
Daan De Meyer [Thu, 25 Jul 2024 07:15:13 +0000 (09:15 +0200)] 
Assign return code before calling sys.excepthook()

It seems sys.excepthook() can raise its own exception? I'm not entirely
sure what's going on, but as a safety measure, let's assign the correct
return code before we invoke sys.excepthook() so that we always exit with
the right returncode.

12 months agoMerge pull request #2779 from behrmann/completion
Zbigniew Jędrzejewski-Szmek [Wed, 24 Jul 2024 20:26:33 +0000 (22:26 +0200)] 
Merge pull request #2779 from behrmann/completion

Shell completion

12 months agoMerge pull request #2908 from DaanDeMeyer/kmod
Jörg Behrmann [Wed, 24 Jul 2024 16:47:26 +0000 (18:47 +0200)] 
Merge pull request #2908 from DaanDeMeyer/kmod

Various kernel modules improvements

12 months agoDon't clean tools tree unless at least -f is specified 2908/head
Daan De Meyer [Wed, 24 Jul 2024 15:27:26 +0000 (17:27 +0200)] 
Don't clean tools tree unless at least -f is specified

Otherwise if we run mkosi qemu and the cache is out of date we
remove the tools tree which we shouldn't do.

12 months agoAlways add all nls modules to the initramfs
Daan De Meyer [Wed, 24 Jul 2024 14:24:05 +0000 (16:24 +0200)] 
Always add all nls modules to the initramfs

Potentially required for mounting FAT filesystems so let's make sure
these are included.

12 months agoOnly include default kernel modules in default image
Daan De Meyer [Wed, 24 Jul 2024 13:47:10 +0000 (15:47 +0200)] 
Only include default kernel modules in default image

Let's add some coverage for the default modules list by enabling it
for the default image.

12 months agocompletion: forward define (hash) arrays for bash completion 2779/head
Jörg Behrmann [Wed, 24 Jul 2024 14:29:16 +0000 (16:29 +0200)] 
completion: forward define (hash) arrays for bash completion

12 months agoAlways add raid modules to the initrd
Daan De Meyer [Wed, 24 Jul 2024 13:44:20 +0000 (15:44 +0200)] 
Always add raid modules to the initrd

Raid needs to be set up from the initrd so let's make sure the
modules required to do that are always available.

12 months agoAlways dm-multipath to the initrd
Daan De Meyer [Wed, 24 Jul 2024 13:43:52 +0000 (15:43 +0200)] 
Always dm-multipath to the initrd

Required for doing multipath so let's always add it to the initrd.

12 months agoAdd all crypto modules to the initramfs
Daan De Meyer [Wed, 24 Jul 2024 13:42:51 +0000 (15:42 +0200)] 
Add all crypto modules to the initramfs

There's various crypto directories all across the kernel modules
tree. Let's make sure we include all of them so that everything
required to do crypto is always available from the initrd.

12 months agoHandle softdep module dependencies properly
Daan De Meyer [Wed, 24 Jul 2024 13:41:15 +0000 (15:41 +0200)] 
Handle softdep module dependencies properly

The softdep lines are formatted a little differently and can contain
pre: and post: so we need to make sure we handle all those cases.

12 months agokernel-install: Only build UKI if we're configured as the UKI generator
Daan De Meyer [Wed, 24 Jul 2024 14:16:13 +0000 (16:16 +0200)] 
kernel-install: Only build UKI if we're configured as the UKI generator

12 months agoDon't copy /var/lib/pacman/local when copying repository metadata
Daan De Meyer [Wed, 24 Jul 2024 10:48:42 +0000 (12:48 +0200)] 
Don't copy /var/lib/pacman/local when copying repository metadata

/var/lib/pacman/local contains the local database of installed packages.
When using "--package-cache-dir /var", we'd end up copying the local
database of the host which means pacman thinks packages are already
installed in the image even though they aren't.

Fix this by not copying /var/lib/pacman/local.

Fixes #2904

12 months agoFix typo
Daan De Meyer [Wed, 24 Jul 2024 12:20:52 +0000 (14:20 +0200)] 
Fix typo

12 months agoaction: Dump the current clock source
Daan De Meyer [Tue, 23 Jul 2024 16:20:33 +0000 (18:20 +0200)] 
action: Dump the current clock source

This can have a non-trivial performance impact so let's dump the
clock source as extra debugging information.

12 months agoIf the image is nocow, make the ephemeral copy nocow as well
Daan De Meyer [Tue, 23 Jul 2024 20:36:55 +0000 (22:36 +0200)] 
If the image is nocow, make the ephemeral copy nocow as well

On btrfs, VM images are generally recommended to be made nocow as
cow (copy-on-write) and random writes don't play well together. Let's
take this into account in copy_ephemeral() and make the ephemeral
copy nocow as well if the source is nocow.

12 months agoMove needs_clean() check out of run_clean()
Daan De Meyer [Tue, 23 Jul 2024 13:11:08 +0000 (15:11 +0200)] 
Move needs_clean() check out of run_clean()

12 months agoDrop uid/gid from cache manifest
Daan De Meyer [Tue, 23 Jul 2024 20:59:22 +0000 (22:59 +0200)] 
Drop uid/gid from cache manifest

This does not work as we call have_cache() to determine whether
we need to clean the tools tree or not and when running as root to
boot after building an image the UID/GID will differ and the tools
tree will incorrectly be considered out of date.

Let's move the UID/GID check out of have_cache() and into reuse_cache()
instead. reuse_cache() always runs after we've already potentially
unshared the user namespace and become root, so checking the owner of
the cache directory against the current UID should be a valid check
there.

12 months agoMake sure mkosi works in the initramfs
Daan De Meyer [Mon, 22 Jul 2024 13:19:16 +0000 (15:19 +0200)] 
Make sure mkosi works in the initramfs

bubblewrap uses pivot_root() which doesn't work in the initramfs as
pivot_root() requires / to be a mountpoint which is not the case in
the initramfs. So, to make sure mkosi works from within the initramfs,
let's make / a mountpoint by recursively bind-mounting / (the directory)
to another location and then switching root into the bind mount directory.

12 months agoOnly pass --expand-environment=no if we have systemd-run 254 or newer
Daan De Meyer [Mon, 22 Jul 2024 18:11:35 +0000 (20:11 +0200)] 
Only pass --expand-environment=no if we have systemd-run 254 or newer

--expand-environment= was introduced in systemd v254.

12 months agoRevert "Force user namespace in bubblewrap if we're not running as root"
Daan De Meyer [Mon, 22 Jul 2024 15:31:42 +0000 (17:31 +0200)] 
Revert "Force user namespace in bubblewrap if we're not running as root"

This reverts commit 01ac080103f2bc61ecc23334b00334e421eebb8a.

We can't check the current uid in sandbox_cmd() as it might still
change, for example in start_virtiofsd() where before we run bwrap
we might run become_root_cmd() to become root.

12 months agoMake make_cpio() take a list of files relative to the root directory
Daan De Meyer [Sun, 21 Jul 2024 21:07:01 +0000 (23:07 +0200)] 
Make make_cpio() take a list of files relative to the root directory

We operate on absolute paths all the time in kmod.py only for them to
be made relative to the root directory just before they are passed to
cpio. Let's save on the amount of allocations by always operating on
paths relative to the root directory.

Because rglob() doesn't support returning paths relative to the given
directory, we chdir() into the root directory before globbing instead.

12 months agoIgnore symlinks in /boot when fixing up kernel images
Daan De Meyer [Mon, 22 Jul 2024 08:49:59 +0000 (10:49 +0200)] 
Ignore symlinks in /boot when fixing up kernel images

12 months agoci: call shellcheck on the bash script
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jul 2024 09:48:03 +0000 (11:48 +0200)] 
ci: call shellcheck on the bash script

Sadly, shellcheck does not support zsh [1], and it's not even possible
to evaluate the script with zsh because it fails with:
  _arguments:comparguments:327: can only be called from completion function
So the zsh script shall not be checked.

[1] https://github.com/koalaman/shellcheck/issues/809

12 months agocompletions: apply suggestions from shellcheck
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jul 2024 09:21:49 +0000 (11:21 +0200)] 
completions: apply suggestions from shellcheck

readarray is used to create arrays. The one clear advantage is that we don't need to
override $IFS. Together with the change to not assign an unused variable, this
removes shellcheck warnings.

Nevertheless, shellcheck would still warn about the file because it doesn't
know about the variables that are in the part that is generated dynamically.

Also, move more content to the static resource file. The order of declarations
doesn't matter, so it's fine if the variables are defined below the functions.

Also, adjust the formatting in the bash resource to follow the usual style
with 'if something; then' on one line.

12 months agorefactor: move CompGen to config and stop parsing config
Zbigniew Jędrzejewski-Szmek [Sat, 20 Jul 2024 16:03:16 +0000 (18:03 +0200)] 
refactor: move CompGen to config and stop parsing config

Both changes requested in review.
The output generator for bash,fish,zsh is unchanged.

Also do minor whitespace and style adjustments as requested in review.

12 months agocompletion: make it a verb and factor it out into a separate file
Jörg Behrmann [Mon, 15 Jul 2024 17:55:58 +0000 (19:55 +0200)] 
completion: make it a verb and factor it out into a separate file

12 months agonews: add completion
Jörg Behrmann [Sat, 13 Jul 2024 11:57:55 +0000 (13:57 +0200)] 
news: add completion

12 months agoconfig: add missing help string
Zbigniew Jędrzejewski-Szmek [Fri, 28 Jun 2024 08:54:38 +0000 (10:54 +0200)] 
config: add missing help string

Follow-up for c036450ca6aa82f57765731240242a8ea77f31cc.

12 months agocompletion: add zsh
Jörg Behrmann [Sun, 16 Jun 2024 13:11:14 +0000 (15:11 +0200)] 
completion: add zsh

This completion of verbs is based on _timedatectl in systemd repo.
Completion for short options doesn't work. It also doesn't work for
timedatectl, so this needs to be fixed in both places.

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
12 months agocompletion: add fish
Jörg Behrmann [Wed, 12 Jun 2024 13:35:46 +0000 (15:35 +0200)] 
completion: add fish