For (all?) those cases where we have configuration with
a value followed by a unit, introduce a class that
uses the NamedEnum properties to make parsing and split-up easier.
- 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>