Commit Graph

1012 Commits

Author SHA1 Message Date
Marcus Schäfer
726eeacee5
Fixed zipl bootloader setup for s390 images
The preparation to call zipl and the call itself were wrong.
For whatever reason the kernel image the initrd are moved
to another location prior to calling zipl. That move broke
the system because no kernel/initrd existed at the expected
place anymore. In addition the zipl call itself was issued
from a the wrong directory. Also no config file was written
as an after effect of the refactoring in Issue #1194. This
Fixes #1173 and bsc#1156694
2019-11-14 12:01:06 +01:00
David Cassany
60659a2dde
Ensure grub.cfg is copied in EFI/BOOT folder
This commit fixes the live images in efi mode. Grub configuration file
is copied to the correct location in <boot_dir>/EFI/BOOT.

Fixes bsc#1155815
2019-11-06 12:58:49 +01:00
Marcus Schäfer
416116cded
Merge pull request #1252 from martinezjavier/enable-bls
Enable BLS configuration if is supported
2019-10-28 10:49:59 +01:00
Javier Martinez Canillas
9d8ce7eedb
Enable BLS configuration if is supported
Fedora now uses a BLS configuration by default, but this is not supported
by all distributions. So check if is supported by the grub2-mkconfig tool
and only enable the option if that's the case.

Fixes: #1248
2019-10-25 18:05:02 +02:00
Marcus Schäfer
66f735c109
Delete left over print statement from unit test 2019-10-25 15:10:42 +02:00
David Cassany
45146ba6cf
Fix btrfs_root_is_snapshot
This commit makes sure the chrooted operations of over a loop device
including btrfs subvolumes and root as an snapshot include the
`/.snapshots` subvolume mount. This is necessary for certain operations
that depend on the layout, e.g. grub configuration using `grub2-mkconfig`.
2019-10-24 22:06:33 +02:00
Marcus Schäfer
b265be128c
Merge pull request #1249 from OSInside/refactor_logging
Refactor logging
2019-10-24 11:10:29 +02:00
Marcus Schäfer
bdb7123fa1
Refactor use of logging facility
Use getLogger method instead of a global log object
Also use caplog fixture to capture log messages in
unit tests. This Fixes #1244
2019-10-23 17:54:27 +02:00
David Cassany
80e791d2ef
Make home attribute optional on users definition
This commit makes home attribute of users definition optional. This way
the home directory is created according to the distribution defaults.
Note that `-m` option is passed to user add, thus the home directory is
requested to be created even without having an explicit home path
defined.

Fixes #1025
2019-10-23 15:57:51 +02:00
David Cassany
4b3a105026
Re-structure unit tests folders
This commit relocates unit tests to a folder structure that matches
the source code structure.

