]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
2 years agogentoo: Use bwrap() instead of run_workspace_command() to run emerge 1667/head
Daan De Meyer [Thu, 6 Jul 2023 11:34:59 +0000 (13:34 +0200)] 
gentoo: Use bwrap() instead of run_workspace_command() to run emerge

Similar to the other distros, run the package manager with bwrap()
instead of run_workspace_command(). Also disable the sandboxing of
emerge as we do it in mkosi already.

2 years agogentoo: Drop --keep-going
Daan De Meyer [Thu, 6 Jul 2023 11:38:48 +0000 (13:38 +0200)] 
gentoo: Drop --keep-going

If we fail to emerge a package, we want to fail the emerge process
instead of trying to continue.

2 years agoMerge pull request #1691 from DaanDeMeyer/distribution
Daan De Meyer [Fri, 21 Jul 2023 09:55:11 +0000 (11:55 +0200)] 
Merge pull request #1691 from DaanDeMeyer/distribution

Distribution stuff

2 years agocentos: Remove distribution specific checks 1691/head
Daan De Meyer [Fri, 21 Jul 2023 09:16:51 +0000 (11:16 +0200)] 
centos: Remove distribution specific checks

This also reworks the mirror specification for centos and related
distros to duplicate less code. gpgurls of the Repo() struct is also
made into a tuple instead of a list.

2 years agoSimplify become_root()
Daan De Meyer [Thu, 20 Jul 2023 14:27:40 +0000 (16:27 +0200)] 
Simplify become_root()

- Instead of forking, use spawn() to start the newuidmap, newgidmap
processes early
- Instead of multiprocessing.Event(), use flock to handle the necessary
locking

2 years agofedora: Remove distribution specific checks
Daan De Meyer [Fri, 21 Jul 2023 07:33:30 +0000 (09:33 +0200)] 
fedora: Remove distribution specific checks

This also drops support for specifying rawhide-f37, etc.

2 years agoKernel modules fixlets
Daan De Meyer [Thu, 20 Jul 2023 13:36:12 +0000 (15:36 +0200)] 
Kernel modules fixlets

- Add some more information on what we're doing
- Move running modinfo and calculating dependencies out of the files()
generator so that the "Making cpio" step doesn't include running modinfo
and calculating the dependencies.

2 years agoMerge pull request #1686 from DaanDeMeyer/env
Daan De Meyer [Thu, 20 Jul 2023 11:34:30 +0000 (13:34 +0200)] 
Merge pull request #1686 from DaanDeMeyer/env

Stop tmpfiles from creating subvolumes

2 years agoRework selinux labelling 1686/head
Daan De Meyer [Thu, 20 Jul 2023 10:39:54 +0000 (12:39 +0200)] 
Rework selinux labelling

Let's run setfiles on the host instead of inside the image. To make
this work, we have to explicitly tell it to use the binary policy
from the image to check contexts against.

2 years agoOnly execute preset, hwdb, sysusers tools if they are available
Daan De Meyer [Thu, 20 Jul 2023 09:34:39 +0000 (11:34 +0200)] 
Only execute preset, hwdb, sysusers tools if they are available

Let's reduce the number of dependencies needed to create a tools tree
by only executing these tools if they are installed on the system.

2 years agoStop tmpfiles from creating subvolumes
Daan De Meyer [Thu, 20 Jul 2023 08:55:41 +0000 (10:55 +0200)] 
Stop tmpfiles from creating subvolumes

Generally when building an image there's no point in creating nested
subvolumes in these directories so let's disable that.

2 years agoMove default environment into MkosiConfig
Daan De Meyer [Thu, 20 Jul 2023 08:45:41 +0000 (10:45 +0200)] 
Move default environment into MkosiConfig

We already do this for --kernel-command-line-extra and --credential,
let's be consistent and do --environment the same way.

2 years agoMerge pull request #1682 from DaanDeMeyer/rework-tools
Daan De Meyer [Thu, 20 Jul 2023 07:38:49 +0000 (09:38 +0200)] 
Merge pull request #1682 from DaanDeMeyer/rework-tools

Rework user/mount namespace handling and tools tree

