Commit Graph

174 Commits

Author SHA1 Message Date
Marcus Schäfer
1385187ccf
Allow ignore stanza in bootstrap
So far the <ignore> stanza was only effective when placed
as part of the type="image" packages section. This commit
allows to place it also to the type="bootstrap" packages.
This Fixes #2499
2024-03-22 10:33:04 +01:00
Marcus Schäfer
2540d56602
Add support for discoverable partitions
Set PARTUUID according to systemd-id128 if applicable
This Fixes #1385
2024-02-26 09:42:01 +01:00
Marcus Schäfer
d154317573
Fix reading of os-release file
If the /etc/os-release file contains comments or spaces
python's csv reader will throw an exception. Thus this
data must be ripped out prior reading
2024-01-31 10:30:22 +01:00
Marcus Schäfer
bddf25559d
Compat entry name for kernel-install in sd-boot
systemd-boot tools like kernel-install expect a certain
entry naming policy. This commit adapts kiwi to adapt to
this policy. The name for the default entry is constructed
out of the ID information from /etc/os-release followed
by the name of the kernel as it is represented by the
directory name in /lib/modules/... This Fixes #2417
2024-01-13 23:25:41 +01:00
Marcus Schäfer
f5d2683776
Update unit test data to schema v8.0 2024-01-11 09:46:23 +01:00
Marcus Schäfer
b7bf4099b6
Support release version in signkey URLs
Using one of the $releasever/${releasever} variable placeholders
in an URL as part of a <signing key="..."/> element did not replace
the placeholder with the value of the <release-version> element.
This commit fixes this and also makes sure that the result list
for downloading signing keys is unique. This Fixes #2381
2023-10-16 09:23:42 +02:00
Marcus Schäfer
fa544b4a87
Add kiwi_live_volid variable to profile
As part of the profile environment only the kiwi_install_volid
variable existed with the default value 'INSTALL'. This information
is correct when building an oem image with installiso set to
true. The resulting .install.iso image has the configured volid
or the mentioned default 'INSTALL'. However, when building a live
ISO image the default volid value is set to 'CDROM' but the profile
environment contains kiwi_install_volid which is misleading and
in case no volid is provided in the configuration file, the
default value would also be a wrong information. This commit cleans
up the mess and provides kiwi_install_volid for install ISO media
and kiwi_live_volid for Live ISO media with their respective
default values
2023-08-15 22:23:49 +02:00
Marcus Schäfer
7ac14458af Refactor the luks_device class data transport
Also add missing unit tests
2023-07-05 12:30:38 +02:00
Marcus Schäfer
ae6effd5de
Change package manager dnf to dnf4
With dnf5 there is a successor for dnf but there will also
be a transition period where there will be both, the former
dnf and the new dnf5 available. For a clear distinction
between the two we got the recommendation from the RedHat
team to support both in different namespaces. This commit
now implements a backward compatible change for kiwi which
includes the following modifications:

* XSL stylesheet for automatic schema transformation from

  <packagemanager>dnf</packagemanager> to
  <packagemanager>dnf4</packagemanager>

* Code copy of dnf API interface from

  PackageManagerDnf -> PackageManagerDnf4
  RepositoryDnf -> RepositoryDnf4

* Deprecation of former Dnf API interface

The code change here will force developers to adapt
their code if they used RepositoryDnf / PackageManagerDnf
classes in their python code. After this change developers
will be dropped into a raise condition which exits kiwi
at the time of the call. Related to Issue #2300
and Issue #2262
2023-06-12 17:44:06 +02:00
Marcus Schäfer
41875f57ea
Add support for creating delta containers
Add new attribute delta_root="true|false" which in combination with
derived_from="OCI-base-image" allows to create a delta root tree
only containing the differences between the OCI-base-image and the
actions taken by the kiwi prepare step. Based on the delta root tree
the subsequent image creation process starts. Such an incomplete
root tree is only useful under certain circumstances which is also
the reason why the feature is only available to the oci and docker
image types.
2023-03-16 17:06:15 +01:00
Robert Schweikert
ef35bef97b
Support new bootloadersettings section
Allow to specify an optional <bootloadersettings> element
inside of the <bootloader> section. The information is used to
specify custom arguments for the tools called in a bootloader
setup procedure, e.g shim-install, grub-install or grub-mkconfig.
kiwi does not judge on the given parameters and if the provided
data is effectively used depends on the individual bootloader
implementation. In this commit the data will be effectively
handled if bootloader="grub2" is configured. More precisely
the custom additions to support SUSE's TPM model with grub2
can be configured as follows:

