- Using the assignment-operator just generates blank lines.
- Using QLog with a log-level avoids the cDebug()-style special
handling of warnings and errors (useless here, but may as well
fix code style).
When using the `rawfs` module for copying data, it may be useful to
save the source device used for later checks or actions. This commit
therefore adds a `source` field to each corresponding partition entry in
global storage, so that this information can be retrieved later during
the installation process.
Another small improvement is that global storage is now modified only
once (it was previously modified as many times as there were entries
processed by the `rawfs` module).
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When choosing `systemd-boot` as the bootloader, numerous problems
occurred:
- the kernel and initrd were not copied to the EFI System Partition,
and therefore could not be reached by the bootloader
- the fallback entry used the default initramfs image instead of the
fallback image
`systemd-boot` provides the `kernel-install` utility, which
automatically copies the kernel + initramfs to the EFI partition, and
creates the corresponding bootloader entry.
Unfortunately, `kernel-install` cannot be used here as the module is not
executed in a chroot. As setting up one only for running a single
command would be overkill, this patch re-creates what `kernel-install`
usually does:
- copy the kernel and initramfs to their own subdirectory at the root of
the EFI partition
- create the corresponding entry configuration file
To this end, the `systemd-boot` installation code in the `bootloader`
module has been largely refactored, including removing a few duplicate
LOCs.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In its current state, the 'rawfs' module requires the source partition
to be identified either by its mount point or device name, but using a
symlink to either one (e.g '/dev/disk/by-uuid/...') would fail.
This patch fetches the real path of source partition, allowing the use
of symlinks.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When setting the size of a partition without indicating the unit, two
problems occur:
- the size is parsed as an integer, not as a string, hence the
configuration parsing fails
- the size parser doesn't recognize the fact that the size has no units
and defaults to 100%
This patch fixes the configuration parsing as well as the size string
parsing.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When a partition doesn't have a minimum size in the partition layout
configuration, it defaults to using 100% of the available space.
This patch fixes this error by setting the minimum partition size to 0
when the attribute has been omitted.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Add global- and job-configurations for test runs.
- Add a driver script that sets up some assumptions on the host
system so that the tests can complete.
- The idea is that these tests together get a decent code-coverage
for the module.
- This is a driver script for running testmodule.py multiple times
with different global- and job-configurations.
- Usage: testpythonrun.sh <modulename>
- Run the script from the build-directory. It uses files from the
tests/ (source) subdirectory to drive the test runs.
- Only need to get the list of supported filesystems *once*,
not for each and every filesystem that is going to be unpacked.
- Be more Python-idiomatic.
In some cases, we might want to copy a filesystem as if we were using a
simple 'dd' command, in order to create an exact copy, down to the block
level.
This can be useful in particular when working with dm-verity for
checking the rootfs integrity: that way, we can make a direct copy of
the rootfs and its verity partition and keep the system usable.
This patch adds a new 'rawfs' module to calamares, making possible to
block-copy a filesystem to a block device.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Use locale "C" for checking filesystem names
- Also check other possibilities and case-insensitive, to
be more forgiving of weird configurations (and localizations)
- The language and BCP need to be in-sync
- Existing code was inconsistent in setting things, which is why
you could get through the locale page without setting a locale
(at all) or it would keep English in spite of picking Germand on
the welcome page.
- Patch tests to use that API.
Due to a computation error when calculating the total drive space and
each partition's last sector, the last partition's last sector was out
of boundaries, leading to an error creating this partition.
This patch fixes the computation algorithm to get rid of this error.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Allow split-setting of the language and formats
- Test new constructors
- Since fromLanguageAndLocation can handle empty localeGen
lists just fine, skip all the weird checks that return
invalid guessed locale configurations.
- Replace createDefault() with a constructor that takes a
locale name; use it with en_US.UTF-8 in those places where
createDefault was previously used.
Some code was copied and adapted from PartitionActions.cpp. For full
compliance, it is best to copy the copyright holders list from this file
to PartitionLayout.cpp.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When chosing the "Replace partition" option, free space is not handled
like any partition. In order to apply the custom partition layout in
that case too, we have to modify the code where "replace free space" is
handled.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In some cases where a custom partition layout is used, use of this
layout is mandatory (this can be the case when using a read-only rootfs
which is updated by block-cpying an image file to it).
For these cases, the user must not be able to change the partition
layout, therefore we have to disable manual partitioning.
In order to stay consistent with current behaviour, manual partitioning
is still enabled by default. It will only be disabled if the partition
module's config file contains the corresponding option set to "false".
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When choosing "Install alongside another system", the custom partition
layout is applied to the space freed by resizing the selected partition.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This patches add new methods to both PartitionLayout and
PartitionCoreModule classes which apply the partition layout to the
available drive space.
In addition, the partition creation code from PartitioinActions is
removed to call the newly created methods instead, thus applying the
custom partition layout when the "Erase whole disk" and "Replace
partition" choices are selected.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
As we move some of the partition creation code away from
PartitionActions, we will need the bytesToSectors function. Rather than
copying it, we export it in the PartitionActions namespace, so that
other classes can use it.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In order to keep the partition layout during calamares' execution, we
add a PartitionLayout object instance to PartitionCoreModule. This class
will therefore be used to initialize the PartitionLayout object and
interact with it thoughout the program's execution.
When no partition layout is present in the config file, we initialize
the layout with a single ext4 partition mounted on '/', as it was
previously done.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In order to use a custom partition layout in the partition module, we
need to write this layout in the module's config file, and store it into
a dedicated object.
As it doesn't look appropriate to extend an existing class with layout
information, we create a new PartitionLayout class, which will be used
to parse the layout from the config file and keep it in memory.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This basically means we talk about localization in the respective
localized variant. e.g. "German (Germany)" ➡ "Deutsch (Deutschland)".
If geoip lookup failed or isn't configured for whatever reason it's a
stretch to expect the user to know english enough to find their own
language. Preferring the localized strings resolves this issue.
Additionally this happens to bypass #712 respectively
https://bugreports.qt.io/browse/QTBUG-34287
as the native names are properly spelled. So, as long as Qt has localized
names the names will also be properly spelled.
- If a key is missing from mount.conf, don't raise KeyError
- If both keys are missing, suggest that mount.conf might
be missing instead (a consequence of INSTALL_CONFIG=OFF, for
instance).
- Simplify code a bit.
- Don't bother returning None explicitly.
- for remove and localInstall, add support for pre- and post-
scripts like there already was for install.
This feels like there's code duplication going on, but I haven't
thought of an elegant way to distinguish the available operations
so that I can pass around functions instead.