From 1548fe4810236782678c88a93732a6978ba555b7 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sat, 29 Oct 2016 01:09:14 +0200 Subject: [PATCH] [partition] Use FlagEsp instead of sgdisk to scan for ESPs. Address an old FIXME in PartitionCoreModule::scanForEfiSystemPartitions(): Check the FlagEsp on the Partition object (that KPMcore has been supporting since 2.1.0) instead of running sgdisk. --- .../partition/core/PartitionCoreModule.cpp | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 77333846a..87393a424 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -548,29 +548,14 @@ PartitionCoreModule::scanForEfiSystemPartitions() 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 QList< Partition* > efiSystemPartitions = KPMHelpers::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 ( partition->activeFlags().testFlag( PartitionTable::FlagEsp ) ) { - if ( process.readAllStandardOutput() - .contains( "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" ) ) - { - cDebug() << "Found EFI system partition at" << partition->partitionPath(); - return true; - } + cDebug() << "Found EFI system partition at" << partition->partitionPath(); + return true; } return false; } );