<bootloadersettings>
    <shimoption name="--suse-enable-tpm"/>
    <installoption name="--suse-enable-tpm"/>
    <configoption name="--set-trusted-boot"/>
</bootloadersettings>

This Fixes #2224
2023-02-22 23:27:19 +01:00
Marcus Schäfer
bbbfdce1e9
Allow to pass credentials as file reference 2022-12-14 16:58:43 +01:00
Marcus Schäfer
8f18b7cdc3
Allow to select partition mapper tool
The recent change from kpartx to partx caused some appliance
builds to break depending on their configuration. I spotted
issues when building disks with veritysetup or integritysetup
root devices. There are also issues with grub-install on other
architectures e.g s390. It seems partx cannot be used as a drop
in replacement and so I suggest to make this a runtime
configuration option with partx as the new default but also
allow for the old method
2022-12-01 16:17:16 +01:00
Marcus Schäfer
747f878911
Support squashfs in custom partitions
When using squashfs in a custom partitions setup like the following:

<partitions>
    <partition ... filesystem="squashfs"/>
</partitions>

The build fails because the filesystem needs to be created
using the create_on_file() API and not the create_on_device()
API. In addition the size estimation is bogus when using
squashfs and cannot be pre-calculated because we only know
how much space the filesystem really needs after mksquashfs
as worked on the data and the compression. Thus this commit
also relaxes the required size check in case of squashfs.
Last but not least a squashfs filesystem does not provide
label or UUID and can only be referenced by the PARTUUID
it gets dumped on or by the native unix device node. As
the unix node is a loop during build time of the image and
meaningless this commit also forces by-partuuid mapping in
fstab when mounting the squashfs based device.
2022-06-21 22:19:56 +02:00
Marcus Schäfer
30eb1c1a5b
Correct setfiles relabeling
This change was inspired by a change done on Fedora's livecd-tools
from here: livecd-tools/livecd-tools#236. The patch corrects issues
with the setfiles SELinux relabel command. The issues become apparent
when the host and guest policies differ. Thus it becomes required
to explicitly set the policy to decouple from eventual unwanted
host settings.
2022-06-13 13:18:51 +02:00
Marcus Schäfer
04d966b920
Add support for group id in users setting
Allow to specify the group id in the groups list a user
should belong to. The group id can be placed as part of
the group name separated by a colon like in the following
example:

<users>
    <user groups="kiwi,admin:42,users" password="..." name="kiwi"/>
</users>

Please note kiwi checks if the provided group already
exists and only creates a group if it is not already present in
the system. As default groups are usually provided by the OS
itself including its preferred group id, you will intentionally
not be able to overwrite group id for existing groups.
This Fixes #2064
2022-05-20 19:23:22 +02:00
Marcus Schäfer
4f47b1d94b
Add support for prebuilt bootstrap package for apt
When using the apt packagemanager kiwi required the use of
debootstrap to create the initial rootfs. This works as long
as there is always a main distribution repository available
which follows the structure of the official debian mirrors.
However if such a main distribution is not present or an
alternative layout like e.g OBS repos is used, debootstrap
will refuse to work. To allow for an alternative and without
the dependency to debootstrap kiwi supports using a prebuilt
bootstrap package providing the mini rootfs to serve as
the bootstrap result. As all other package managers properly
supports installation into an empty new root, this feature
was only added when using the apt packagemanager
2022-05-18 11:19:51 +02:00
Marcus Schäfer
6b79d15f77
Update get_disksize_mbytes to support clones
When using partition clones the pre-calculation of the
disk size needs to take this into account.
2022-04-28 15:40:31 +02:00
Marcus Schäfer
370ab24489
Added runtime check for by-partuuid use
Added check_partuuid_persistency_type_used_with_mbr(). Not
every partition table type supports UUIDs. We don't want to
make use of the artifical values created by Linux if the
partition table doesn't support it natively
2022-03-23 16:54:24 +01:00
Marcus Schäfer
a02289495f
validate luksformat options
validate options against the cryptsetup help info
in a runtime check
2022-03-21 23:28:30 +01:00
Marcus Schäfer
c30ac9f1fb
Handle LUKS type in its own attribute 2022-03-21 23:28:22 +01:00
Marcus Schäfer
74ad1e5744
Allow luks format options
Added new luksformat element which allows to pass
along options to the luksFormat call. This allows users to
switch between LUKS and LUKS2 via e.g

    <luksformat>
        <option name="--type" value="luks2"/>
    </luksformat>