2 years agogentoo: stop passing USE environment to emerge
Paymon MARANDI [Wed, 19 Jul 2023 16:03:58 +0000 (12:03 -0400)] 
gentoo: stop passing USE environment to emerge

also make sure we stay with systemd-9999 (version built from git) in
order keep up with changes in systemd

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agoRework user/mount namespace handling and tools tree 1682/head
Daan De Meyer [Mon, 17 Jul 2023 21:21:38 +0000 (23:21 +0200)] 
Rework user/mount namespace handling and tools tree

The biggest change is that instead of making bwrap() responsible
for mounting the tools tree, we do it ourselves before we build/boot
each image. We do the same for remounting the top level directories
read-only, instead of leaving it to bwrap(), we do it once at the
start of run_verb(). Because we now mess with the host system mounts
ourselves again, we also go back to unconditionally unsharing a mount
namespace, even when running as root.

With the above out of the way, there's no real reason left to run
regular executables with bwrap(), so those are moved back to be
executed using run(). The above changes also remove the need for
bwrap_cmd(), so it is merged back with bwrap() again.

One nasty caveat of overmounting /usr ourselves at the start of
execution is that some python modules are loaded dynamically and we
need to make sure this has happened before we start overmounting /usr.

Finally, this commit also gets rid of running the image build in a
subprocess. Instead, after doing the build and doing the final tools
tree mount for the image we're going to boot/qemu/ssh into, if we're
going to do an unprivleged operation, we change uid/gid to the invoking
user. This is more or less the same as running these operations unprivileged
outside of the user namespace.

For boot/shell, these only run privileged, so we check beforehand
that we're running as root, and this doesn't change after become_root(),
so since we're just root all the time, there's no need to run the image
build in a subprocess.

To keep ssh working, we have to trick it into recognizing our user in
the user namespace by overmounting /etc/passwd with a file containing
an entry for the mapped user uid.

We also unify more of the uid/gid handling in run_verb() in general.

2 years agoAllow overriding the python interpreter used by mkosi
Daan De Meyer [Tue, 18 Jul 2023 09:15:12 +0000 (11:15 +0200)] 
Allow overriding the python interpreter used by mkosi

e.g. on CentOS 8 python3 is python 3.6. python 3.9 can be installed,
but it'll be installed as python3.9, so we need a way to override the
interpreter used by mkosi.

2 years agoRevert "Rename various "root" arguments to "tools""
Daan De Meyer [Mon, 17 Jul 2023 16:06:33 +0000 (18:06 +0200)] 
Revert "Rename various "root" arguments to "tools""

This reverts commit 41ef3c05e1d1caec39c9917b2776aee4f0c29599.

2 years agoRevert "Make tools= argument for bwrap() required"
Daan De Meyer [Mon, 17 Jul 2023 16:04:31 +0000 (18:04 +0200)] 
Revert "Make tools= argument for bwrap() required"

This reverts commit 2bd37a648bcace0ae505328a51eed78c9cb923b4.

2 years agoRevert "Add our own "which" implementation"
Daan De Meyer [Mon, 17 Jul 2023 16:04:12 +0000 (18:04 +0200)] 
Revert "Add our own "which" implementation"

This reverts commit d0d2044316548123eaa9fca3745d29a653107edd.

2 years agoMake tools= argument for bwrap() required
Daan De Meyer [Mon, 17 Jul 2023 14:57:14 +0000 (16:57 +0200)] 
Make tools= argument for bwrap() required

We generally always want this to be used, so let's make it required.
Also, add tools= to the one invocation of bwrap() that wasn't
forwarding it yet.

2 years agoMerge pull request #1677 from DaanDeMeyer/cache
Jörg Behrmann [Mon, 17 Jul 2023 14:24:38 +0000 (16:24 +0200)] 
Merge pull request #1677 from DaanDeMeyer/cache

Rework chrooting and add scripts support to bwrap()

2 years agoMake sure util-linux is installed in the initrd
Daan De Meyer [Mon, 17 Jul 2023 11:30:01 +0000 (13:30 +0200)] 
Make sure util-linux is installed in the initrd

systemd on Fedora prefers to install util-linux-core instead of
util-linux which doesn't ship sulogin which makes starting
emergency.service enter an infinite loop. Let's make sure util-linux
is installed so sulogin is available in the initrd.

