[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.
This commit is contained in:
Adriaan de Groot 2019-03-17 13:32:18 -04:00
parent 62f03d8aad
commit 8db004ce45
2 changed files with 17 additions and 0 deletions

View File

@ -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.";

View File

@ -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 )