Commit graph

291 commits

Author SHA1 Message Date
Christian Kellner
234997eeb3 stages/grub2.inst: fix prefix for dos layouts
When the partition layout is `dos` or `mbr`, the correct name for
it in the prefix is `msdos`. The function to convert the option
to the label already existed but was not used. Fix it by actually
using said function.

Reported-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-10 20:19:06 +02:00
Christian Kellner
569697e9a9 stages: add org.osbuild.untar
Add a new stage that can be used to extract a tarball.
2021-08-07 11:50:00 +02:00
Christian Kellner
ff63bb6b51 stages/fstab: fix partabel option
Use the `partlabel` value for the `partlabel` option instead of
the `label` option.
2021-08-07 11:50:00 +02:00
Ondřej Budai
7fc8ac231d stages/grub2.inst: add location to required properties
The location property is required, otherwise the stage will fail due to
KeyError at line 261:

location = options["location"]

This commit adds the property to the list of required ones.
2021-08-05 09:58:23 +02:00
Christian Kellner
9977c4e1f9 stages/nm.conn: allow creating files anywhere
Introduce a new `path` property that can be used instead of
`filename` to create files anywhere in the file system.
2021-07-28 22:01:54 +01:00
Christian Kellner
bfcc92a92e stages/nm.conn: set 0o600 permission for files
NetworkManager will refuse to load connection files that have the
to wide permsisions set. Restrict the files we create to 0o600.
2021-07-28 22:01:54 +01:00
Christian Kellner
6f7382b885 stages: add org.osbuild.nm.conf
New stage to create NetworkManager configuration files. Currently
only a subset of settings are supported. Include a simple stage
test case for it.
2021-07-28 22:01:54 +01:00
Tomas Hozza
152b14a0d6 stages/cloud-init: configuration file must contain at least one option
Add back a schema constrain, that at least one configuration must be
specified for the configuration file.

This has been forgotten/missed as part of
https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-27 10:40:04 +02:00
Christian Kellner
873defb330 stages/tar: option to not include the root node
When building the tar archive, the command that is used normally
includes the root node as `./` and also leads to all files having 
a "./" prefix. On the other hand, the oci stage as well as the 
old ostree.commit assembler, with the tarball option, would
enumerate the contents instead of passing `.`, thus not including
the rood node and also avoiding the `./` prefix. 
Add a new option `root-node` that controls whether the rood node
is included or node. 

mkdir test
touch test/file

tar -c -C test file | tar tv
-rw-r--r-- root/root         0 2021-07-22 10:39 file

tar -c -C test . | tar tv
drwxr-xr-x root/root         0 2021-07-22 10:39 ./
-rw-r--r-- root/root         0 2021-07-22 10:39 ./file
2021-07-22 15:23:39 +02:00
Christian Kellner
e1df62fdc8 stages: add org.osbuild.nm.conn
Add a new stage to configure NetworkManger system connections.
Currently only ethernet connections are supported with a limited
set of options.
2021-07-22 15:18:33 +02:00
Christian Kellner
e0db66f624 stages/fstab: support device nodes and partlabel
For the fs spec field, support traditional device nodes as well
as partition labels. Adjust the test accordingly.
2021-07-22 12:05:02 +02:00
Christian Kellner
7fde451ecd stages: extract systemd.unit from systemd
Create a new `org.osbuild.systemd.unit` stage with the code for
create systemd drop-ins extracted from `org.osbuild.systemd`.
In contrast to the old code the new stage can only handle one
drop-in file. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify additional options at the top level which
will then be per-file, like a top level comment.
The file is called `org.osbuild.systemd.unit` since in the future
it could also support creating unit files (not just drop-ins).
2021-07-22 01:05:29 +02:00
Christian Kellner
9a786ce4fc stages/logind: write only one drop-in file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify additional options at the top level which
will then be per-file, like a top level comment.
2021-07-22 01:05:29 +02:00
Christian Kellner
79c6e65976 stages/logind: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
9f1d97a8b7 stages/modprobe: write only one config file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify additional options at the top level which
will then be per-file, like a top level comment.
2021-07-22 01:05:29 +02:00
Christian Kellner
0190c991ae stages/dracut: write only one config file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify additional options at the top level which
will then be per-file, like a top-level comment.
2021-07-22 01:05:29 +02:00
Christian Kellner
a1703dc298 stages/cloud-init: write only one config file
Instead of supporting writing an arbitrary number of configuration
files, just write one. This makes the stage and its schema clearer
and simpler. If more than one config file is needed, the stage can
be repeated multiple times. It is also more flexible since we can
in the future specify the directory, `/etc` vs `/usr` via a new
top level `directory` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
0becf66454 stages/dracut.conf: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
f259b4e5ca stages/modprobe: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
9e259ae0bc stages/cloud-init: configuration_files → config
Rename the `configuration_files` key to `config` key.
2021-07-22 01:05:29 +02:00
Christian Kellner
ae1296e33a formats/v2: mounts are arrays
The order of entries in a dictionary is not specified by the JSON
standard and hard to control when marshalling dictionaries in Go.
Since the order of mounts is important and the wrong order leads
to wrong mount trees change the `mounts` field to an array. This
breaks existing manifests but after careful deliberation it was
concluded that the original schema with mounts as dictionaries
is not something we want to support. Apologies to everyone.

