[partition] Allow unsafe partitioning decisions
- This is a compile-time choice, and off by default. This may be useful for developers that need to get through installation to a different partition on their root drive. - Add an option to avoid actually doing unsafe things. This is an extra safeguard; you need to turn on one and turn off the other option to really be unsafe.
This commit is contained in:
parent
2caefce3cb
commit
62f03d8aad
@ -1,3 +1,18 @@
|
|||||||
|
# When debugging the partitioning widget, or experimenting, you may
|
||||||
|
# want to allow unsafe partitioning choices (e.g. doing things to the
|
||||||
|
# current disk). Set DEBUG_PARTITION_UNSAFE to allow that (it turns off
|
||||||
|
# some filtering of devices).
|
||||||
|
option( DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF )
|
||||||
|
option( DEBUG_PARTITION_LAME "Unsafe partitioning will error out on exec." ON )
|
||||||
|
|
||||||
|
set( _partition_defs )
|
||||||
|
if( DEBUG_PARTITION_UNSAFE )
|
||||||
|
if( DEBUG_PARTITION_LAME )
|
||||||
|
list( APPEND _partition_defs DEBUG_PARTITION_LAME )
|
||||||
|
endif()
|
||||||
|
list( APPEND _partition_defs DEBUG_PARTITION_UNSAFE )
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
|
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
|
||||||
|
|
||||||
include(KDEInstallDirs)
|
include(KDEInstallDirs)
|
||||||
@ -84,6 +99,7 @@ if ( KPMcore_FOUND )
|
|||||||
kpmcore
|
kpmcore
|
||||||
calamaresui
|
calamaresui
|
||||||
KF5::CoreAddons
|
KF5::CoreAddons
|
||||||
|
COMPILE_DEFINITIONS ${_partition_defs}
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
|
@ -109,6 +109,9 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
|
|||||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||||
DeviceList devices = backend->scanDevices( true );
|
DeviceList devices = backend->scanDevices( true );
|
||||||
|
|
||||||
|
#ifdef DEBUG_PARTITION_UNSAFE
|
||||||
|
cWarning() << "Allowing unsafe partitioning choices." << devices.count() << "candidates.";
|
||||||
|
#else
|
||||||
cDebug() << "Removing unsuitable devices:" << devices.count() << "candidates.";
|
cDebug() << "Removing unsuitable devices:" << devices.count() << "candidates.";
|
||||||
|
|
||||||
// Remove the device which contains / from the list
|
// Remove the device which contains / from the list
|
||||||
@ -142,6 +145,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
|
#endif
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user