2 years agoAdd our own "which" implementation 1677/head
Daan De Meyer [Mon, 17 Jul 2023 07:50:28 +0000 (09:50 +0200)] 
Add our own "which" implementation

shutil.which() doesn't take into account any configured tools tree
so let's implement our own which() that does take the tools tree into
account.

2 years agoRename extra argument of invoke_apt() to packages
Daan De Meyer [Sun, 16 Jul 2023 21:46:13 +0000 (23:46 +0200)] 
Rename extra argument of invoke_apt() to packages

2 years agoAdd scripts support to bwrap() and use it for chrooting
Daan De Meyer [Sun, 16 Jul 2023 20:24:38 +0000 (22:24 +0200)] 
Add scripts support to bwrap() and use it for chrooting

The new scripts argument to bwrap() allows providing a mapping of
script names to command lines. Each of these becomes a script in a
directory that's prepended to PATH before executing the command
given to bwrap(). This allows us to make extra commands available
to scripts we execute with bwrap().

The first usage of this is to replace the extra argument which is
used to provide the extra arguments to chroot into the root directory.
Instead, we provide a chroot script and use that in the command line
we pass to bwrap() to perform the chroot.

2 years agoDrop checks for binaries in config loading
Daan De Meyer [Sun, 16 Jul 2023 19:25:00 +0000 (21:25 +0200)] 
Drop checks for binaries in config loading

These might be in the tools tree so let's not check whether they
exist early.

2 years agoStop prepending extra search paths during config validation
Daan De Meyer [Sun, 16 Jul 2023 18:24:12 +0000 (20:24 +0200)] 
Stop prepending extra search paths during config validation

Not required anymore now that we have version comparisons in pure
python.

2 years agoRemove kwargs argument from run() and spawn()
Daan De Meyer [Sun, 16 Jul 2023 17:57:54 +0000 (19:57 +0200)] 
Remove kwargs argument from run() and spawn()

Let's prefer listing arguments explicitly so that mypy can catch
the wrong ones easily.

2 years agoImplement run_workspace_command() on top of bwrap()
Daan De Meyer [Sun, 16 Jul 2023 16:09:01 +0000 (18:09 +0200)] 
Implement run_workspace_command() on top of bwrap()

Instead of duplicating the apivfs setup between bwrap() and
run_workspace_command(), let's make bwrap() responsible for setting
up the apivfs and implement chrooting on top of it. Specifically,
to chroot, we just run bwrap nested to do the chroot and any
additional setup before running the actual command. This is implemented
in the new chroot_cmd() function which returns the command to do the
chroot. This also sets the stage for running scripts on the host and
somehow providing the chroot_cmd() command to scripts to use themselves
to run something inside the root directory.

To keep --debug-shell working smoothly for scripts, we pass the chroot
command as a new extra argument to bwrap() so we can also apply it when
starting the debug shell.

We also rework the /etc/resolv.conf bind mounting so we don't have
to do any cleanup after the command finishes.

2 years agoReplace kwargs from bwrap with individual arguments
Daan De Meyer [Sun, 16 Jul 2023 16:01:43 +0000 (18:01 +0200)] 
Replace kwargs from bwrap with individual arguments

kwargs makes it impossible for mypy to point out wrong arguments
so let's drop it in favor of individual arguments to get more out
of the type checker.

2 years agoRename various "root" arguments to "tools"
Daan De Meyer [Sun, 16 Jul 2023 15:56:25 +0000 (17:56 +0200)] 
Rename various "root" arguments to "tools"

"tools" is more descriptive than "root" about indicating that we're
passing a tree of tools.

2 years agoPut dnf command last again in the cmdline
Daan De Meyer [Sun, 16 Jul 2023 09:59:19 +0000 (11:59 +0200)] 
Put dnf command last again in the cmdline

It only has to be in front of the cmd specific options, which in
our case was only --allowerasing, so since that's gone now, let's
put the command last again.

2 years agoDrop --allowerasing dnf option
Daan De Meyer [Sun, 16 Jul 2023 09:51:55 +0000 (11:51 +0200)] 
Drop --allowerasing dnf option

