From 8db004ce4552a4b790d9164ff2b491787011d37a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 17 Mar 2019 13:32:18 -0400 Subject: [PATCH] [partition] Use the FailJob to stop installation - For unsafe installations (compile-time option), make sure things fail before partitions are actually written, unless the other option is also turned off. --- src/modules/partition/core/DeviceList.cpp | 3 +++ src/modules/partition/core/PartitionCoreModule.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index 43d31fc5b..cba942a06 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -111,6 +111,9 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) #ifdef DEBUG_PARTITION_UNSAFE cWarning() << "Allowing unsafe partitioning choices." << devices.count() << "candidates."; +#ifdef DEBUG_PARTITION_LAME + cDebug() << ".. it has been lamed, and will fail."; +#endif #else cDebug() << "Removing unsuitable devices:" << devices.count() << "candidates."; diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 07cb0fcfd..6beace4ff 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -45,6 +45,9 @@ #include "jobs/SetPartitionFlagsJob.h" #include "utils/CalamaresUtils.h" +#ifdef DEBUG_PARTITION_LAME +#include "JobExample.h" +#endif #include "Typedefs.h" #include "utils/Logger.h" @@ -497,6 +500,17 @@ PartitionCoreModule::jobs() const QList< Calamares::job_ptr > lst; QList< Device* > devices; +#ifdef DEBUG_PARTITION_UNSAFE +#ifdef DEBUG_PARTITION_LAME + cDebug() << "Unsafe partitioning is enabled."; + cDebug() << ".. it has been lamed, and will fail."; + lst << Calamares::job_ptr( new Calamares::FailJob( QStringLiteral( "Partition" ) ) ); +#else + cWarning() << "Unsafe partitioning is enabled."; + cWarning() << ".. the unsafe actions will be executed."; +#endif +#endif + lst << Calamares::job_ptr( new ClearTempMountsJob() ); for ( auto info : m_deviceInfos )