From dad9587c3ea7ddceddd8b2dc08be8b49fdbb1f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Tue, 27 Oct 2020 07:16:39 -0400 Subject: [PATCH 1/2] [partition] Allow a configurable swap Partition name This commit adds the new configuration `swapPartitionName` to the file partition.conf. This option sets the partition name to the swap partition that is created. If this option is unset, the partition is left unnamed. --- src/modules/partition/core/PartitionActions.cpp | 4 ++++ src/modules/partition/gui/PartitionViewStep.cpp | 6 ++++++ src/modules/partition/partition.conf | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index a78e8ff53..c874145e3 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -203,6 +203,10 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO KPM_PARTITION_FLAG( None ) ); } PartitionInfo::setFormat( swapPartition, true ); + if ( gs->contains( "swapPartitionName" )) + { + swapPartition->setLabel( gs->value( "swapPartitionName" ).toString() ); + } core->createPartition( dev, swapPartition ); } diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index 0431e1107..13f5e77cc 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -543,6 +543,12 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap ) gs->insert( "efiSystemPartitionName", CalamaresUtils::getString( configurationMap, "efiSystemPartitionName" ) ); } + // Read and parse key swapPartitionName + if ( configurationMap.contains( "swapPartitionName" ) ) + { + gs->insert( "swapPartitionName", CalamaresUtils::getString( configurationMap, "swapPartitionName" ) ); + } + // OTHER SETTINGS // gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) ); diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 0f8764bfd..95f7d0576 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -48,6 +48,10 @@ userSwapChoices: # - reuse # Re-use existing swap, but don't create any (unsupported right now) - file # To swap file instead of partition +# This optional setting specifies the name of the swap partition. +# If nothing is specified, the partition name is left unset. +# swapPartitionName: swap + # LEGACY SETTINGS (these will generate a warning) # ensureSuspendToDisk: true # neverCreateSwap: false From a1d45122ebe6a36a185c2dc52b8267562a973a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Sat, 31 Oct 2020 17:53:11 -0400 Subject: [PATCH 2/2] [partition] Update partition.conf --- src/modules/partition/partition.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 95f7d0576..41652fe7d 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -12,7 +12,8 @@ efiSystemPartition: "/boot/efi" # If nothing is specified, the default size of 300MiB will be used. # efiSystemPartitionSize: 300M -# This optional setting specifies the name of the EFI system partition. +# This optional setting specifies the name of the EFI system partition (see +# PARTLABEL; gpt only; requires KPMCore >= 4.2.0). # If nothing is specified, the partition name is left unset. # efiSystemPartitionName: EFI @@ -48,7 +49,8 @@ userSwapChoices: # - reuse # Re-use existing swap, but don't create any (unsupported right now) - file # To swap file instead of partition -# This optional setting specifies the name of the swap partition. +# This optional setting specifies the name of the swap partition (see +# PARTLABEL; gpt only; requires KPMCore >= 4.2.0). # If nothing is specified, the partition name is left unset. # swapPartitionName: swap