mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
Tentative LUKS support for EraseAutopartition.
Partitioning only, install doesn't work yet.
This commit is contained in:
parent
0cc9560a99
commit
759ccae9f6
2 changed files with 58 additions and 19 deletions
|
@ -98,7 +98,7 @@ swapSuggestion( const qint64 availableSpaceB )
|
|||
|
||||
|
||||
void
|
||||
doAutopartition( PartitionCoreModule* core, Device* dev )
|
||||
doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPassphrase )
|
||||
{
|
||||
bool isEfi = false;
|
||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||
|
@ -167,28 +167,60 @@ doAutopartition( PartitionCoreModule* core, Device* dev )
|
|||
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
|
||||
}
|
||||
|
||||
Partition* rootPartition = KPMHelpers::createNewPartition(
|
||||
dev->partitionTable(),
|
||||
*dev,
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::Ext4,
|
||||
firstFreeSector,
|
||||
lastSectorForRoot
|
||||
);
|
||||
Partition* rootPartition = nullptr;
|
||||
if ( luksPassphrase.isEmpty() )
|
||||
{
|
||||
rootPartition = KPMHelpers::createNewPartition(
|
||||
dev->partitionTable(),
|
||||
*dev,
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::Ext4,
|
||||
firstFreeSector,
|
||||
lastSectorForRoot
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
rootPartition = KPMHelpers::createNewEncryptedPartition(
|
||||
dev->partitionTable(),
|
||||
*dev,
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::Ext4,
|
||||
firstFreeSector,
|
||||
lastSectorForRoot,
|
||||
luksPassphrase
|
||||
);
|
||||
}
|
||||
PartitionInfo::setFormat( rootPartition, true );
|
||||
PartitionInfo::setMountPoint( rootPartition, "/" );
|
||||
core->createPartition( dev, rootPartition );
|
||||
|
||||
if ( shouldCreateSwap )
|
||||
{
|
||||
Partition* swapPartition = KPMHelpers::createNewPartition(
|
||||
dev->partitionTable(),
|
||||
*dev,
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::LinuxSwap,
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalSectors() - 1
|
||||
);
|
||||
Partition* swapPartition = nullptr;
|
||||
if ( luksPassphrase.isEmpty() )
|
||||
{
|
||||
swapPartition = KPMHelpers::createNewPartition(
|
||||
dev->partitionTable(),
|
||||
*dev,
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::LinuxSwap,
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalSectors() - 1
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
swapPartition = KPMHelpers::createNewEncryptedPartition(
|
||||
dev->partitionTable(),
|
||||
*dev,
|
||||
PartitionRole( PartitionRole::Primary ),
|
||||
FileSystem::LinuxSwap,
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalSectors() - 1,
|
||||
luksPassphrase
|
||||
);
|
||||
}
|
||||
PartitionInfo::setFormat( swapPartition, true );
|
||||
core->createPartition( dev, swapPartition );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue