mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[partition] Allow exceptions when closing /dev/mapper
- some names should not be closed, like "control" - allow a list of names to be added which should not be closed
This commit is contained in:
parent
1410157356
commit
7b45793b60
2 changed files with 15 additions and 5 deletions
|
@ -127,7 +127,7 @@ isFedoraSpecial( const QString& baseName )
|
|||
* the list.
|
||||
*/
|
||||
STATICTEST QStringList
|
||||
getCryptoDevices()
|
||||
getCryptoDevices( const QStringList& mapperExceptions )
|
||||
{
|
||||
QDir mapperDir( "/dev/mapper" );
|
||||
const QFileInfoList fiList = mapperDir.entryInfoList( QDir::Files );
|
||||
|
@ -135,7 +135,7 @@ getCryptoDevices()
|
|||
for ( const QFileInfo& fi : fiList )
|
||||
{
|
||||
QString baseName = fi.baseName();
|
||||
if ( isControl( baseName ) || isFedoraSpecial( baseName ) )
|
||||
if ( isControl( baseName ) || isFedoraSpecial( baseName ) || mapperExceptions.contains( baseName ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -371,11 +371,11 @@ ClearMountsJob::exec()
|
|||
CalamaresUtils::Partition::Syncer s;
|
||||
QList< MessageAndPath > goodNews;
|
||||
|
||||
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
||||
apply( getCryptoDevices( m_mapperExceptions ), tryCryptoClose, goodNews );
|
||||
apply( getLVMVolumes(), tryUmount, goodNews );
|
||||
apply( getPVGroups( deviceName ), tryVGDisable, goodNews );
|
||||
|
||||
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
||||
apply( getCryptoDevices( m_mapperExceptions ), tryCryptoClose, goodNews );
|
||||
apply( getPartitionsForDevice( deviceName ), tryUmount, goodNews );
|
||||
apply( getSwapsForDevice( m_deviceNode ), tryClearSwap, goodNews );
|
||||
|
||||
|
|
|
@ -23,8 +23,14 @@ class Device;
|
|||
* - physical volumes for LVM on the device are disabled
|
||||
*
|
||||
* In addition, regardless of device:
|
||||
* - all /dev/mapper entries (crypto / LUKS) are closed
|
||||
* - almost all(*) /dev/mapper entries (crypto / LUKS, also LVM) are closed
|
||||
* - all logical volumes for LVM are unmounted
|
||||
* Exceptions to "all /dev/mapper" may be configured through
|
||||
* the setMapperExceptions() method. Pass in names of mapper
|
||||
* files that should not be closed (e.g. "myvg-mylv").
|
||||
*
|
||||
* (*) Some exceptions always exist: /dev/mapper/control is never
|
||||
* closed. /dev/mapper/live-* is never closed.
|
||||
*
|
||||
*/
|
||||
class ClearMountsJob : public Calamares::Job
|
||||
|
@ -42,8 +48,12 @@ public:
|
|||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
///@brief Sets the list of exceptions (names) when closing /dev/mapper
|
||||
void setMapperExceptions( const QStringList& names ) { m_mapperExceptions = names; }
|
||||
|
||||
private:
|
||||
const QString m_deviceNode;
|
||||
QStringList m_mapperExceptions;
|
||||
};
|
||||
|
||||
#endif // CLEARMOUNTSJOB_H
|
||||
|
|
Loading…
Add table
Reference in a new issue