[partition] Add configuration option to disable manual partitioning

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>
main
Arnaud Ferraris 6 years ago
parent 2f14a21456
commit ba673b17ee

@ -92,6 +92,7 @@ ChoicePage::ChoicePage( QWidget* parent )
, m_bootloaderComboBox( nullptr ) , m_bootloaderComboBox( nullptr )
, m_lastSelectedDeviceIndex( -1 ) , m_lastSelectedDeviceIndex( -1 )
, m_enableEncryptionWidget( true ) , m_enableEncryptionWidget( true )
, m_allowManualPartitioning( true )
{ {
setupUi( this ); setupUi( this );
@ -101,6 +102,9 @@ ChoicePage::ChoicePage( QWidget* parent )
m_enableEncryptionWidget = Calamares::JobQueue::instance()-> m_enableEncryptionWidget = Calamares::JobQueue::instance()->
globalStorage()-> globalStorage()->
value( "enableLuksAutomatedPartitioning" ).toBool(); value( "enableLuksAutomatedPartitioning" ).toBool();
m_allowManualPartitioning = Calamares::JobQueue::instance()->
globalStorage()->
value( "allowManualPartitioning" ).toBool();
if ( FileSystem::typeForName( m_defaultFsType ) == FileSystem::Unknown ) if ( FileSystem::typeForName( m_defaultFsType ) == FileSystem::Unknown )
m_defaultFsType = "ext4"; m_defaultFsType = "ext4";
@ -1214,8 +1218,10 @@ ChoicePage::setupActions()
else else
m_deviceInfoWidget->setPartitionTableType( PartitionTable::unknownTableType ); m_deviceInfoWidget->setPartitionTableType( PartitionTable::unknownTableType );
// Manual partitioning is always a possibility if ( m_allowManualPartitioning )
m_somethingElseButton->show(); m_somethingElseButton->show();
else
force_uncheck( m_grp, m_somethingElseButton );
bool atLeastOneCanBeResized = false; bool atLeastOneCanBeResized = false;
bool atLeastOneCanBeReplaced = false; bool atLeastOneCanBeReplaced = false;

@ -165,6 +165,8 @@ private:
QString m_defaultFsType; QString m_defaultFsType;
bool m_enableEncryptionWidget; bool m_enableEncryptionWidget;
bool m_allowManualPartitioning;
QMutex m_coreMutex; QMutex m_coreMutex;
}; };

@ -570,6 +570,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) ); gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) );
gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) ); gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) ); gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
gs->insert( "allowManualPartitioning", CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
QString defaultFS = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" ); QString defaultFS = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" );
if ( defaultFS.isEmpty() ) if ( defaultFS.isEmpty() )

@ -78,6 +78,16 @@ defaultFileSystemType: "ext4"
# If nothing is specified, LUKS is enabled in automated modes. # If nothing is specified, LUKS is enabled in automated modes.
#enableLuksAutomatedPartitioning: true #enableLuksAutomatedPartitioning: true
# Allow manual partitioning.
#
# When set to false, this option hides the "Manual partitioning" button,
# limiting the user's choice to "Erase", "Replace" or "Alongside".
# This can be useful when using a custom partition layout we don't want
# the user to modify.
#
# If nothing is specified, manual partitioning is enabled.
#allowManualPartitioning: true
# To apply a custom partition layout, it has to be defined this way : # To apply a custom partition layout, it has to be defined this way :
# #
# partitionLayout: # partitionLayout:

Loading…
Cancel
Save