Adjust the schema of the copy and zipl stage accordingly.
2021-07-21 13:28:22 +02:00
Christian Kellner
31943072c7 stages/noop: allow mounts and devices
Allow the noop stage to have mounts and devices, which is useful
for testing.
2021-07-21 13:28:22 +02:00
Christian Kellner
0910320e62 stages: add org.osbuild.isolinux
New stage to configure the isolinux boot loader.
2021-07-16 15:19:58 +01:00
Christian Kellner
228323f0dc stages: add org.osbuild.squashfs
New stage to create a squahfs image.
2021-07-16 15:19:58 +01:00
Christian Kellner
fb2786e4dd stages/grub2.iso: small refactoring
Small changes to the schema so it better aligns with the need of the
stage:
  move the efi properties to the top-level
  kernel information is under `kernel` object
  kernel command line options is an array now
Change `linuxefi` to `linux` which should work on RHEL 8 and is the
only thing that works on arm64.
Small PEP-8 fixes.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2021-07-16 13:20:45 +02:00
Antonio Murdaca
dd13ec24fb stages: add org.osbuild.grub2.iso stage
Add a new stage to build a boot filesystem tree

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2021-07-16 13:20:45 +02:00
Christian Kellner
887e1bd8aa stages/kickstart: support for users and groups
Add support for creating groups and users during the installation
via the corresponding kickstart directives.
2021-07-15 23:08:51 +01:00
Tomas Hozza
7617cb9a44 stages/authselect: rename profile_id option to profile
Rename the `profile_id` option to `profile` in the stage schema. This is
a follow-up to PR#696 comment after is has been merged [1].

[1] https://github.com/osbuild/osbuild/pull/696#discussion_r661253293

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-15 17:17:50 +02:00
Christian Kellner
0d625f34ea stages/fstab: add support for OSTree
Add experimental support for writing the fstab file to `/etc` in on
OSTree deployment. Experimental here means that options might be
replaced in the near future with a different mechanism and are thus
not considered stable API.
2021-07-12 18:21:05 +02:00
Christian Kellner
3d197247b2 stages: add org.osbuild.ostree.selinux
Fix SELinux labels for an OSTree deployment.
2021-07-12 18:21:05 +02:00
Christian Kellner
467f313cee stages: add org.osbuild.ostree.remotes
Configure OSTree remotes for a repository.
2021-07-12 18:21:05 +02:00
Christian Kellner
98d0a856df stages: add org.osbuild.ostree.fillvar
Pre-populate /var directory for a given deployment.
2021-07-12 18:21:05 +02:00
Christian Kellner
d284bc0ef2 stages: add org.osbuild.ostree.deploy
Create an OSTree deployment[1] for a given ref.
2021-07-12 18:21:05 +02:00
Christian Kellner
d793ffd805 stages: add org.osbuild.ostree.config
Change OSTree configuration for a repository via `ostree config`.
2021-07-12 18:21:05 +02:00
Christian Kellner
ee124df336 stages: add org.osbuild.ostree.init-os
Initializes a new stateroot (see [1]) for the OS with the
name `osname`.
2021-07-12 18:21:05 +02:00
Christian Kellner
784d29218f stages: add org.osbuild.ostree.init-fs
Creates the basic file system layout for an OSTree based system.
2021-07-12 18:21:05 +02:00
Christian Kellner
c5c5550ad5 stages/qemu: remove mixed indention
Only spaces, no tabs!