We don't want to allow dnf to remove packages when installing other
packages. If it wants to do so that indicates something is wrong
elsewhere.

2 years agoFix logdir handling for dnf
Daan De Meyer [Fri, 14 Jul 2023 13:00:46 +0000 (15:00 +0200)] 
Fix logdir handling for dnf

logdir= is always taken relative to the installroot. Let's leave it
at it's default value and remove any log files from the install root
after running dnf.

2 years agoMerge pull request #1675 from DaanDeMeyer/loglevel
Daan De Meyer [Thu, 13 Jul 2023 16:25:45 +0000 (18:25 +0200)] 
Merge pull request #1675 from DaanDeMeyer/loglevel

Beef up --kernel-command-line-extra= defaults a little bit

2 years agoAdd --kernel-command-line-extra= to summary 1675/head
Daan De Meyer [Thu, 13 Jul 2023 11:13:29 +0000 (13:13 +0200)] 
Add --kernel-command-line-extra= to summary

2 years agoBeef up --kernel-command-line-extra= defaults a little bit
Daan De Meyer [Thu, 13 Jul 2023 10:51:46 +0000 (12:51 +0200)] 
Beef up --kernel-command-line-extra= defaults a little bit

Let's provide a better experience out of the box when booting an image:
- Always blacklist vmw_vmci so it can't interfere with vsock
- Always pull in network-online.target
- Configure systemd-network-generator for enp0s1 and host0 if not
  configured explicitly
- Use a default loglevel where only warnings or higher are logged to
  the serial console by the kernel
- Set SYSTEMD_SULOGIN_FORCE=1 unless configured explicitly so users
  get a shell in the initrd if something goes wrong, even if no root
  password is configured

2 years agoubuntu: Make lunar the default release
Daan De Meyer [Thu, 13 Jul 2023 13:46:39 +0000 (15:46 +0200)] 
ubuntu: Make lunar the default release

2 years agoMerge pull request #1674 from DaanDeMeyer/bwrap-0.4.0
Daan De Meyer [Thu, 13 Jul 2023 08:26:11 +0000 (10:26 +0200)] 
Merge pull request #1674 from DaanDeMeyer/bwrap-0.4.0

Add back support for bwrap 0.4

2 years agoarch: Support enabling testing repositories with --repositories 1674/head
Daan De Meyer [Thu, 13 Jul 2023 07:52:51 +0000 (09:52 +0200)] 
arch: Support enabling testing repositories with --repositories

2 years agoUse http_proxy and https_proxy from environment
Daan De Meyer [Thu, 13 Jul 2023 07:25:09 +0000 (09:25 +0200)] 
Use http_proxy and https_proxy from environment

We generally don't use environment variables passed to the process,
but let's be a little more relaxed on this policy and make sure we
use any configured proxy variables so mkosi works out of the box on
servers behind a proxy.

2 years agoAdd back support for bwrap 0.4
Daan De Meyer [Wed, 12 Jul 2023 21:15:30 +0000 (23:15 +0200)] 
Add back support for bwrap 0.4

CentOS Stream 9 is still on bwrap 0.4 which is unfortunately still
important so let's add back support for bwrap 0.4. Luckily, instead
of doing awkward template formatting, shells pass extra arguments
received when "-c" is used as arguments to the invoked command, so
we can make use of that to keep the same API for bwrap_cmd().

2 years agoci: drop building systemd-analyze
Joerg Behrmann [Wed, 12 Jul 2023 13:29:33 +0000 (15:29 +0200)] 
ci: drop building systemd-analyze

2 years agoMerge pull request #1669 from behrmann/pyversioncomp
Daan De Meyer [Wed, 12 Jul 2023 13:15:22 +0000 (15:15 +0200)] 
Merge pull request #1669 from behrmann/pyversioncomp

Reimplement version comparison in pure python

2 years agoUse -1, 0, 1 instead of 12, 0, 11 for comparisons in GenericVersion 1669/head
Joerg Behrmann [Wed, 12 Jul 2023 08:48:53 +0000 (10:48 +0200)] 
Use -1, 0, 1 instead of 12, 0, 11 for comparisons in GenericVersion