It also allows to pass along a set of options only available
to LUKS2, e.g

    <luksformat>
        <option name="--type" value="luks2"/>
        <option name="--cipher" value="aes-gcm-random"/>
        <option name="--integrity" value="aead"/>
    </luksformat>

In addition to the new attribute the existing luks attribute
can also be specified to read credentials from a keyfile by
using the file:// source locator, e.g

    <type ... luks="file:///path/to/a/keyfile"/>

This Fixes #1898
2022-03-21 21:40:35 +01:00
Marcus Schäfer
4e63703f70
Update descriptions to schema v7.5 2022-03-09 18:19:31 +01:00
David Cassany
332d60f777
Support additional names for docker containers
Docker containers used to support the attribute `additionaltags` which
was used to provide multiple tags for the same image. Since only tags
were supported this commit renames the attribute to `additionalnames`
and now supports tags and names witht he following syntax:

* '<name>:<tag>' -> adds a full docker image reference including name
  and tag
* ':<tag>'       -> adds an additional tag while reusing the former name
* '<name>'       -> adds an additional name while reusing the former tag

Fixes #2045

Signed-off-by: David Cassany <dcassany@suse.com>
2022-03-09 18:19:31 +01:00
Marcus Schäfer
e2f32e8c8a
Added support for collection modules
In CentOS Stream 8 and Red Hat Enterprise Linux 8, there are
Application Streams that are offered in the form of modules
(using Fedora Modularity technology). To build images that use
this content KIWI needs to support to enable/disable various
modules. This commit allows to configure collection modules
in a new element as shown below

<packages type="bootstrap">
    <collectionModule name="module" stream="stream" enable="true|false"/>
</packages>

This Fixes Issue #1999
2021-12-14 22:55:05 +01:00
Marcus Schäfer
7e3297d9d3
Added support for setting up release version
Currently the release version is not set or set to '0'
for package managers which requires a value to operate.
However, in order to support leveraging the same description
across different releases it is important to have the
opportunity to specify a setting for the release version.
This commit adds a new optional attribute to the preferences
section which allows to specify a custom value which
serves as the release version:

<preferences>
    <release-version>TEXT</release-version>
</preferences>

If not specified the default setting as before applies.
Please note the release version information is currently
used in dnf and microdnf package managers only. It might
happen that it gets applied to the other package manager
backends as well. This will happen on demand though.
Related to Issue #1918. This Fixes #1927
2021-12-06 09:54:41 +01:00
David Cassany
f58b8998fd
Compress container images in builder class
This commit changes the stage at which container images are compressed
to match the criteria applied to other image types. Instead of
compressing the image in OCI devoted classes now it is happening
in builder class by setting Result instance properties.

Fixes #1996

Signed-off-by: David Cassany <dcassany@suse.com>
2021-12-01 13:28:18 +01:00
Marcus Schäfer
4ac456b31f
Support this:// resource locator for includes
Allow include references like the following example:
<include from="this://include.xml"/>
2021-11-25 16:02:48 +01:00
Marcus Schäfer
e0f47f49cf
Allow repo path relative to the image description
This commit adds a new URI type called this://... The
this:// part will be resolved into the absolute path to
the image description. A source path like the following:

    <source path="this://my_repo"/>

is resolved to

    <source path="dir:///path/to/image/description/my_repo"/>

This change provides the requested opportunity to reference
repos provided as part of the image description and
Fixes #1964
2021-11-25 13:13:52 +01:00
Marcus Schäfer
8fea098ed2
Added support for reading metalink in info module
For resolver operations through libsolv the 'kiwi image info'
module exists. So far it could not read the repos from
metalink repo definitions. This Fixes #1890
2021-11-22 22:08:56 +01:00
David Cassany
7b14694093
Force key attribute from signing element to be treated as a URI
Signed-off-by: David Cassany <dcassany@suse.com>
2021-11-19 13:29:52 +01:00
Marcus Schäfer
350ed05454 Allow to set sign keyfile in repository elements
This commit adds a new and optional child element <signing>
to the repository/source element as shown in the following
example:

