[partition] Crypto device-list needn't be a member, either
This commit is contained in:
parent
f49389a408
commit
04b119b051
@ -104,6 +104,45 @@ getSwapsForDevice( const QString& deviceName )
|
||||
return swapPartitions;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
isControl( const QString& baseName )
|
||||
{
|
||||
return baseName == "control";
|
||||
}
|
||||
|
||||
static inline bool
|
||||
isFedoraSpecial( const QString& baseName )
|
||||
{
|
||||
// Fedora live images use /dev/mapper/live-* internally. We must not
|
||||
// unmount those devices, because they are used by the live image and
|
||||
// because we need /dev/mapper/live-base in the unpackfs module.
|
||||
return baseName.startsWith( "live-" );
|
||||
}
|
||||
|
||||
/** @brief Returns a list of unneeded crypto devices
|
||||
*
|
||||
* These are the crypto devices to unmount and close; some are "needed"
|
||||
* for system operation: on Fedora, the live- mappers are special.
|
||||
* Some other devices are special, too, so those do not end up in
|
||||
* the list.
|
||||
*/
|
||||
STATICTEST QStringList
|
||||
getCryptoDevices()
|
||||
{
|
||||
QDir mapperDir( "/dev/mapper" );
|
||||
const QFileInfoList fiList = mapperDir.entryInfoList( QDir::Files );
|
||||
QStringList list;
|
||||
for ( const QFileInfo& fi : fiList )
|
||||
{
|
||||
QString baseName = fi.baseName();
|
||||
if ( isControl( baseName ) || isFedoraSpecial( baseName ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.append( fi.absoluteFilePath() );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* The tryX() free functions, below, return an empty QString on
|
||||
@ -344,25 +383,3 @@ ClearMountsJob::exec()
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
QStringList
|
||||
ClearMountsJob::getCryptoDevices() const
|
||||
{
|
||||
QDir mapperDir( "/dev/mapper" );
|
||||
const QFileInfoList fiList = mapperDir.entryInfoList( QDir::Files );
|
||||
QStringList list;
|
||||
QProcess process;
|
||||
for ( const QFileInfo& fi : fiList )
|
||||
{
|
||||
QString baseName = fi.baseName();
|
||||
// Fedora live images use /dev/mapper/live-* internally. We must not
|
||||
// unmount those devices, because they are used by the live image and
|
||||
// because we need /dev/mapper/live-base in the unpackfs module.
|
||||
if ( baseName == "control" || baseName.startsWith( "live-" ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.append( fi.absoluteFilePath() );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
QStringList getCryptoDevices() const;
|
||||
Device* m_device;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user