Fixes #1128
2019-10-21 14:00:05 +02:00
Marcus Schäfer
0c1d8b9de7
Fixed grub mkconfig call for read-only root
In case of an overlay root system via overlayroot="true" all parts
of the rootfs are read-only by squashfs except for the extra boot
partition. However tools like grub's mkconfig creates temporary
files at call time and therefore /tmp needs to be writable during
the call time of the tools. Related to Issue #1194
2019-10-17 15:49:39 +02:00
Marcus Schäfer
17e8b9b46f
Fixed EFI path creation
Only copy files to the EFI path on prior creation of that path
2019-10-17 11:45:59 +02:00
Marcus Schäfer
0fd47319ed
Fixed fallback copy of grub config file
For ISO images that are EFI bootable as well as for EFI
secure boot configurations that are not based on shim-install
kiwi provides a fallback code that copies the grub config file
to the efi/efi-vendor boot path. This fallback code was broken
because of the recent change to let grub2 mkconfig create the
config file. The call of grub2 mkconfig happens at a later
stage which required an adaption of the fallback mechanism.
This is related to Issue #1194
2019-10-17 11:05:25 +02:00
Marcus Schäfer
21a573756e
Delete unused template data
With the move to grub2 mkconfig some static template data
became obsolete. This commit removes the unused data
2019-10-16 12:10:32 +02:00
Marcus Schäfer
0446c1d48a
Adapted handling of initrd boot names
Due to the change of using grub2-mkconfig the way custom kiwi
initrd file names are handled doesn't work anymore. grub2-mkconfig
is not able to cope with the names kiwi used when creating custom
kiwi initrd's (initrd.vmx). Thus the same naming code as used
for the dracut initrd system has to apply for the custom kiwi
initrd code as well. This commit moves the name handling into
the baseclass because the same naming schema now applies to
both initrd systems.
2019-10-16 12:10:32 +02:00
Marcus Schäfer
3159b9c766
Fixed install image setup for kiwi initrd system
If the kiwi initrd system is used the eltorito image was
not found because searched in the wrong place
2019-10-16 12:10:32 +02:00
Marcus Schäfer
162d5c9a41
Use grub2-mkconfig for writing grub config
Instead of creating a template based grub config file, use
grub2-mkconfig to create the config file during the build
process. This commit changes from config template to grub2
tooling for the disk based image types vmx and oem
This Fixes #1194
2019-10-16 12:10:32 +02:00
Marcus Schäfer
1843b9d0d0
Flexible use of linuxefi module
Not all distributions provides the grub linuxefi module anymore.
This means a static list for building an efi grub image if needed
is no longer appropriate. This patch changes the module handling
at the following places

1. Use linuxefi for building custom efi modules only if present
   on the host system

2. Use linuxefi related grub2-mkconfig variables only if the
   host grub2-mkconfig implementation supports it

3. Prevent building custom efi image on Fedora by extending
   the search path for the distro provided efi image and also
   adapt the spec file accordingly
2019-10-09 17:04:23 +02:00
David Cassany
3df6bb5ce1
Refactor patch_open use in builder's tests
This commit removes the use of @patch_open decorator
in favor of directly patching 'builtins.open' and use
mock.mock_open utility to mock the context manager.

Related to #1128
2019-10-07 16:49:58 +02:00
Marcus Schäfer
1ff2aedf32
Merge pull request #1224 from OSInside/fix_sha256_file
Fix the sha256 generated file content
2019-10-04 09:40:23 +02:00
David Cassany
2733566015
Fix the sha256 generated file content
This commit makes sure the generated sha256 file in a 'kiwi result
bundle' call includes the filename with the correct extension. For
compressed files it was omiting the suffix that included during the
compression.

Fixes #1223 and related to bsc#1139915
2019-10-03 21:14:14 +02:00
Marcus Schäfer
f53629de93
Fixed rpmdb compat link setup
On older versions of zypper the path /var/lib/rpm was hardcoded
and not used from the rpm macro definition. For such systems and
to support them properly on hosts that have the rpm database
already moved a compat link was created. However if the host has
the rpm database at /var/lib/rpm the link doesn't make sense.
This patch fixes this and therefore bsc#1150190
2019-10-02 11:32:43 +02:00
Marcus Schäfer
45be1b0b12
Complete dracut setup for luks boot
An image that is configured with an encrypted root including /boot
includes a /.root.keyfile in initrd to let dracut/systemd decrypt
the root and mount it without asking the password. On rebuild of
the initrd, dracut has no configuration that tells it to include
the /.root.keyfile again. This patch adds that configuration and
Fixes #1192
2019-10-01 12:29:34 +02:00
Marcus Schäfer
defdc23fcf
Follow up patch for SourceType info
The message that display the selected source type was
using the former metalink text which is wrong. This
patch corrects the message and only display it if a
sourcetype was specified
2019-09-30 16:39:16 +02:00
Marcus Schäfer
5e42c38e3a
Support specifying the source type of repos
Repository source paths can be more than just a baseurl.
There is also the opportunity to point to a metalink
file or a mirrorlist. In both cases the packagemanager
needs to know the type of this target. Therefore a new
attribute called sourcetype exists which allows to
specify the type the repo path uri is associated with.
Currently the dnf repository class is the only one that
makes use of the information. This change is required to
support Fedora >= 30 images. I also expect this concept
to be used by other distributions in the future
2019-09-30 15:24:30 +02:00
Marcus Schäfer
f8bc05fd42
Refactor use of raises in unit tests
Use raises as context manager instead of a method decorator.
This clearly identifies which code part is expected to raise
an exception. Related to Issue #1128
2019-09-29 19:42:43 +02:00
Marcus Schäfer
bd8660c5b5
Refactor repository unit tests
Refactor repository unit tests as described in Issue #1128
2019-09-26 11:30:47 +02:00
Marcus Schäfer
498b73b147
Merge pull request #1207 from OSInside/rename_pxe_install_files
Add information in PXE install files
2019-09-25 15:24:03 +02:00
Marcus Schäfer
d48036bb31
Update dracut caller options
No need to pass the --force option and added --verbose option
as it provides useful information in the image log file
2019-09-25 10:48:45 +02:00
David Cassany
71759585e0
Add information in PXE install files
This commmit adds additional information for the image and pxeboot files
that are part of the install tarball in OEM PXE deployments. This way all
files inside the install tarball include the following pattern

