Merge branch 'issue-1393' into calamares

main
Adriaan de Groot 4 years ago
commit 80cad17e97

@ -92,6 +92,19 @@ isIso9660( const Device* device )
return false;
}
static inline bool
isZRam( const Device* device )
{
const QString path = device->deviceNode();
return path.startsWith( "/dev/zram" );
}
static inline bool
isFloppyDrive( const Device* device )
{
const QString path = device->deviceNode();
return path.startsWith( "/dev/fd" ) || path.startsWith( "/dev/floppy" );
}
static inline QDebug&
operator<<( QDebug& s, QList< Device* >::iterator& it )
@ -112,7 +125,7 @@ erase( DeviceList& l, DeviceList::iterator& it )
}
QList< Device* >
getDevices( DeviceType which, qint64 minimumSize )
getDevices( DeviceType which )
{
bool writableOnly = ( which == DeviceType::WritableOnly );
@ -138,11 +151,16 @@ getDevices( DeviceType which, qint64 minimumSize )
cDebug() << Logger::SubEntry << "Skipping nullptr device";
it = erase( devices, it );
}
else if ( ( *it )->deviceNode().startsWith( "/dev/zram" ) )
else if ( isZRam( *it ) )
{
cDebug() << Logger::SubEntry << "Removing zram" << it;
it = erase( devices, it );
}
else if ( isFloppyDrive( ( *it ) ) )
{
cDebug() << Logger::SubEntry << "Removing floppy disk" << it;
it = erase( devices, it );
}
else if ( writableOnly && hasRootPartition( *it ) )
{
cDebug() << Logger::SubEntry << "Removing device with root filesystem (/) on it" << it;
@ -153,11 +171,6 @@ getDevices( DeviceType which, qint64 minimumSize )
cDebug() << Logger::SubEntry << "Removing device with iso9660 filesystem (probably a CD) on it" << it;
it = erase( devices, it );
}
else if ( ( minimumSize >= 0 ) && !( ( *it )->capacity() > minimumSize ) )
{
cDebug() << Logger::SubEntry << "Removing too-small" << it;
it = erase( devices, it );
}
else
{
++it;

@ -45,7 +45,7 @@ enum class DeviceType
* greater than @p minimumSize will be returned.
* @return a list of Devices meeting this criterium.
*/
QList< Device* > getDevices( DeviceType which = DeviceType::All, qint64 minimumSize = -1 );
QList< Device* > getDevices( DeviceType which = DeviceType::All );
} // namespace PartUtils

@ -122,6 +122,7 @@ PartitionViewStep::~PartitionViewStep()
{
m_manualPartitionPage->deleteLater();
}
delete m_core;
}

Loading…
Cancel
Save