Initial support for Alongside install with LUKS.

This commit is contained in:
Teo Mrnjavac 2016-06-07 17:05:22 +02:00
parent 632b237950
commit 936e7fab7c

View File

@ -566,13 +566,31 @@ ChoicePage::doAlongsideApply()
dev->logicalSectorSize(); dev->logicalSectorSize();
m_core->resizePartition( dev, candidate, firstSector, newLastSector ); m_core->resizePartition( dev, candidate, firstSector, newLastSector );
Partition* newPartition = KPMHelpers::createNewPartition( Partition* newPartition = nullptr;
QString luksPassphrase = m_encryptWidget->passphrase();
if ( luksPassphrase.isEmpty() )
{
newPartition = KPMHelpers::createNewPartition(
candidate->parent(), candidate->parent(),
*dev, *dev,
candidate->roles(), candidate->roles(),
FileSystem::Ext4, FileSystem::Ext4,
newLastSector + 2, // * newLastSector + 2, // *
oldLastSector ); oldLastSector
);
}
else
{
newPartition = KPMHelpers::createNewEncryptedPartition(
candidate->parent(),
*dev,
candidate->roles(),
FileSystem::Ext4,
newLastSector + 2, // *
oldLastSector,
luksPassphrase
);
}
PartitionInfo::setMountPoint( newPartition, "/" ); PartitionInfo::setMountPoint( newPartition, "/" );
PartitionInfo::setFormat( newPartition, true ); PartitionInfo::setFormat( newPartition, true );
// * for some reason ped_disk_add_partition refuses to create a new partition // * for some reason ped_disk_add_partition refuses to create a new partition
@ -780,6 +798,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
{ {
case Alongside: case Alongside:
{ {
m_encryptWidget->show();
m_previewBeforeLabel->setText( tr( "Current:" ) ); m_previewBeforeLabel->setText( tr( "Current:" ) );
m_selectLabel->setText( tr( "<strong>Select a partition to shrink, " m_selectLabel->setText( tr( "<strong>Select a partition to shrink, "
"then drag the bottom bar to resize</strong>" ) ); "then drag the bottom bar to resize</strong>" ) );
@ -813,7 +832,6 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
}; };
m_beforePartitionBarsView->setSelectionFilter( filter ); m_beforePartitionBarsView->setSelectionFilter( filter );
m_beforePartitionLabelsView->setSelectionFilter( filter ); m_beforePartitionLabelsView->setSelectionFilter( filter );
m_encryptWidget->hide();
break; break;
} }