[partition] Convert option struct to use the enum

This commit is contained in:
Adriaan de Groot 2022-11-05 21:57:28 +01:00
parent 2ae02bedf8
commit 9c3f576cd2
4 changed files with 14 additions and 9 deletions

View File

@ -169,7 +169,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
lastSectorForRoot -= suggestedSwapSizeB / sectorSize + 1;
}
core->layoutApply( dev, firstFreeSector, lastSectorForRoot, o.luksFsType, o.luksPassphrase );
// TODO: LUKS
core->layoutApply( dev, firstFreeSector, lastSectorForRoot, Config::luksGenerationNames().find(o.luksFsType), o.luksPassphrase );
if ( shouldCreateSwap )
{
@ -194,7 +195,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
QStringLiteral( "swap" ),
lastSectorForRoot + 1,
dev->totalLogical() - 1,
Config::luksGenerationNames().find(o.luksFsType, Config::LuksGeneration::Luks1),
o.luksFsType,
o.luksPassphrase,
KPM_PARTITION_FLAG( None ) );
}
@ -245,7 +246,8 @@ doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition
core->deletePartition( dev, partition );
}
core->layoutApply( dev, firstSector, lastSector, o.luksFsType, o.luksPassphrase );
// TODO: LUKS
core->layoutApply( dev, firstSector, lastSector, Config::luksGenerationNames().find(o.luksFsType), o.luksPassphrase );
core->dumpQueue();
}

View File

@ -31,12 +31,12 @@ struct ReplacePartitionOptions
{
QString defaultPartitionTableType; // e.g. "gpt" or "msdos"
QString defaultFsType; // e.g. "ext4" or "btrfs"
QString luksFsType; // optional ("luks", "luks2")
Config::LuksGeneration luksFsType = Config::LuksGeneration::Luks1; // optional ("luks", "luks2")
QString luksPassphrase; // optional
ReplacePartitionOptions( const QString& pt,
const QString& fs,
const QString& luksFs,
Config::LuksGeneration luksFs,
const QString& luksPassphrase )
: defaultPartitionTableType( pt )
, defaultFsType( fs )
@ -54,7 +54,7 @@ struct AutoPartitionOptions : ReplacePartitionOptions
AutoPartitionOptions( const QString& pt,
const QString& fs,
const QString& luksFs,
Config::LuksGeneration luksFs,
const QString& luksPassphrase,
const QString& efi,
qint64 requiredBytes,

View File

@ -496,7 +496,8 @@ ChoicePage::applyActionChoice( InstallChoice choice )
auto gs = Calamares::JobQueue::instance()->globalStorage();
PartitionActions::Choices::AutoPartitionOptions options { gs->value( "defaultPartitionTableType" ).toString(),
m_config->eraseFsType(),
gs->value( "luksFileSystemType" ).toString(),
// TODO: LUKS
Config::luksGenerationNames().find(gs->value( "luksFileSystemType" ).toString(), Config::LuksGeneration::Luks1),
m_encryptWidget->passphrase(),
gs->value( "efiSystemPartition" ).toString(),
CalamaresUtils::GiBtoBytes(
@ -861,7 +862,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
selectedPartition,
{ gs->value( "defaultPartitionType" ).toString(),
gs->value( "defaultFileSystemType" ).toString(),
gs->value( "luksFileSystemType" ).toString(),
// TODO: LUKS
Config::luksGenerationNames().find(gs->value( "luksFileSystemType" ).toString(), Config::LuksGeneration::Luks1),
m_encryptWidget->passphrase() } );
Partition* homePartition = findPartitionByPath( { selectedDevice() }, *homePartitionPath );

View File

@ -90,7 +90,8 @@ ReplaceWidget::applyChanges()
partition,
{ gs->value( "defaultPartitionTableType" ).toString(),
gs->value( "defaultFileSystemType" ).toString(),
gs->value( "luksFileSystemType" ).toString(),
// TODO: LUKS
Config::luksGenerationNames().find(gs->value( "luksFileSystemType" ).toString(), Config::LuksGeneration::Luks1),
QString() } );
if ( m_isEfi )