diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index b9b2109a3..56520845e 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -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) include(KDEInstallDirs) @@ -84,6 +99,7 @@ if ( KPMcore_FOUND ) kpmcore calamaresui KF5::CoreAddons + COMPILE_DEFINITIONS ${_partition_defs} SHARED_LIB ) else() diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index f51eec047..43d31fc5b 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -109,6 +109,9 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) CoreBackend* backend = CoreBackendManager::self()->backend(); 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."; // Remove the device which contains / from the list @@ -142,6 +145,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) } else ++it; +#endif return devices; }