<image-name>.<arch>-<version>

at the same time anyfile prefix and suffix remains unchanged.

Fixes #1147
2019-09-23 15:06:49 +02:00
David Cassany
09432f4612
Fix modules omission for dracut based initrds
This commit fixes a regression introduced in 07ea23a4. In OEM images
the dracut modules were not properly omitted as the code was evaluating
the wrong variable.

Fixes #1201
2019-09-17 13:11:43 +02:00
David Cassany
ebccab2666
Fix GPT to MBR convertion
This commit swaps the order of the command in gpt to mbr convertion
in partitioner.gpt.set_mbr method.

sgdisk by default converts the partition table from MBR to GPT in memory.
The change is never applied unless you provide the -g option forcing to
overwrite the partition table format. If sgdisk does the convertion in
memory and the user does not provide the -g flag it returns an error
code.

The solution applied in this commit is to just run the GPT to MBR
convertion as the last sgdisk command and change partition type before
running the convertion.
2019-09-13 18:01:40 +02:00
David Cassany Viladomat
14bf327f7e
Merge pull request #1188 from OSInside/add_wildcards_flag_mksquashfs
Add the `-wildcards` flag in mksqashfs call
2019-09-04 16:10:51 +02:00
David Cassany
afc19cf69f
Add the -wildcards flag in mksqashfs call
This commit ensures the `-wildcards` flag of mksquashfs is being used.

This is related to #1184
2019-08-30 12:26:48 +02:00
Marcus Schäfer
be17186503
Add --add-bootstrap-packages option
The prepare and build commands now allows to specify additional
packages to be installed as part of the early bootstrap phase
This Fixes #1151
2019-08-29 11:38:56 +02:00
David Cassany Viladomat
e6fe59df6c
Merge pull request #1179 from OSInside/avoid_default_installation_of_kiwi_dracut_modules
Avoid default installation of kiwi dracut modules
2019-08-28 17:58:32 +02:00
David Cassany
07ea23a4c4
Avoid default installation of dracut kiwi modules
With this commit dracut modules won't be installed by default
in the initrd unless they are requested by the commandline calling
dracut or by a dracut configuration file.