<repository>
    <source path="...">
        <signing key="keyfile"/>
    </source>
</repository>

The collection of all keyfiles from all repositories will be
added to the keyring as used by the selected package manager.
Signing keys specified on the commandline and signing keys
specified in the image description will be combined.
This Fixes #1883
2021-11-16 10:15:46 -05:00
Marcus Schäfer
9cb68abcea Fixed include processing
This commit fixes several issue connected with the use of
the <include> directive:

First and foremost the XSLT chain was broken in a way that
the include XSLT in combination with the PrettyPrinter XSLT
were called not in the chain of stylesheets but together.
This results in XML descriptions which duplicated the content
and went invalid

Another change is, when the include XSLT is called in the chain.
This commit moves it to become the very first processing
instruction such that the included data is part of all subsequent
XSLT stylesheets. This also allows to use older schema versions
in included XML data and they get automatically converted through
the chain of XSLT stylesheets.

Last change is the evaluation of the from= attribute value. This
value is now interpreted as an URI. Currently only local URIs are
supported. The reason to do this is because XSLT when processing
a document resolves relative paths according to the file path
of the master document. As kiwi does not change the original
content that path with will be a /var/tmp location if one of
the XSLT stylesheets were used. The documentation for this change
was updated as well
2021-11-12 07:46:52 -05:00
Marcus Schäfer
b373a8d16d Drop support for cdrtools
Tools like mkisofs, genisoimage and friends are all unmaintained
and have found their substitute in xorriso for quite some time.
This commit deletes the code from kiwi which supported creation
of ISO images using the obsolete cdrtools collection. In addition
all hack code associated with these tools like mbr insertion via
isohybrid and things like that got dropped as well.
This Fixes #1908
2021-11-11 06:43:56 -05:00
Marcus Schäfer
4a4a4033d1
Added partition sizes to disk size math
Make sure partition sizes are used for the calculation
of the entire disk size to fit the size constraints of
the image disk
2021-11-03 13:31:17 +01:00
Marcus Schäfer
94de1336d8
Support custom partitions
In addition to the volume volume management settings also
allow to setup low level table entries like in the following
example:

<partitions>
    <partition name="var" size="100" mountpoint="/var" filesystem="ext3"/>
</partitions>
2021-11-03 13:31:17 +01:00
Marcus Schäfer
0aa490c654
Fixed use of LUKS encrypted images with empty pass
For initial provisioning of LUKS encrypted disk images an
empty passphrase key is handy to avoid interaction in the
deployment process. However, the dracut kiwi modules were
lacking the information that the luks keyfile could be an
empty passphrase key which must not be opened with the
potential risk to get prompted for input. This commit
introduces a new profile environment variable evaluated
by the dracut kiwi lib code to open the LUKS pool and
allows to distinguish the situation on key files with
or without a passphrase
2021-10-14 11:27:16 +02:00
Marcus Schäfer
ef05ecc36e
Add support for toplevel include directive(s)
On the toplevel of an image description you can now
specify include directive(s) like in the following
example

<image ...>
    ...
    <include from="filename_a.xml"/>
    ...
    <include from="filename_b.xml"/>
</image>

At the place of their occurrence the include statement
will be replaced with the contents of the given filename.
The implementation is based on a XSLT stylesheet and
applies very early in the process. The stylesheet reads
the contents of the given file as XML document().
Thus only valid XML documents gets accepted by this
include concept. This Fixes #1929 and is related to
Issue #1918
2021-10-07 09:50:38 +02:00
Jesus Bermudez Velazquez
fd52237478
Allow target dir for archive
- Add the option to specify a target directory
  to unpack the archive
- Update doc for target dir attribute

