Commit graph

31 commits

Author SHA1 Message Date
Tom Gundersen
ecaed3bbfa stages/grub2: don't set up a partition table
We only need the filesystem with the correct fs-UUID to chroot into,
there is no need to set up a whole partition table.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-27 16:22:30 +02:00
Tom Gundersen
779e5c40ea stages/grub2: set default entry
Without a default and/or timeout set, grub refuses to boot.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-26 13:46:19 +02:00
Tom Gundersen
d9488e5f8b losetup: make sure image sizes are multiples of 512K sectors
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-26 12:57:20 +02:00
Tom Gundersen
b540eb5ee7 losetup: create and attach images to loopback devices in one operation
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-26 12:45:35 +02:00
Tom Gundersen
63a4f795dc stages/selinux: add an selinux stage
This stage labels the target tree based on an SELinux policy already
installed in the target.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-21 13:36:49 +02:00
Tom Gundersen
a428ff05ad assemblers/qcow2: move from the old stage and make it work again
Minor ajustments needed after we changed the internal API.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-19 19:49:53 +02:00
Tom Gundersen
4742ae1e72 stages/locale: fix typo
Add missing quotes around a string.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-19 18:49:21 +02:00
Tom Gundersen
a2441bf112 stages/dnf: allow both operation and verbosity to be configurable
This is for the sake of debuggability, but I figure dnf is the most
complex of our tools, so instrumenting that a bit makes sense.

The defaults are "install" and "info", as before.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-19 16:08:29 +02:00
Tom Gundersen
4b69d02dc8 stages/systemd: minor fixes
We cannot use the tool from within the tree unless we chroot
(library versions ay be wring etc). If possible we want to
always use tools from the build image, in order to avoid forcing
the contenst of the target tree, so do that instead.

Finally, add a missing include.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-18 23:54:23 +02:00
Tom Gundersen
b38506a702 stages/dnf: allow other operations on the provided packages than 'install'
We would like to avoid 'upgrading', but let's allow it in the tools.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-18 23:53:27 +02:00
Tom Gundersen
31a5eed4d9 stages: fix cp usage
We want to copy the contents of a directory to another, the correct
syntax for that is `cp -a src/. dst`. I was not aware of this beauty,
so the previous patch simulated the functionality in python code.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-18 09:48:35 +02:00
Tom Gundersen
f246ccf11e stages/assemblers: add tree/untree assembler and stage
In the simplest case we don't need to make an image, a filesystem tree
will do. Also support using such a tree as input for further pipelines
through the untree stage.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-17 17:44:04 +02:00
Tom Gundersen
6ae19579c1 stages/io.weldr.grub2: add a stage to generate grub2 configuration
The stage populates the tree with grub2 configuration. The API and
semantics is the way we want it, but internally this is a massive
hack.

GRUB2 is only able to run grub2-mkconfig on the image it wants to
configure. The reason is that it will inspect / and /boot to detect
the existing UUIDs and filesystems to use, despite this being
information we already know. In principle, the tool does support
passing this is, but due to several bugs that functionality does
not work.

We therefore create the image we want, copy over the tree, run
grub2-mkconfig in this image, then copy it back over the tree. The
end result is that the files /etc/defaults/grub,
/boot/grub2/grub.cfg and /boot/grub2/grubev are added to the tree.

The alternative would be to do what tools typically do, and just
run grub2-mkconfig on the final image at the time it is being
assembled. We want to avoid this in order to fully split filesystem
tree generation from image assembly. This way we can better control
and verify what ends up on the filesystem which should help with
reprobucibility and reuse of filesystem trees. Above all though,
we want to make sure that we can actually place some guarantees
on what each stage of the image building process actually does,
allowing us to argue about and change it without worrying about
arbitrary fallout.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-17 14:55:42 +02:00
Lars Karlitski
92f3af94f6 stage api: pass options in a separate key
This avoids name clashes between osbuild and stage options.
2019-06-16 12:07:27 +02:00
Lars Karlitski
c0769fc318 Add assemblers/ directory 2019-06-14 19:46:37 +02:00
Tom Gundersen
fc72b5cd03 stages/untargz: add a stage to populate a tree from a tar.gz
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-12 19:46:39 +02:00
Tom Gundersen
35917303c8 stages/targz: add a targz stage
This generates a tarball of the tree.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-12 18:55:49 +02:00
Tom Gundersen
34de8e0274 osbuild: always pass an input_dir argument
All stages must be able to handle an input_dir argument, as we now
either pass it to all or none for agiven run. Simply set it to
'None' if it is not provided.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-12 18:54:31 +02:00
Lars Karlitski
01aa00837f osbuild: drop state
Stages should be as stateless as possible. Don't provide an easy way out
of that.

Only the dnf stage used stage to save the dnf cache. That's only useful
during development and can be solved by pointing to a local repo mirror.
2019-06-12 15:23:45 +02:00
Lars Karlitski
5e7a111120 osbuild: run further setup in build environment
Introduce `run-stage` script, which sets up the build environment before
running the stage. Run `ldconfig`, `systemd-sysusers`, and
`systemd-tmpfiles` in it.
2019-06-07 21:33:31 +02:00
Lars Karlitski
7999ef9f9d anaconda: don't fail when systemd-tmpfiles returns !0 2019-06-07 13:34:23 +02:00
Lars Karlitski
5f59cc0cb4 osbuild: only use /usr from the host
Use systemd-nspawn's "volatile" mode, which creates a tmpfs for the root
directory. This ensures that we're not accidentally using configuration
from the host.

The only remaining hole is `/etc/pki`.

Anaconda cannot run without its configuation in `/etc`. Recreate the
defaults.
2019-06-07 13:14:21 +02:00
Tom Gundersen
cdcfa1277e osbuild: make state handling generic
Rather than treating the dnf-cache specially, give each stage its
own state directory that they can reuse. This should obviously be
used with care by the stages in order to make the builds
reproducible.
2019-06-06 19:37:49 +02:00
Tom Gundersen
d557784c8c osbuild: do not set up API VFS in the target tree
Some stages will be chrooting into the target to run things there,
and they will require the standard API VFS to be mounted. Some
tools do that themselves, other do not. In all cases, we would like
to discourage running things in the target tree.

For these reasons do not pre-mount the API VFS, but require the
stages who need it to do the mounting themselves. This is a partial
revert of f6023ed78b.
2019-06-06 16:52:03 +02:00
Lars Karlitski
a04ec2c4b0 Add some more stages 2019-06-05 17:29:08 +02:00
Lars Karlitski
f6023ed78b Bind-mount vfs directories for each stage
Many of the stages need it anyway.
2019-05-06 00:23:56 +02:00
Lars Karlitski
61a59b7ad0 dnf: Simplify writing dnf.conf
Every stage gets its own private /tmp. There's no need to find unique
names or cleaning up.
2019-05-05 23:54:07 +02:00
Lars Karlitski
3a3c35ba99 anaconda: Remove unused import 2019-05-05 23:33:21 +02:00
Lars Karlitski
c6e45d4357 Add io.weldr.qcow2
A stage that makes a bootable .qcow2 image out of the tree.
2019-04-09 18:43:21 +02:00
Lars Karlitski
a1d9272866 Add io.weldr.ansible
Run an Ansible playbook on the tree, using Ansible's chroot connection
type.
2019-04-09 16:57:25 +02:00
Lars Karlitski
ae1afef209 osbuild 2019-04-08 13:03:13 +02:00