diff --git a/src/modules/partition/gui/ReplacePage.cpp b/src/modules/partition/gui/ReplacePage.cpp
index f3ca67558..6fa76fc76 100644
--- a/src/modules/partition/gui/ReplacePage.cpp
+++ b/src/modules/partition/gui/ReplacePage.cpp
@@ -49,7 +49,10 @@ ReplacePage::ReplacePage( PartitionCoreModule* core, QWidget* parent )
m_ui->deviceComboBox->setModel( m_core->deviceModel() );
m_ui->partitionPreview->setLabelsVisible( true );
- loadEfiSystemPartitions();
+ m_ui->bootComboBox->hide();
+ m_ui->bootComboBox->clear();
+ m_ui->bootStatusLabel->hide();
+ m_ui->bootStatusLabel->clear();
// updateButtons();
@@ -84,7 +87,12 @@ ReplacePage::reset()
{
int oldDeviceIndex = m_ui->deviceComboBox->currentIndex();
m_core->revert();
- loadEfiSystemPartitions();
+
+ m_ui->bootComboBox->hide();
+ m_ui->bootComboBox->clear();
+ m_ui->bootStatusLabel->hide();
+ m_ui->bootStatusLabel->clear();
+
m_ui->deviceComboBox->setCurrentIndex( oldDeviceIndex );
updateFromCurrentDevice();
}
@@ -115,18 +123,19 @@ ReplacePage::applyChanges()
if ( m_isEfi )
{
- if ( m_efiSystemPartitions.count() == 1 )
+ QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions();
+ if ( efiSystemPartitions.count() == 1 )
{
PartitionInfo::setMountPoint(
- m_efiSystemPartitions.first(),
+ efiSystemPartitions.first(),
Calamares::JobQueue::instance()->
globalStorage()->
value( "efiSystemPartition" ).toString() );
}
- else if ( m_efiSystemPartitions.count() > 1 )
+ else if ( efiSystemPartitions.count() > 1 )
{
PartitionInfo::setMountPoint(
- m_efiSystemPartitions.at( m_ui->bootComboBox->currentIndex() ),
+ efiSystemPartitions.at( m_ui->bootComboBox->currentIndex() ),
Calamares::JobQueue::instance()->
globalStorage()->
value( "efiSystemPartition" ).toString() );
@@ -265,7 +274,8 @@ ReplacePage::onPartitionSelected()
if ( m_isEfi )
{
- if ( m_efiSystemPartitions.count() == 0 )
+ QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions();
+ if ( efiSystemPartitions.count() == 0 )
{
updateStatus( CalamaresUtils::Fail,
tr( "%2
"
@@ -277,7 +287,7 @@ ReplacePage::onPartitionSelected()
.arg( prettyName ) );
setNextEnabled( false );
}
- else if ( m_efiSystemPartitions.count() == 1 )
+ else if ( efiSystemPartitions.count() == 1 )
{
updateStatus( CalamaresUtils::PartitionPartition,
tr( "%3
"
@@ -291,7 +301,7 @@ ReplacePage::onPartitionSelected()
m_ui->bootStatusLabel->show();
m_ui->bootStatusLabel->setText(
tr( "The EFI system partition at %1 will be used for starting %2." )
- .arg( m_efiSystemPartitions.first()->partitionPath() )
+ .arg( efiSystemPartitions.first()->partitionPath() )
.arg( Calamares::Branding::instance()->
string( Calamares::Branding::ShortProductName ) ) );
setNextEnabled( true );
@@ -310,9 +320,9 @@ ReplacePage::onPartitionSelected()
m_ui->bootStatusLabel->show();
m_ui->bootStatusLabel->setText( tr( "EFI system partition:" ) );
m_ui->bootComboBox->show();
- for ( int i = 0; i < m_efiSystemPartitions.count(); ++i )
+ for ( int i = 0; i < efiSystemPartitions.count(); ++i )
{
- Partition* efiPartition = m_efiSystemPartitions.at( i );
+ Partition* efiPartition = efiSystemPartitions.at( i );
m_ui->bootComboBox->addItem( efiPartition->partitionPath(), i );
if ( efiPartition->devicePath() == partition->devicePath() &&
efiPartition->number() == 1 )
@@ -417,52 +427,3 @@ ReplacePage::onPartitionModelReset()
m_ui->partitionTreeView->expandAll();
onPartitionSelected();
}
-
-
-void
-ReplacePage::loadEfiSystemPartitions()
-{
- m_efiSystemPartitions.clear();
- m_ui->bootComboBox->hide();
- m_ui->bootComboBox->clear();
- m_ui->bootStatusLabel->hide();
- m_ui->bootStatusLabel->clear();
-
- QList< Device* > devices;
- for ( int row = 0; row < m_core->deviceModel()->rowCount(); ++row )
- {
- Device* device = m_core->deviceModel()->deviceForIndex(
- m_core->deviceModel()->index( row ) );
- devices.append( device );
- }
-
- //FIXME: Unfortunately right now we have to call sgdisk manually because
- // the KPM submodule does not expose the ESP flag from libparted.
- // The following findPartitions call and lambda should be scrapped and
- // rewritten based on libKPM. -- Teo 5/2015
- m_efiSystemPartitions =
- PMUtils::findPartitions( devices,
- []( Partition* partition ) -> bool
- {
- QProcess process;
- process.setProgram( "sgdisk" );
- process.setArguments( { "-i",
- QString::number( partition->number() ),
- partition->devicePath() } );
- process.setProcessChannelMode( QProcess::MergedChannels );
- process.start();
- if ( process.waitForFinished() )
- {
- if ( process.readAllStandardOutput()
- .contains( "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" ) )
- {
- cDebug() << "Found EFI system partition at" << partition->partitionPath();
- return true;
- }
- }
- return false;
- } );
-
- if ( m_efiSystemPartitions.isEmpty() )
- cDebug() << "WARNING: system is EFI but no EFI system partitions found.";
-}
diff --git a/src/modules/partition/gui/ReplacePage.h b/src/modules/partition/gui/ReplacePage.h
index 576e37bea..f09dcdd32 100644
--- a/src/modules/partition/gui/ReplacePage.h
+++ b/src/modules/partition/gui/ReplacePage.h
@@ -62,12 +62,10 @@ private:
bool m_nextEnabled;
bool m_isEfi;
- QList< Partition* > m_efiSystemPartitions;
void updateFromCurrentDevice();
void onPartitionViewActivated();
void onPartitionModelReset();
- void loadEfiSystemPartitions();
};
#endif // REPLACEPAGE_H