Reported-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-07-09 19:50:38 +01:00
Christian Kellner
4456e1f276 stages: add org.osbuild.mkdir
Can create one or more directories, optionally also their parents.
Add some basic tests as well.
2021-07-08 21:14:21 +01:00
Achilleas Koutsou
6636d390d6 stages/nginx.conf: SCHEMA_2 2021-07-01 10:49:38 +02:00
Achilleas Koutsou
c77767c788 stages/chmod: SCHEMA_2 2021-07-01 10:49:38 +02:00
Christian Kellner
ace07f2656 stages/tar: support choosing the format
Add support different archive formats. The list is taken from what `tar`
currently supports.
2021-06-30 17:36:40 +02:00
Christian Kellner
dfda290d6a stages: add org.osbuild.xz to compress files
Add a new stage that will take a file from the input and compress
it via xz.
2021-06-30 12:06:30 +02:00
Tomas Hozza
88da3beabc stages/authselect: new stage to select system identity and auth sources
Add a new `org.osbuild.authselect` stage for configuring system identity
and authentication sources using `authselect`. The stage runs
`authselect select` command from the image in a chroot to set the
desired 'profile_id' profile. Optionally, a list of specific profile
features to enable can be passed using the 'features' option.

Add a test case for the new stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-30 09:17:08 +02:00
Tomas Hozza
6140ba1130 stages/keymap: add option to configure X11 keyboard
Add a new option 'x11-keymap' for configuring the X11 keyboard settings.
The value of the option is a dictionary with keys representing settings
which can be configured. Currently, only the 'layouts' setting can be
configured. Its value is a list of strings, representing the specific
layouts, which should be configured for the X11 keyboard.

Update the stage test case with the new option 'x11-keymap'.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-29 17:57:18 +02:00
Achilleas Koutsou
158d6da415 stages: add org.osbuild.chmod
Add new stage to change the mode bits of files in the tree.
2021-06-28 19:07:42 +02:00
Achilleas Koutsou
a411ba2270 stages: add org.osbuild.nginx.conf
Add new stage for writing an nginx configuration file.
2021-06-28 19:07:42 +02:00
Tomas Hozza
5dc72038ef stages/chrony: extend chrony stage to allow additional directives
The `org.osbuild.chrony` stage currently supports only a single option
'timeservers' which does not allow specifying additional options for the
configured timeservers. The option can not be easily extended to allow
specifying additional options and at the same time keep the backward
compatibility with old manifests.

The need for a lower-level stage option allowing to configure additional
options of the 'server' directive is required by RHEL AMI images, which
use 'maxpoll', 'minpoll' and 'prefered' options.

Extend the `org.osbuild.chrony` stage with two additional options. The
'servers' option accepts a list of dictionaries specifying timeservers
to be configured using the 'server' directive, including a subset of the
directive options. The 'servers' option can not be used at the same time
in the stage options as the 'timeservers' option.

The second added option is 'leapsectz' corresponding with a directive of
the same name. The value of the option is a string. If the provided
string is empty, then all occurrences of the 'leapsectz' directive are
removed from the `chrony.conf`. Otherwise, the 'leapsectz' directive is
added to the `chrony.conf` with the provided value, while all original
occurrences of the option are removed.

Add a new stage test case under `test/data/stages/chrony-servers` to
test the new variant of the stage options. The reason is that the
'timeservers' option conflicts with 'servers' option, which makes it
impossible to test both of them in the same test case.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-26 10:28:03 +01:00
Tomas Hozza
e96366fb10 stages/cloud-init: add new stage for configuring cloud-init
Add new `org.osbuild.cloud-init` stage, which currently allows to create
configuration files for cloud-init under `/etc/cloud/cloud.cfg.d`. The
stage supports only a very limited subset of cloud-init configuration
options, which is covering needs of RHEL AMI images.

The schema mandates that if the 'configuration_files' option is
specified, then at least one configuration file must be defined. In
addition each section of the configuration must contain at least one
property (section or configuration option).

Add `python3-pyyaml` package to the `F34-build` testing manifest,
because it is required for running and testing the new stage.
Regenerate all affected manifests.

Add test for the new stage.

Update the `osbuild-ci` container image used for testing to a new tag,
which includes python3-pyyaml, the dependency of the new stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-24 16:55:18 +02:00
Tomas Hozza
751fd5cd28 stages/dracut.conf: add new stage for creating dracut config files
Add new `org.osbuild.dracut.conf` stage. The option
'configuration_files' allows to create dracut configuration files under
`/usr/lib/dracut/dracut.conf.d` and thus make the
configuration persistent. The stage supports only a subset of all
configuration options allowed in dracut configuration. The intention is
to provide almost functional parity with the options supported by
`org.osbuild.dracut` stage.

The schema mandates that at least one configuration file must be defined
in the stage options. In addition, each configuration file must contain
at least one configuration option.

Add test for the new stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-06-24 12:43:00 +02:00
Christian Kellner
161edb344d stages/copy: fix schema for tree urls
The `tree` url does not take a net location because it makes no
sense there since there is only one tree.
2021-06-21 23:39:04 +02:00