[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
@ -127,7 +127,7 @@ isFedoraSpecial( const QString& baseName )
|
|||||||
* the list.
|
* the list.
|
||||||
*/
|
*/
|
||||||
STATICTEST QStringList
|
STATICTEST QStringList
|
||||||
getCryptoDevices()
|
getCryptoDevices( const QStringList& mapperExceptions )
|
||||||
{
|
{
|
||||||
QDir mapperDir( "/dev/mapper" );
|
QDir mapperDir( "/dev/mapper" );
|
||||||
const QFileInfoList fiList = mapperDir.entryInfoList( QDir::Files );
|
const QFileInfoList fiList = mapperDir.entryInfoList( QDir::Files );
|
||||||
@ -135,7 +135,7 @@ getCryptoDevices()
|
|||||||
for ( const QFileInfo& fi : fiList )
|
for ( const QFileInfo& fi : fiList )
|
||||||
{
|
{
|
||||||
QString baseName = fi.baseName();
|
QString baseName = fi.baseName();
|
||||||
if ( isControl( baseName ) || isFedoraSpecial( baseName ) )
|
if ( isControl( baseName ) || isFedoraSpecial( baseName ) || mapperExceptions.contains( baseName ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -371,11 +371,11 @@ ClearMountsJob::exec()
|
|||||||
CalamaresUtils::Partition::Syncer s;
|
CalamaresUtils::Partition::Syncer s;
|
||||||
QList< MessageAndPath > goodNews;
|
QList< MessageAndPath > goodNews;
|
||||||
|
|
||||||
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
apply( getCryptoDevices( m_mapperExceptions ), tryCryptoClose, goodNews );
|
||||||
apply( getLVMVolumes(), tryUmount, goodNews );
|
apply( getLVMVolumes(), tryUmount, goodNews );
|
||||||
apply( getPVGroups( deviceName ), tryVGDisable, goodNews );
|
apply( getPVGroups( deviceName ), tryVGDisable, goodNews );
|
||||||
|
|
||||||
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
apply( getCryptoDevices( m_mapperExceptions ), tryCryptoClose, goodNews );
|
||||||
apply( getPartitionsForDevice( deviceName ), tryUmount, goodNews );
|
apply( getPartitionsForDevice( deviceName ), tryUmount, goodNews );
|
||||||
apply( getSwapsForDevice( m_deviceNode ), tryClearSwap, goodNews );
|
apply( getSwapsForDevice( m_deviceNode ), tryClearSwap, goodNews );
|
||||||
|
|
||||||
|
@ -23,8 +23,14 @@ class Device;
|
|||||||
* - physical volumes for LVM on the device are disabled
|
* - physical volumes for LVM on the device are disabled
|
||||||
*
|
*
|
||||||
* In addition, regardless of device:
|
* 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
|
* - 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
|
class ClearMountsJob : public Calamares::Job
|
||||||
@ -42,8 +48,12 @@ public:
|
|||||||
QString prettyStatusMessage() const override;
|
QString prettyStatusMessage() const override;
|
||||||
Calamares::JobResult exec() 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:
|
private:
|
||||||
const QString m_deviceNode;
|
const QString m_deviceNode;
|
||||||
|
QStringList m_mapperExceptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLEARMOUNTSJOB_H
|
#endif // CLEARMOUNTSJOB_H
|
||||||
|
Loading…
Reference in New Issue
Block a user