2 years agoReimplement GenericVersion without shelling out to systemd-analyze
Joerg Behrmann [Fri, 7 Jul 2023 11:49:50 +0000 (13:49 +0200)] 
Reimplement GenericVersion without shelling out to systemd-analyze

2 years agotests: add tests to exercise GenericVersion
Joerg Behrmann [Fri, 7 Jul 2023 07:54:50 +0000 (09:54 +0200)] 
tests: add tests to exercise GenericVersion

2 years agocentos: Add SIG testing repositories
Daan De Meyer [Mon, 10 Jul 2023 10:45:18 +0000 (12:45 +0200)] 
centos: Add SIG testing repositories

2 years agoopensuse: Install systemd-boot package
Daan De Meyer [Mon, 10 Jul 2023 07:42:16 +0000 (09:42 +0200)] 
opensuse: Install systemd-boot package

systemd-boot package was split from systemd in Tumbleweed, so let's
make sure we install it in CI.

2 years agoubuntu: Enable universe repository by default on kinetic and later
Daan De Meyer [Sun, 9 Jul 2023 18:24:21 +0000 (20:24 +0200)] 
ubuntu: Enable universe repository by default on kinetic and later

From kinetic onwards, the usr-is-merged package is available and
has to be installed to get a proper usrmerge system but for some
reason it's in the universe repository so we enable the universe
repository by default from kinetic onwards so we can install the
usrmerge package.

2 years agoAdd BuildSources mount points.
Marius Schiffer [Fri, 7 Jul 2023 14:59:21 +0000 (14:59 +0000)] 
Add BuildSources mount points.

2 years agoMerge pull request #1666 from DaanDeMeyer/sources
Daan De Meyer [Thu, 6 Jul 2023 10:24:15 +0000 (12:24 +0200)] 
Merge pull request #1666 from DaanDeMeyer/sources

Make BuildSources more flexible

2 years agoMake BuildSources more flexible 1666/head
Daan De Meyer [Wed, 5 Jul 2023 07:38:57 +0000 (09:38 +0200)] 
Make BuildSources more flexible

Currently, when you want to build multiple projects together, you
have to make the other projects subdirectories of the one with the
mkosi config, which is inconvenient. To make this more flexible, let's
allow specifying multiple source trees and where to mount them under
/work/src so that multiple projects can be mounted in a fixed location
regardless of their location on the host.

2 years agoStop automatically bind mounting build sources into containers
Daan De Meyer [Wed, 5 Jul 2023 07:58:45 +0000 (09:58 +0200)] 
Stop automatically bind mounting build sources into containers

This should eventually go behind a setting again, but should not be
done by default, especially since we don't do the same for virtual
machines.

2 years agoUse /work for prepare and postinst script as well
Daan De Meyer [Wed, 5 Jul 2023 07:30:06 +0000 (09:30 +0200)] 
Use /work for prepare and postinst script as well

We already use /work for the build script, let's do the same for
the postinst script and the prepare script.

2 years agoFix --incremental with build script and without build packages
Daan De Meyer [Wed, 5 Jul 2023 07:25:59 +0000 (09:25 +0200)] 
Fix --incremental with build script and without build packages

2 years agocentos: Add Special Interest Group (SIG) repositories
Daan De Meyer [Tue, 4 Jul 2023 10:36:39 +0000 (12:36 +0200)] 
centos: Add Special Interest Group (SIG) repositories

See https://wiki.centos.org/SpecialInterestGroup for more information
on SIGs. This commit only adds the Hyperscale SIG repositories. More can
be added later on an as-needed basis.

2 years agoProtect common system directories when running with bubblewrap
Daan De Meyer [Tue, 4 Jul 2023 08:51:22 +0000 (10:51 +0200)] 
Protect common system directories when running with bubblewrap

Let's make sure that even when we run as root the tools we run
can't brick the system by making core system directories read-only
bind mounts when running tools with bubblewrap.

As an example of the stuff this protects again, let's say a package
installs an absolute symlink to /usr and in the finalize script a
user tries to remove everything under this symlink, they'll end up
erasing /usr from their host system. By making /usr read-only, we
prevent this from happening.

2 years agoMerge pull request #1659 from bluca/compat
Daan De Meyer [Tue, 4 Jul 2023 08:46:18 +0000 (10:46 +0200)] 
Merge pull request #1659 from bluca/compat

