diff --git a/src/modules/partition/core/Config.cpp b/src/modules/partition/core/Config.cpp index 686d76716..8907a978a 100644 --- a/src/modules/partition/core/Config.cpp +++ b/src/modules/partition/core/Config.cpp @@ -116,6 +116,13 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) bool nameFound = false; // In the name table (ignored, falls back to first entry in table) m_initialInstallChoice = PartitionActions::Choices::installChoiceNames().find( CalamaresUtils::getString( configurationMap, "initialPartitioningChoice" ), nameFound ); + m_initialSwapChoice = PartitionActions::Choices::swapChoiceNames().find( + CalamaresUtils::getString( configurationMap, "initialSwapChoice" ), nameFound ); + if ( !m_swapChoices.contains( m_initialSwapChoice ) ) + { + cWarning() << "Configuration for *initialSwapChoice* is not one of the *userSwapChoices*"; + m_initialSwapChoice = PartitionActions::Choices::pickOne( m_swapChoices ); + } } void diff --git a/src/modules/partition/core/Config.h b/src/modules/partition/core/Config.h index f2ba9cf58..d338dd57b 100644 --- a/src/modules/partition/core/Config.h +++ b/src/modules/partition/core/Config.h @@ -28,14 +28,20 @@ public: PartitionActions::Choices::SwapChoiceSet swapChoices() const { return m_swapChoices; } - /** - * @brief What kind of installation (partitioning) is requested **initially**? + /** @brief What kind of installation (partitioning) is requested **initially**? * - * @return the partitioning choice (may by @c NoChoice) + * @return the partitioning choice (may be @c NoChoice) */ PartitionActions::Choices::InstallChoice initialInstallChoice() const { return m_initialInstallChoice; } + /** @brief What kind of swap selection is requested **initially**? + * + * @return The swap choice (may be @c NoSwap ) + */ + PartitionActions::Choices::SwapChoice initialSwapChoice() const { return m_initialSwapChoice; } + private: + PartitionActions::Choices::SwapChoice m_initialSwapChoice; PartitionActions::Choices::SwapChoiceSet m_swapChoices; PartitionActions::Choices::InstallChoice m_initialInstallChoice = PartitionActions::Choices::NoChoice; qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 2e965ad93..cb263f32e 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -86,7 +86,7 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent ) , m_lastSelectedDeviceIndex( -1 ) , m_enableEncryptionWidget( true ) , m_availableSwapChoices( config->swapChoices() ) - , m_eraseSwapChoice( PartitionActions::Choices::pickOne( m_availableSwapChoices ) ) + , m_eraseSwapChoice( config->initialSwapChoice() ) , m_allowManualPartitioning( true ) { setupUi( this ); diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 007d7b36e..276ee3458 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -74,8 +74,15 @@ alwaysShowPartitionLabels: true # # The default is "none" # -# TODO: this isn't implemented -# initialPartitioningChoice: none +initialPartitioningChoice: none +# +# Similarly, some of the installation choices may offer a choice of swap; +# the available choices depend on *userSwapChoices*, above, and this +# setting can be used to pick a specific one. +# +# The default is "none" (no swap) if that is one of the enabled options, otherwise +# one of the items from the options. +initialSwapChoice: none # Default filesystem type, used when a "new" partition is made. # diff --git a/src/modules/partition/partition.schema.yaml b/src/modules/partition/partition.schema.yaml index 770b8a645..16cc08319 100644 --- a/src/modules/partition/partition.schema.yaml +++ b/src/modules/partition/partition.schema.yaml @@ -22,6 +22,7 @@ properties: allowManualPartitioning: { type: boolean, default: true } partitionLayout: { type: array } # TODO: specify items initialPartitioningChoice: { type: string, enum: [ none, erase, replace, alongside, manual ] } + initialSwapChoice: { type: string, enum: [ none, small, suspend, reuse, file ] } requiredStorage: { type: number } required: