[partition] Refactor getting partitions from device

- Split out into own function
 - Prepare for implementation that doesn't use external processes
This commit is contained in:
Adriaan de Groot 2019-06-21 21:17:43 +02:00
parent 61f46e77e0
commit ecdd09edcd

View File

@ -60,14 +60,9 @@ ClearMountsJob::prettyStatusMessage() const
} }
Calamares::JobResult QStringList
ClearMountsJob::exec() getPartitionsForDevice( const QString& deviceName )
{ {
CalamaresUtils::Partition::Syncer s;
QStringList goodNews;
QString deviceName = m_device->deviceNode().split( '/' ).last();
QProcess process; QProcess process;
process.setProgram( "sh" ); process.setProgram( "sh" );
process.setArguments( { process.setArguments( {
@ -81,6 +76,21 @@ ClearMountsJob::exec()
const QString partitions = process.readAllStandardOutput(); const QString partitions = process.readAllStandardOutput();
const QStringList partitionsList = partitions.simplified().split( ' ' ); const QStringList partitionsList = partitions.simplified().split( ' ' );
return partitionsList;
}
Calamares::JobResult
ClearMountsJob::exec()
{
CalamaresUtils::Partition::Syncer s;
QString deviceName = m_device->deviceNode().split( '/' ).last();
QStringList goodNews;
QProcess process;
QStringList partitionsList = getPartitionsForDevice( deviceName );
// Build a list of partitions of type 82 (Linux swap / Solaris). // Build a list of partitions of type 82 (Linux swap / Solaris).
// We then need to clear them just in case they contain something resumable from a // We then need to clear them just in case they contain something resumable from a
// previous suspend-to-disk. // previous suspend-to-disk.