Fixes bsc#1142899 bsc#1136444
Fixes #1103
2019-08-28 16:11:48 +02:00
Marcus Schäfer
eacd96c3ef
Merge pull request #1182 from OSInside/fstab_script_extension
Add support for custom fstab script extension
2019-08-27 17:18:32 +02:00
Marcus Schäfer
d89345d423
Fix return value of is_prepared method
The method is expected to return a bool value. In fact it
returned a list. An empty list is evalutated as False in
python, a list with content as True. So the way the method
is used is correct but the return value should be a real
bool value to match the docs and expectations. Also the
unit test for this code was wrong. This Fixes #1175
2019-08-27 11:13:30 +02:00
Marcus Schäfer
daee47ef6f
Add support for custom fstab script extension
In addition to fstab append and patch features we also allow
an fstab.script file that is called chrooted. The change is
needed to support overlay mounting of filesystems as part
of the initrd. If system filesystems needs to be changed in
a way that they can be used in an overlay mount, the standard
mount entry has to take the x-initrd.mount capability which
requires a modification of the fstab which is cumbersome to
handle as a patch file. This concept is currently used as
part of the MicroOS project in SUSE and is applied in the
integration test build maintained for this target. This
Fixes bsc#1129566
2019-08-26 17:08:49 +02:00
Dan Čermák
b015b91679
Stop inheriting from object
This is no longer required in Python3
2019-08-22 15:43:27 +02:00
Marcus Schäfer
c80c2c9bc1
Add required cryptomount coding for EFI boot
For non EFI boot grub2-install has code which gets activated
through the GRUB_ENABLE_CRYPTODISK setting. However for the
EFI boot case no installation of boot code is needed and
therefore the grub earlyboot script has to run cryptomount
2019-08-19 18:28:46 +02:00
Marcus Schäfer
f030880cc6
Extended LUKS encryption support
We supported luks encrypted images with the exception of the
boot partition because grub was not able to read from an
encrypted device at that time. Since some time grub is able
to read from an encrypted partition and this commit add
support for it. With this patch luks encrypted images will
no longer create an extra boot partition and the entire
system will be encrypted. The opening of the luks container
happens on the grub level only once. Customers can still
specify to use an unencrypted extra boot partition with the
bootpartition="true" flag. In this case the opening of the
luks containers happens on the systemd level as before.
This is related to Issue #1162
2019-08-19 16:10:09 +02:00
Stefan Seyfried
e0212272f5 remove '-z' option from rsync local copy calls
rsync's "compress" option just does not make any sense when rsync is
used to copy files locally, it only increases CPU usage and slows down
the process ;-)
2019-08-15 09:52:27 +02:00
Marcus Schäfer
954dd5dc3c
Allow dracut initrd to be used with pxe type
The pxe image type builds a simple filesystem image plus a
custom initrd. That initrd is usually build from the kiwi
netboot image descriptions which implements a workflow to
fetch the filesystem image and deploy it as rootfs for a
pxe client. User who wants to implement their own handling
of the rootfs image in e.g a custom dracut module were not
able to build this image type because we did not allow
the initrd_system attribute for the pxe type
2019-08-12 18:17:02 +02:00
Marcus Schäfer
a032c7fc1f
Pass components to debootstrap call
If repo components are specified the collective list of
component names should be passed to the debootstrap call.
This Fixes #1157
2019-08-02 10:44:56 +02:00
Marcus Schäfer
af29f5b430
Fixed zipl bootloader setup
targetgeometry not allowed for targettype SCSI
2019-08-01 16:34:50 +02:00
Marcus Schäfer
21d48c74c6
Allow multiple values for grub terminal setup
With regards to the grub documentation from
https://www.gnu.org/software/grub/manual/grub/grub.html#terminal_005finput
multiple terminal consoles can be active. This patch allows
to specify terminal collection between serial, console and gfxterm
This Fixes #1123
2019-07-23 11:25:59 +02:00
David Cassany
c86efdcd99
Do not recompress PXE image if compressed flag is true
This commit is two fold:

* Refactor PXE builder to make use of the ArchiveTar instead of
  directly calling tar command.
* Do not compress PXE tarball if the contained image is already
  compressed according the type's compressed attribute.

Related to #1039
2019-07-19 13:04:23 +02:00
Marcus Schäfer
30e18d1398
Added support for fscreateoptions attribute
Along with the fsmountoptions attribute there is now also the
fscreateoptions attribute which allows to control the options
used for creating the filesystem. Please note, it's not kiwi's
task to validate that the given option string is supported
by the selected filesystem. This means providing wrong values
here will cause the build to fail at the time the filesystem
gets created. This Fixes #1109
2019-07-18 15:55:39 +02:00