Tentative LUKS support for EraseAutopartition.
Partitioning only, install doesn't work yet.
This commit is contained in:
parent
0cc9560a99
commit
759ccae9f6
@ -98,7 +98,7 @@ swapSuggestion( const qint64 availableSpaceB )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
doAutopartition( PartitionCoreModule* core, Device* dev )
|
doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPassphrase )
|
||||||
{
|
{
|
||||||
bool isEfi = false;
|
bool isEfi = false;
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||||
@ -167,28 +167,60 @@ doAutopartition( PartitionCoreModule* core, Device* dev )
|
|||||||
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
|
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Partition* rootPartition = KPMHelpers::createNewPartition(
|
Partition* rootPartition = nullptr;
|
||||||
dev->partitionTable(),
|
if ( luksPassphrase.isEmpty() )
|
||||||
*dev,
|
{
|
||||||
PartitionRole( PartitionRole::Primary ),
|
rootPartition = KPMHelpers::createNewPartition(
|
||||||
FileSystem::Ext4,
|
dev->partitionTable(),
|
||||||
firstFreeSector,
|
*dev,
|
||||||
lastSectorForRoot
|
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::setFormat( rootPartition, true );
|
||||||
PartitionInfo::setMountPoint( rootPartition, "/" );
|
PartitionInfo::setMountPoint( rootPartition, "/" );
|
||||||
core->createPartition( dev, rootPartition );
|
core->createPartition( dev, rootPartition );
|
||||||
|
|
||||||
if ( shouldCreateSwap )
|
if ( shouldCreateSwap )
|
||||||
{
|
{
|
||||||
Partition* swapPartition = KPMHelpers::createNewPartition(
|
Partition* swapPartition = nullptr;
|
||||||
dev->partitionTable(),
|
if ( luksPassphrase.isEmpty() )
|
||||||
*dev,
|
{
|
||||||
PartitionRole( PartitionRole::Primary ),
|
swapPartition = KPMHelpers::createNewPartition(
|
||||||
FileSystem::LinuxSwap,
|
dev->partitionTable(),
|
||||||
lastSectorForRoot + 1,
|
*dev,
|
||||||
dev->totalSectors() - 1
|
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 );
|
PartitionInfo::setFormat( swapPartition, true );
|
||||||
core->createPartition( dev, swapPartition );
|
core->createPartition( dev, swapPartition );
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,21 @@
|
|||||||
#ifndef PARTITIONACTIONS_H
|
#ifndef PARTITIONACTIONS_H
|
||||||
#define PARTITIONACTIONS_H
|
#define PARTITIONACTIONS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
class PartitionCoreModule;
|
class PartitionCoreModule;
|
||||||
class Device;
|
class Device;
|
||||||
class Partition;
|
class Partition;
|
||||||
|
|
||||||
namespace PartitionActions
|
namespace PartitionActions
|
||||||
{
|
{
|
||||||
void doAutopartition( PartitionCoreModule* core, Device* dev );
|
void doAutopartition( PartitionCoreModule* core,
|
||||||
void doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition );
|
Device* dev,
|
||||||
|
const QString& luksPassphrase = QString() );
|
||||||
|
|
||||||
|
void doReplacePartition( PartitionCoreModule* core,
|
||||||
|
Device* dev,
|
||||||
|
Partition* partition );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PARTITIONACTIONS_H
|
#endif // PARTITIONACTIONS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user