This Fixes #1794
2021-09-07 15:13:24 +01:00
Marcus Schäfer
e3e0d888c8
Added support for repo customization script
repo files allows for several customization options
which could not be set by kiwi through the current
repository schema. As the options used do not follow
any standard and are not compatible between package
managers and distributions the only generic way to
handle this is through a script which is invoked
with the repo file as parameter for each file created
to describe a repo for the selected package manager.
This allows users to update/change the repo file content
on their individual needs. In the kiwi description the
path to the custom script can be specified as follows

    <repository ... customize="/path/to/custom_script">
        <source path="..."/>
    </repository>

This Fixes #1896
2021-08-10 10:10:01 +02:00
Marcus Schäfer
7bea6c9203
Add support for a custom exclude file
The new optional metadata file image/exclude_files.yaml can
be placed inside of the local image root tree. At creation time of
the image binary the file contents are used to extend the default
exclude list with additional information. The structure of the
file must be as follows:

```yaml
exclude:
  - exclude-name-used-in-rsync
```
2021-04-16 10:23:33 +02:00
Marcus Schäfer
bc9f37fcf0
Allow to enable volumes for filesystem check
The new attribute <volume ... filesystem_check="true|false"/>
allows to change the default value for the fs_passno field in
the generated fstab file. By default kiwi sets "0" in this
field and leaves it up to the user to customize this as
appropriate via script code. Coding changes to the fstab file
via scripts are not very user friendly and with respect that
systemd takes over control and generates checkers depending on
the value of fs_passno it would be good if there is a way to
explicitly specify if checks to the filesystem are wanted or
not. Therefore the new attribute now exists. If set to: true
this results in a value of "2" for the fs_passno field. Please
note the root/boot and efi entries are excluded from this
setup. This Fixes #1728
2021-03-30 15:10:03 +02:00
Marcus Schäfer
47d48c1a89
Update unit- integration tests to schema v74 2021-03-15 16:13:02 +01:00
Marcus Schäfer
aae7da639d
Added deb support to sat solver module
Add support to create SAT solvables from Debian repos via
deb2solv tool from libsolv. This allows image info --resolve-package-list
to work with Debian/Ubuntu image descriptions. Please note
by default libsolv is not compiled with support for Debian.
Therefore the following compile flags must be set on libsolv

* -DENABLE_DEBIAN=1
* -DMULTI_SEMANTICS=1

If libsolv does not provide the needed capabilities kiwi will
fail on either the repository solvable creation due to missing
deb2solv or on call of setdisttype() due to missing MULTI_SEMANTICS
feature in libsolv
2021-02-21 18:50:16 +01:00
Marcus Schäfer
76e0b868fe
Allow to specify OBS credentials in runtime config
In preparation to the new obs kiwi plugin this commit adds
an opportunity to store obs credentials such that the plugin
could also be used in a non-interactive way
2021-02-12 11:21:03 +01:00
Marcus Schäfer
7a5ab282b6
Refactor RuntimeConfig class
The former implementation read the runtime config file every
time a new RuntimeConfig instance was created. The runtime
config is however static during the runtime of an image build
process and not supposed to change. Therefore the file should
be read in once and any new instance of RuntimConfig should
just use what has been read in at the first invocation. This
commit refactors the RuntimeConfig class to hold an application
global RUNTIME_CONFIG variable and allows to reread the
config on explicit request.
2021-02-08 12:41:20 +01:00
Marcus Schäfer
276d4d92d0
Added option to setup OBS API server in config
Allow to specify the open build service API server
in the kiwi runtime configuration file
2021-02-06 17:14:42 +01:00
David Cassany
43bec23db2
Add the schematron rules for installinitrd
This commit adds an schematron rule to limit the presence of
installinitrd element to disk builds including installation media.
2021-01-26 22:21:31 +01:00
David Cassany
6366624ef1
Add the installinitrd element
This commit adds the `<installinitrd>` element in kiwi schema to
facilitate the dracut modules configuration for the installation initrds
on OEM images. Within installinitrd element is possible list the dracut
modules to append, to omit or to just set an static list of dracut
modules to include.

Fixes #1676
Fixes #1683
2021-01-21 16:33:43 +01:00
David Cassany
a01b83a361
Add 'arch' attribute to preferences
This commits adds the attribute 'arch' to preferences. It works
as any other 'arch' attribute within the schema. Preferences defined
with architectures that do not match the host are ignored. If no 'arch'
is provided it matches all any host architecture.

Fixes #1640
2020-12-16 14:00:24 +01:00