Add backward-compat stubs for infrastructure options

2 years agodebian: do not assume package files are versioned 1659/head
Luca Boccassi [Tue, 4 Jul 2023 00:37:14 +0000 (01:37 +0100)] 
debian: do not assume package files are versioned

When creating a mirror the package names might not be versioned,
so if partition(_) leaves the suffix, strip it, otherwise apt
will fail

2 years agoAdd stubs for --nspawn-keep-unit, --default and --cache
Luca Boccassi [Sun, 2 Jul 2023 23:30:03 +0000 (00:30 +0100)] 
Add stubs for --nspawn-keep-unit, --default and --cache

Avoid breaking existing scripts and tools. Catch, print a warning
and delete.

2 years agoAllow always/never as booleans for backward compat
Luca Boccassi [Sun, 2 Jul 2023 23:08:07 +0000 (00:08 +0100)] 
Allow always/never as booleans for backward compat

Avoid breaking --with-network=never

2 years agoMake sure PATH is correct when using --tools-tree
Daan De Meyer [Mon, 3 Jul 2023 13:58:20 +0000 (15:58 +0200)] 
Make sure PATH is correct when using --tools-tree

2 years agoMerge pull request #1652 from DaanDeMeyer/extra-search-tree
Daan De Meyer [Mon, 3 Jul 2023 13:10:33 +0000 (15:10 +0200)] 
Merge pull request #1652 from DaanDeMeyer/extra-search-tree

Add --tools-tree= option

2 years agoMerge pull request #1658 from DaanDeMeyer/mkosi-repo
Daan De Meyer [Mon, 3 Jul 2023 12:38:17 +0000 (14:38 +0200)] 
Merge pull request #1658 from DaanDeMeyer/mkosi-repo

Repository fixes

2 years agoFail again if --repositories is specified for Gentoo 1658/head
Daan De Meyer [Mon, 3 Jul 2023 12:00:13 +0000 (14:00 +0200)] 
Fail again if --repositories is specified for Gentoo

2 years agoFix documentation for Repositories=
Daan De Meyer [Mon, 3 Jul 2023 11:59:09 +0000 (13:59 +0200)] 
Fix documentation for Repositories=

2 years agoWrite dnf/zypper default repos as mkosi.repo
Daan De Meyer [Mon, 3 Jul 2023 11:56:40 +0000 (13:56 +0200)] 
Write dnf/zypper default repos as mkosi.repo

This is more identifiable than a file named after the distribution
since such a file could conceivably be shipped by the distro as well.

2 years agoopensuse: Use http mirror
Daan De Meyer [Mon, 3 Jul 2023 11:51:38 +0000 (13:51 +0200)] 
opensuse: Use http mirror

The https mirror is still flaky with zypper, let's see if the http
mirror fares better.

2 years agoAdd --tools-tree= option 1652/head
Daan De Meyer [Sun, 2 Jul 2023 21:24:13 +0000 (23:24 +0200)] 
Add --tools-tree= option

Currently, mkosi image builds can differ depending on the host they
were built from. This can happen because we execute all kinds of
binaries to build the image and depending on the host these binaries
can differ. Usually, it's different versions of tools causing issues,
but it can also be due to different build configurations, such as rpm
writing its database in a different format depending on whether it's
executed from CentOS, Fedora, or Opensuse.

To allow for more reproducibility in image builds regardless of the
host system, this commit adds a new option --tools-tree= that allows
specifying a tree in which we look up most of the programs that we
execute during an image build.

Of course, that still leaves the question of what tree should be passed
to --tools-tree=. To solve that problem, --tools-tree= can be used
together with presets, so that as the first preset, a "bootstrap" image
can be built which can then be used with --tools-tree= in later presets.

Note that we only use /usr from the given tree. If tools end up using
config files from /etc or such, we expect those tools to expose a knob
to specify a different configuration file (instead of us overmounting
/etc).

Note that in a few cases, we don't yet execute tools in the given tree:
- systemd-analyze in GenericVersion() can't be executed in the tree
  because it could be executed during config parsing when we don't
  know the tree to use yet.
