Merge branch 'fix-swap-ui' of github.com:calamares/calamares into fix-swap-ui
This commit is contained in:
commit
f7cc571635
@ -476,86 +476,47 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
// Copy the efiSystemPartition setting to the global storage. It is needed not only in
|
||||
// the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
|
||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
if ( configurationMap.contains( "efiSystemPartition" ) &&
|
||||
configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
|
||||
!configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
|
||||
{
|
||||
gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
|
||||
}
|
||||
QString efiSP = CalamaresUtils::getString( configurationMap, "efiSystemPartition" );
|
||||
if ( efiSP.isEmpty() )
|
||||
efiSP = QStringLiteral( "/boot/efi" );
|
||||
gs->insert( "efiSystemPartition", efiSP );
|
||||
|
||||
if ( configurationMap.contains( "ensureSuspendToDisk" ) &&
|
||||
configurationMap.value( "ensureSuspendToDisk" ).type() == QVariant::Bool )
|
||||
{
|
||||
gs->insert( "ensureSuspendToDisk", configurationMap.value( "ensureSuspendToDisk" ).toBool() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "ensureSuspendToDisk", true );
|
||||
}
|
||||
// SWAP SETTINGS
|
||||
//
|
||||
// This is a bit convoluted because there's legacy settings to handle as well
|
||||
// as the new-style list of choices, with mapping back-and-forth.
|
||||
if ( configurationMap.contains( "userSwapChoices" ) &&
|
||||
( configurationMap.contains( "ensureSuspendToDisk" ) || configurationMap.contains( "neverCreateSwap" ) ) )
|
||||
cError() << "Partition-module configuration mixes old- and new-style swap settings.";
|
||||
|
||||
if ( configurationMap.contains( "neverCreateSwap" ) &&
|
||||
configurationMap.value( "neverCreateSwap" ).type() == QVariant::Bool )
|
||||
{
|
||||
gs->insert( "neverCreateSwap", configurationMap.value( "neverCreateSwap" ).toBool() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "neverCreateSwap", false );
|
||||
}
|
||||
if ( configurationMap.contains( "ensureSuspendToDisk" ) )
|
||||
cWarning() << "Partition-module setting *ensureSuspendToDisk* is deprecated.";
|
||||
bool ensureSuspendToDisk = CalamaresUtils::getBool( configurationMap, "ensureSuspendToDisk", true );
|
||||
|
||||
if ( configurationMap.contains( "drawNestedPartitions" ) &&
|
||||
configurationMap.value( "drawNestedPartitions" ).type() == QVariant::Bool )
|
||||
{
|
||||
gs->insert( "drawNestedPartitions",
|
||||
configurationMap.value( "drawNestedPartitions", false ).toBool() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "drawNestedPartitions", false );
|
||||
}
|
||||
if ( configurationMap.contains( "neverCreateSwap" ) )
|
||||
cWarning() << "Partition-module setting *neverCreateSwap* is deprecated.";
|
||||
bool neverCreateSwap = CalamaresUtils::getBool( configurationMap, "neverCreateSwap", false );
|
||||
|
||||
if ( configurationMap.contains( "alwaysShowPartitionLabels" ) &&
|
||||
configurationMap.value( "alwaysShowPartitionLabels" ).type() == QVariant::Bool )
|
||||
{
|
||||
gs->insert( "alwaysShowPartitionLabels",
|
||||
configurationMap.value( "alwaysShowPartitionLabels", true ).toBool() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "alwaysShowPartitionLabels", true );
|
||||
}
|
||||
// These gs settings seem to be unused (in upstream Calamares) outside of
|
||||
// the partition module itself.
|
||||
gs->insert( "ensureSuspendToDisk", ensureSuspendToDisk );
|
||||
gs->insert( "neverCreateSwap", neverCreateSwap );
|
||||
|
||||
if ( configurationMap.contains( "defaultFileSystemType" ) &&
|
||||
configurationMap.value( "defaultFileSystemType" ).type() == QVariant::String &&
|
||||
!configurationMap.value( "defaultFileSystemType" ).toString().isEmpty() )
|
||||
{
|
||||
QString typeString = configurationMap.value( "defaultFileSystemType" ).toString();
|
||||
gs->insert( "defaultFileSystemType", typeString );
|
||||
if ( FileSystem::typeForName( typeString ) == FileSystem::Unknown )
|
||||
{
|
||||
cWarning() << "bad default filesystem configuration for partition module. Reverting to ext4 as default.";
|
||||
gs->insert( "defaultFileSystemType", "ext4" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "defaultFileSystemType", QStringLiteral( "ext4" ) );
|
||||
}
|
||||
// OTHER SETTINGS
|
||||
//
|
||||
gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) );
|
||||
gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
|
||||
gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
|
||||
|
||||
if ( configurationMap.contains( "enableLuksAutomatedPartitioning" ) &&
|
||||
configurationMap.value( "enableLuksAutomatedPartitioning" ).type() == QVariant::Bool )
|
||||
QString defaultFS = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" );
|
||||
if ( defaultFS.isEmpty() )
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
if ( FileSystem::typeForName( defaultFS ) == FileSystem::Unknown )
|
||||
{
|
||||
gs->insert( "enableLuksAutomatedPartitioning",
|
||||
configurationMap.value( "enableLuksAutomatedPartitioning" ).toBool() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->insert( "enableLuksAutomatedPartitioning", true );
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << defaultFS << ") using ext4.";
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
}
|
||||
gs->insert( "defaultFileSystemType", defaultFS );
|
||||
|
||||
|
||||
// Now that we have the config, we load the PartitionCoreModule in the background
|
||||
|
@ -3,28 +3,37 @@
|
||||
# etc.) use just /boot.
|
||||
efiSystemPartition: "/boot/efi"
|
||||
|
||||
# Make sure an autogenerated swap partition is big enough for hibernation in
|
||||
# automated partitioning modes. Swap can be disabled through *neverCreateSwap*.
|
||||
# In autogenerated partitioning, allow the user to select a swap size?
|
||||
# If there is exactly one choice, no UI is presented, and the user
|
||||
# cannot make a choice -- this setting is used. If there is more than
|
||||
# one choice, a UI is presented.
|
||||
#
|
||||
# - *neverCreateSwap* is true: no swap is created
|
||||
# - *neverCreateSwap* is false (the default): swap is created, as follows:
|
||||
# - *ensureSuspendToDisk* is true (default): Swap is always at least total
|
||||
# memory size, and up to 4GiB RAM follows the rule-of-thumb 2 * memory;
|
||||
# Legacy settings *neverCreateSwap* and *ensureSuspendToDisk* correspond
|
||||
# to values of *userSwapChoices* as follows:
|
||||
# - *neverCreateSwap* is true, means [none]
|
||||
# - *neverCreateSwap* is false, *ensureSuspendToDisk* is false, [small]
|
||||
# - *neverCreateSwap* is false, *ensureSuspendToDisk* is true, [suspend]
|
||||
#
|
||||
# Autogenerated swap sizes are as follows:
|
||||
# - *suspend*: Swap is always at least total memory size,
|
||||
# and up to 4GiB RAM follows the rule-of-thumb 2 * memory;
|
||||
# from 4GiB to 8 GiB it stays steady at 8GiB, and over 8 GiB memory
|
||||
# swap is the size of main memory.
|
||||
# - *ensureSuspendToDisk* is false: Follows the rules above, but Swap is at
|
||||
# - *small*: Follows the rules above, but Swap is at
|
||||
# most 8GiB, and no more than 10% of available disk.
|
||||
# In both cases, a fudge factor (usually 10% extra) is applied so that there
|
||||
# is some space for administrative overhead (e.g. 8 GiB swap will allocate
|
||||
# 8.8GiB on disk in the end).
|
||||
#
|
||||
# Default is true.
|
||||
ensureSuspendToDisk: true
|
||||
# In both cases, a fudge factor (usually 10% extra) is applied so that there
|
||||
# is some space for administrative overhead (e.g. 8 GiB swap will allocate
|
||||
# 8.8GiB on disk in the end).
|
||||
userSwapChoices:
|
||||
- none # Create no swap, use no swap
|
||||
# - reuse # Re-use existing swap, but don't create any
|
||||
- small # Up to 4GB
|
||||
- suspend # At least main memory size
|
||||
# - file # To swap file instead of partition (unsupported right now)
|
||||
|
||||
# Never create swap partitions in automated partitioning modes.
|
||||
# If this is true, ensureSuspendToDisk is ignored.
|
||||
# Default is false.
|
||||
neverCreateSwap: false
|
||||
# LEGACY SETTINGS (these will generate a warning)
|
||||
# ensureSuspendToDisk: true
|
||||
# neverCreateSwap: false
|
||||
|
||||
# Correctly draw nested (e.g. logical) partitions as such.
|
||||
drawNestedPartitions: false
|
||||
|
Loading…
Reference in New Issue
Block a user