Commit Graph

94 Commits (c844188907fa71353c2e3a1ac8c7ea35df2f9063)

Author SHA1 Message Date
Adriaan de Groot c844188907 [partition] Fix build w/ "3.3.1" API
- Need older-style scanning, but new-style iteration
Adriaan de Groot c0710cabe4 [partition] [fsresizer] Adjust to new #define
- Using KPMCORE4API is clearer than just relying on a version number
Adriaan de Groot 9917bc27fc
Merge pull request from cjlcarvalho/master
[partition] Fixing LVM scanning according to new kpmcore API
Adriaan de Groot 547dc7d334
Merge pull request from a-wai/partition-layout-add-maxsize
[partition] Add max size parameter
Caio Carvalho 2c33535ee8 [partition] Using std::find_if to search in container for elements according to a condition
Caio Carvalho 34e091833d [partition] Fixing LVM scanning according to new kpmcore API
Arnaud Ferraris 5358e2314d [partition] Add max size parameter
When using a custom partition layout with partition sizes in %, it can
be useful to set an upper limit to the partition size.

For instance, using a 20% size for the `/` partition will create a 24G
partition on a 120GB drive, but a 200GB partition on a 1TB drive, which
is not useful, and could be avoided by setting a maximum partition size.

This commit adds the `maxSize` parameter (with a default value of 100%).

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Adriaan de Groot 2a2795c54c [partition] Avoid KPMCore warnings
- Get ready for KPMCore post-3.3.0, which deprecates a bunch of
   Flag<foo> and State<foo> in preparation of enum classes.
Adriaan de Groot 8db004ce45 [partition] Use the FailJob to stop installation
- For unsafe installations (compile-time option), make sure
   things fail before partitions are actually written, unless
   the other option is also turned off.
Adriaan de Groot dff5afe227 [partition] Reduce refreshes when reverting
Arnaud Ferraris cf45d55b32 [partition] Fix parsing of partition size in partition layout
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>
Arnaud Ferraris 2f14a21456 [partition] Apply custom layout when installing "Alongside"
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>
Arnaud Ferraris 0d284759f5 [partition] Apply custom partition layout for Erase and Replace choices
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>
Arnaud Ferraris b2bf873ede [partition] Initialize partition layout from config file
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>
Adriaan de Groot 74ab06e20a [partition] Drop redundant logging
Adriaan de Groot c104d14086 [partition] Call the helpers in the right order.
This fixes the crash by calling the model-reset first, then
refreshing. Previously, the destructors that do the work
were still being called in the wrong order.

FIXES 
Adriaan de Groot fe662345bd [partition] Extra helper classes for doing reset and refresh
- The ResetHelper only finalized changes to the module on
   destruction, but calls to refresh() assumed it was already
   done. This leads to crashes when refresh() uses an intermediate
   state of the model.

Introduce extra helpers, and rename refresh() to avoid calling the
old implementation from any code. The new helper just creates and
destroys a ResetHelper, before creating and destroying an object
that calls the new refreshAfterModelChange().

FIXES 
Andrius Štikonas 22aa6dc132 [partition] fix build with latest kpmcore.
Adriaan de Groot 5d5feeb0ab Merge branch 'master' of https://github.com/cjlcarvalho/calamares into lvm-update
Caio Carvalho 295e14530e [partition] Adding resizing, deactivating and removing procedures for LVM VGs.
Adriaan de Groot fa08e0ad73 Copyright: fix bad email address
Adriaan de Groot dd8e53dc22 Copyright: update copyright lines on files touched in 2018
Contributions from:
  Adriaan de Groot <groot@kde.org>
  Gabriel Craciunescu <crazy@frugalware.org>
  AlmAck <gluca86@gmail.com>
  Andrius Štikonas <andrius@stikonas.eu>
  Caio Carvalho <caiojcarvalho@gmail.com>
  Raul Rodrigo Segura <raurodse@gmail.com>
Caio Carvalho 98a158c6e5 [partition] kpmcore latest release doesn't support FileSystem::Type::Luks2
Caio Carvalho 3b6c764f75 [partition] Fixing revert device loop error in PartitionCoreModule::revertAllDevices.
Caio 0465cc4214 [partition] Including revert on creation of LVM VGs.
Caio f8897e0e0b [partition] Including new LVM PVs in LVM VG creation GUI.
Caio 208d58bcd9 [partition] Including CreateVolumeGroupDialog and fixing some of its GUI issues.
Caio d15ce56c97 [partition] Initial implementation of VolumeGroupBaseDialog.
Adriaan de Groot 6739b81c2a [partition] Tell PartitionInfo about desired flags
- When creating a partition, or changing flags, tell
   the PartitionInfo about those desired flags.
Caio Carvalho f72f7bd8fe [partition] Only bootloader model should ignore devices that are not of Disk_Device type.
Adriaan de Groot 3315df5df1 [modules] Use new convenience logging methods across the board
Adriaan de Groot 637d6ad752 [partition] Find Esp partition with modern flags.
Adriaan de Groot 762ad54344 Documentation: change http links to GitHub to https
Adriaan de Groot e3e519c06f Clang: reduce warnings, nullptr, unused parameters
Adriaan de Groot 0e96621b94 Don't leak memory when winnowing disk devices
- Improve logging a little
 - Don't leak Device*, but delete the raw pointer when erasing
 - Document that DeviceInfo takes ownership and doesn't leak
Adriaan de Groot 7e66499f36 Refactor check for EFI system.
The TODO stands, to delegate this to KPMCore.
Adriaan de Groot 7d49255a78 Partitions: use an enum with clear semantics instead of bool
Adriaan de Groot 102bed1805 Partitions: split device-listing (and winnowing) into separate source file.
The grab-list-of-writable-devices code is usable for the partition module, but
also useful for welcome module, so reduce its footprint.
Adriaan de Groot 5bf03cc515 Partitions: shuffle some device-detection code off to PartUtils.cpp
Adriaan de Groot aeb0cd0d3f Partitions: drop devices with mounted partitions.
FIXES 
Adriaan de Groot cc7631dd99 Partitions: code-formatting
Adriaan de Groot 232bbe18bc Be more verbose while scanning devices
Adriaan de Groot 8ea14d7957 Release: add copyright to files I've touched
Adriaan de Groot 46a2503c87 PartitionModule: skip nullptr devices, and report count
FIXES 
Adriaan de Groot 92a2c7aa70 PartitionModule: avoid nullptr crashes
Fix up iterator code so that it handles nullptr better.
This avoids part of .
Teo Mrnjavac 45315e6ae9 Improve debug output for bootloader code path.
Kevin Kofler 1548fe4810 [partition] Use FlagEsp instead of sgdisk to scan for ESPs.
Address an old FIXME in
PartitionCoreModule::scanForEfiSystemPartitions(): Check the FlagEsp on
the Partition object (that KPMcore has been supporting since 2.1.0)
instead of running sgdisk.
Chantara Tith 64db6d5ba1 Use device's immutable copy instead of rescanning.
Teo Mrnjavac c316d22b08 Keep an immutable copy for every scanned Device* to avoid rescans.
Teo Mrnjavac cbb2162ee9 Merge pull request from stikonas/master
Port away from most cases of Q_FOREACH to C++11 ranged for loop.