- newuidmap/newgidmap have to be executed before we can run
  bubblewrap so we can't run them in bubblewrap itself
- Figuring out the credentials is inherently tied to the host system
  so we execute all scripts and tools to figure out credentials on
  the host system as well
- mount because bubblewrap does not propagate mounts to the real root
  so any mounts we do within bubblewrap don't survive the bubblewrap
  process
- systemd-dissect for the same reason

2 years agoInline dissect_and_mount()
Daan De Meyer [Sun, 2 Jul 2023 21:59:06 +0000 (23:59 +0200)] 
Inline dissect_and_mount()

Only has one caller, so let's just inline it.

2 years agoInline grow_image() and finalize_image()
Daan De Meyer [Sun, 2 Jul 2023 19:40:59 +0000 (21:40 +0200)] 
Inline grow_image() and finalize_image()

Both have only one caller, so let's just inline the functions

2 years agoAssume systemd-nspawn --autopipe is available
Daan De Meyer [Sun, 2 Jul 2023 19:20:28 +0000 (21:20 +0200)] 
Assume systemd-nspawn --autopipe is available

We already require very recent versions of other systemd tools so
relying on --autopipe being available shouldn't be a problem
anymore.

2 years agoUse stat tool to check if we're on a btrfs subsystem
Daan De Meyer [Mon, 3 Jul 2023 11:41:28 +0000 (13:41 +0200)] 
Use stat tool to check if we're on a btrfs subsystem

Currently, we let the btrfs tool log errors when we're not on a
btrfs filesystem. Let's avoid unnecessary errors by checking if we're
on a btrfs filesystem before invoking the btrfs tool.

2 years agoMerge pull request #1653 from bluca/offline
Luca Boccassi [Mon, 3 Jul 2023 10:38:30 +0000 (11:38 +0100)] 
Merge pull request #1653 from bluca/offline

Fix offline builds with initrd or zypper

2 years agozypper: respect --local-mirror too 1653/head
Luca Boccassi [Sun, 2 Jul 2023 20:01:41 +0000 (21:01 +0100)] 
zypper: respect --local-mirror too

2 years agoinitd: respect --local-mirror too
Luca Boccassi [Sun, 2 Jul 2023 19:55:31 +0000 (20:55 +0100)] 
initd: respect --local-mirror too

2 years agoMerge pull request #1646 from DaanDeMeyer/gentoo
Daan De Meyer [Mon, 3 Jul 2023 05:28:09 +0000 (07:28 +0200)] 
Merge pull request #1646 from DaanDeMeyer/gentoo

Gentoo fixes

2 years agoDrop shell workaround in bwrap() and run_workspace_command()
Daan De Meyer [Tue, 25 Apr 2023 14:56:20 +0000 (16:56 +0200)] 
Drop shell workaround in bwrap() and run_workspace_command()

Let's use --perms and --chmod to fix the permissions of /tmp, /var/tmp
and /dev/shm instead of our hacky shell workaround. Let's also drop
all usage of shlex.join() in run() since it doesn't really by us anything.

This required bubblewrap 0.5.0.

2 years agoGentoo fixes 1646/head
Daan De Meyer [Tue, 27 Jun 2023 11:40:43 +0000 (13:40 +0200)] 
Gentoo fixes

- Use boot use flag for systemd instead of gnuefi
- Add --deep to emerge invocation to fix dep resolution failures
- Use curl to download stage3 tarball so we get a progress bar
- Do not exclude dev, proc and sys directories when extracting tarball
  (only exclude their contents)
- Copy pkgmngr/ directory into stage3/ directory wholesale instead of
  individual files
- Various coding style fixes
- Stop using Repositories= to specify binary package repositories as it
  is not its intended purpose. Instead, pass configured environment
  variables to emerge so users can set PORTAGE_BINHOST instead.

2 years agoUse a separate workdir for each overlay mount
Daan De Meyer [Tue, 27 Jun 2023 13:05:31 +0000 (15:05 +0200)] 
Use a separate workdir for each overlay mount

2 years agoopensuse: Add back support for zypper
Daan De Meyer [Sun, 2 Jul 2023 15:34:23 +0000 (17:34 +0200)] 
opensuse: Add back support for zypper

Let's add back support for zypper to build opensuse images. If both
zypper and dnf are installed, let's prefer using zypper.

2 years agodebian: drop workarounds for EoL Debian versions
Joerg Behrmann [Mon, 12 Jun 2023 13:59:24 +0000 (15:59 +0200)] 
debian: drop workarounds for EoL Debian versions

2 years agoUse systemd-repart's new --offline argument
Daan De Meyer [Tue, 27 Jun 2023 14:04:58 +0000 (16:04 +0200)] 
Use systemd-repart's new --offline argument

When building images, we never want to use loop devices, so use
--offline=yes in that case. When booting images, we know that
systemd-nspawn requires loop devices, so require them for
systemd-repart as well using --offline=no.

2 years agofedora: fix RemovePackages with dnf5
Zbigniew Jędrzejewski-Szmek [Fri, 23 Jun 2023 14:45:47 +0000 (08:45 -0600)] 
fedora: fix RemovePackages with dnf5

2 years agoMerge pull request #1570 from 257/gentoo
Daan De Meyer [Tue, 27 Jun 2023 08:40:32 +0000 (10:40 +0200)] 
Merge pull request #1570 from 257/gentoo

Gentoo

2 years agogentoo: reinstate systemd flags and lost emerge_vars 1570/head
Paymon MARANDI [Sat, 24 Jun 2023 16:11:06 +0000 (12:11 -0400)] 
gentoo: reinstate systemd flags and lost emerge_vars

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: backup vanilla PORTAGE_CONFIG, use pkgmngr if provided
Paymon MARANDI [Fri, 23 Jun 2023 14:39:19 +0000 (10:39 -0400)] 
gentoo: backup vanilla PORTAGE_CONFIG, use pkgmngr if provided

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: drop .cache_isclean
Paymon MARANDI [Thu, 22 Jun 2023 12:10:57 +0000 (08:10 -0400)] 
gentoo: drop .cache_isclean

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: don't clobber pkgmngr, rework repositories, enfore gnuefi
Paymon MARANDI [Thu, 22 Jun 2023 11:33:42 +0000 (07:33 -0400)] 
gentoo: don't clobber pkgmngr, rework repositories, enfore gnuefi

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: type properly
Paymon MARANDI [Thu, 22 Jun 2023 11:10:56 +0000 (07:10 -0400)] 
gentoo: type properly

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: drop cls.stage3_cache
Paymon MARANDI [Thu, 22 Jun 2023 11:09:30 +0000 (07:09 -0400)] 
gentoo: drop cls.stage3_cache

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: drop init/kernel
Paymon MARANDI [Thu, 22 Jun 2023 10:57:45 +0000 (06:57 -0400)] 
gentoo: drop init/kernel

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: drop documentation of portage variables used during build
Paymon MARANDI [Wed, 21 Jun 2023 17:27:49 +0000 (13:27 -0400)] 
gentoo: drop documentation of portage variables used during build

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: drop root, conform more with coding style
Paymon MARANDI [Wed, 21 Jun 2023 16:41:34 +0000 (12:41 -0400)] 
gentoo: drop root, conform more with coding style

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: install kernel only if a bootable image was requested
Paymon MARANDI [Wed, 21 Jun 2023 16:38:12 +0000 (12:38 -0400)] 
gentoo: install kernel only if a bootable image was requested

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: don't bother with @system set and bash
Paymon MARANDI [Wed, 21 Jun 2023 15:23:13 +0000 (11:23 -0400)] 
gentoo: don't bother with @system set and bash

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: hardcode stage3 path
Paymon MARANDI [Tue, 20 Jun 2023 15:41:05 +0000 (11:41 -0400)] 
gentoo: hardcode stage3 path

2 more things:
- bring back cache_clean so we extract stage3 once. that also means
  configure pkgmngr once
- add ./proc to exclusion list during extraction

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: use state.pkgmngr
Paymon MARANDI [Tue, 20 Jun 2023 15:17:56 +0000 (11:17 -0400)] 
gentoo: use state.pkgmngr

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2 years agogentoo: let portage handle thread_count
Paymon MARANDI [Tue, 20 Jun 2023 14:55:41 +0000 (10:55 -0400)] 
gentoo: let portage handle thread_count

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>