Merge branch 'issue-1110'
SEE #1110 There isn't really anything to fix: partitions are aligned to 1MiB boundaries now. Manjaro 18.0.3 is probably before the early-august commit that added that. While here, add some better partitioning-debugging and cleanups.
This commit is contained in:
commit
228971ce0b
@ -24,6 +24,9 @@
|
||||
#
|
||||
# SKIP_MODULES : a space or semicolon-separated list of directory names
|
||||
# under src/modules that should not be built.
|
||||
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>
|
||||
# BUILD_<foo> : choose additional things to build
|
||||
# DEBUG_<foo> : special developer flags for debugging
|
||||
#
|
||||
# Example usage:
|
||||
#
|
||||
@ -62,7 +65,8 @@ option( WITH_KF5Crash "Enable crash reporting with KCrash." ON )
|
||||
# all the implementations are enabled (this just means they are
|
||||
# **available** to `settings.conf`, not that they are used).
|
||||
#
|
||||
# Currently, no USE_<foo> variables exist.
|
||||
# Currently, only USE_services is in use (to pick only one of the two
|
||||
# modules, systemd or openrc).
|
||||
set( USE_services "" CACHE STRING "Select the services module to use" )
|
||||
|
||||
### Calamares application info
|
||||
|
@ -19,27 +19,41 @@
|
||||
###
|
||||
#
|
||||
# Support functions for building plugins.
|
||||
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# calamares_add_library(
|
||||
# library-name
|
||||
# EXPORT_MACRO macro-name
|
||||
# TARGET_TYPE <STATIC|MODULE|...>
|
||||
# EXPORT export-name
|
||||
# VERSION version
|
||||
# SOVERSION version
|
||||
# INSTALL_BINDIR dir
|
||||
# RESOURCES resource-file
|
||||
# SOURCES source-file...
|
||||
# UI ui-file...
|
||||
# LINK_LIBRARIES lib...
|
||||
# LINK_PRIVATE_LIBRARIES lib...
|
||||
# COMPILE_DEFINITIONS def...
|
||||
# [NO_INSTALL]
|
||||
# [NO_VERSION]
|
||||
# )
|
||||
#
|
||||
# The COMPILE_DEFINITIONS are set on the resulting module with a suitable
|
||||
# flag (i.e. `-D`) so only state the name (optionally, also the value)
|
||||
# without a `-D` prefixed to it. Pass in a CMake list as needed.
|
||||
include( CMakeParseArguments )
|
||||
|
||||
function(calamares_add_library)
|
||||
# parse arguments (name needs to be saved before passing ARGN into the macro)
|
||||
set(NAME ${ARGV0})
|
||||
set(options NO_INSTALL NO_VERSION)
|
||||
set(oneValueArgs NAME TYPE EXPORT_MACRO TARGET TARGET_TYPE EXPORT VERSION SOVERSION INSTALL_BINDIR RESOURCES)
|
||||
set(multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS QT5_MODULES)
|
||||
set(oneValueArgs NAME EXPORT_MACRO TARGET_TYPE EXPORT VERSION SOVERSION INSTALL_BINDIR RESOURCES)
|
||||
set(multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS)
|
||||
cmake_parse_arguments(LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
set(LIBRARY_NAME ${NAME})
|
||||
|
||||
|
||||
# message("*** Arguments for ${LIBRARY_NAME}")
|
||||
# message("Sources: ${LIBRARY_SOURCES}")
|
||||
# message("Link libraries: ${LIBRARY_LINK_LIBRARIES}")
|
||||
# message("UI: ${LIBRARY_UI}")
|
||||
# message("TARGET_TYPE: ${LIBRARY_TARGET_TYPE}")
|
||||
# message("EXPORT_MACRO: ${LIBRARY_EXPORT_MACRO}")
|
||||
# message("NO_INSTALL: ${LIBRARY_NO_INSTALL}")
|
||||
|
||||
set(target ${LIBRARY_NAME})
|
||||
|
||||
# qt stuff
|
||||
@ -76,13 +90,8 @@ function(calamares_add_library)
|
||||
endif()
|
||||
|
||||
if(LIBRARY_COMPILE_DEFINITIONS)
|
||||
# Dear CMake, i hate you! Sincerely, domme
|
||||
# At least in CMake 2.8.8, you CANNOT set more than one COMPILE_DEFINITIONS value
|
||||
# only takes the first one if called multiple times or bails out with wrong number of arguments
|
||||
# when passing in a list, thus i redefine the export macro here in hope it won't mess up other targets
|
||||
add_definitions( "-D${LIBRARY_EXPORT_MACRO}" )
|
||||
|
||||
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${LIBRARY_COMPILE_DEFINITIONS})
|
||||
set( _lib_definitions "${LIBRARY_EXPORT_MACRO}" ${LIBRARY_COMPILE_DEFINITIONS} )
|
||||
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS "${_lib_definitions}")
|
||||
endif()
|
||||
|
||||
# add link targets
|
||||
@ -119,9 +128,6 @@ function(calamares_add_library)
|
||||
set(LIBRARY_INSTALL_LIBDIR "${LIBRARY_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
#message("INSTALL_BINDIR: ${LIBRARY_INSTALL_BINDIR}")
|
||||
#message("INSTALL_LIBDIR: ${LIBRARY_INSTALL_LIBDIR}")
|
||||
|
||||
# make installation optional, maybe useful for dummy plugins one day
|
||||
if(NOT LIBRARY_NO_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
|
@ -40,6 +40,10 @@
|
||||
# [SHARED_LIB]
|
||||
# [EMERGENCY]
|
||||
# )
|
||||
#
|
||||
# The COMPILE_DEFINITIONS are set on the resulting module with a suitable
|
||||
# flag (i.e. `-D`) so only state the name (optionally, also the value)
|
||||
# without a `-D` prefixed to it.
|
||||
|
||||
include( CMakeParseArguments )
|
||||
include( CalamaresAddLibrary )
|
||||
|
@ -114,6 +114,7 @@ main( int argc, char* argv[] )
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here we have not yet set-up the logger system, so qDebug() is ok
|
||||
auto instancelist = guard.instances();
|
||||
qDebug() << "Calamares is already running, shutting down.";
|
||||
if ( instancelist.count() > 0 )
|
||||
|
@ -16,6 +16,7 @@ set( libSources
|
||||
CppJob.cpp
|
||||
GlobalStorage.cpp
|
||||
Job.cpp
|
||||
JobExample.cpp
|
||||
JobQueue.cpp
|
||||
ProcessJob.cpp
|
||||
Settings.cpp
|
||||
|
42
src/libcalamares/JobExample.cpp
Normal file
42
src/libcalamares/JobExample.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2019, Adriaan de Groot <groot.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "JobExample.h"
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
QString
|
||||
NamedJob::prettyName() const
|
||||
{
|
||||
return tr( "Example job (%1)" ).arg( m_name );
|
||||
}
|
||||
|
||||
JobResult
|
||||
GoodJob::exec()
|
||||
{
|
||||
return JobResult::ok();
|
||||
}
|
||||
|
||||
JobResult
|
||||
FailJob::exec()
|
||||
{
|
||||
return JobResult::error( tr( "Job failed (%1)" ).arg( m_name ), tr( "Programmed job failure was explicitly requested." ) );
|
||||
}
|
||||
|
||||
} // namespace
|
73
src/libcalamares/JobExample.h
Normal file
73
src/libcalamares/JobExample.h
Normal file
@ -0,0 +1,73 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2019, Adriaan de Groot <groot.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CALAMARES_JOB_EXAMPLE_H
|
||||
#define CALAMARES_JOB_EXAMPLE_H
|
||||
|
||||
#include "Job.h"
|
||||
|
||||
namespace Calamares {
|
||||
|
||||
/** @brief A Job with a name
|
||||
*
|
||||
* This includes a default implementation of prettyName(),
|
||||
* but is only used as a base for FailJob and GoodJob,
|
||||
* which are support / bogus classes.
|
||||
*/
|
||||
class DLLEXPORT NamedJob : public Job
|
||||
{
|
||||
public:
|
||||
explicit NamedJob( const QString& name, QObject* parent = nullptr )
|
||||
: Job( parent )
|
||||
, m_name( name )
|
||||
{
|
||||
}
|
||||
|
||||
virtual QString prettyName() const override;
|
||||
protected:
|
||||
const QString m_name;
|
||||
} ;
|
||||
|
||||
/// @brief Job does nothing, always succeeds
|
||||
class DLLEXPORT GoodJob : public NamedJob
|
||||
{
|
||||
public:
|
||||
explicit GoodJob( const QString& name, QObject* parent = nullptr )
|
||||
: NamedJob( name, parent )
|
||||
{
|
||||
}
|
||||
|
||||
virtual JobResult exec() override;
|
||||
} ;
|
||||
|
||||
|
||||
/// @brief Job does nothing, always fails
|
||||
class DLLEXPORT FailJob : public NamedJob
|
||||
{
|
||||
public:
|
||||
explicit FailJob( const QString& name, QObject* parent = nullptr )
|
||||
: NamedJob( name, parent )
|
||||
{
|
||||
}
|
||||
|
||||
virtual JobResult exec() override;
|
||||
} ;
|
||||
|
||||
} // namespace Calamares
|
||||
|
||||
#endif // CALAMARES_JOB_EXAMPLE_H
|
@ -6,6 +6,10 @@ if ( KPMcore_FOUND )
|
||||
include_directories( ${KPMCORE_INCLUDE_DIR} )
|
||||
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares )
|
||||
|
||||
if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
|
||||
add_definitions(-DWITH_KPMCOREGT33) # kpmcore greater than 3.3
|
||||
endif()
|
||||
|
||||
# The PartitionIterator is a small class, and it's easiest -- but also a
|
||||
# gross hack -- to just compile it again from the partition module tree.
|
||||
calamares_add_plugin( fsresizer
|
||||
|
@ -120,7 +120,12 @@ ResizeFSJob::PartitionMatch
|
||||
ResizeFSJob::findPartition( CoreBackend* backend )
|
||||
{
|
||||
using DeviceList = QList< Device* >;
|
||||
DeviceList devices = backend->scanDevices( false );
|
||||
#ifdef WITH_KPMCOREGT33
|
||||
DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) );
|
||||
#else
|
||||
DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true );
|
||||
#endif
|
||||
|
||||
cDebug() << "ResizeFSJob found" << devices.count() << "devices.";
|
||||
for ( DeviceList::iterator dev_it = devices.begin(); dev_it != devices.end(); ++dev_it )
|
||||
{
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "keyboardglobal.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
//###
|
||||
//### Public methods
|
||||
//###
|
||||
@ -52,7 +54,7 @@ QMap<QString, QString> KeyboardGlobal::parseKeyboardModels(QString filepath)
|
||||
fh.open(QIODevice::ReadOnly);
|
||||
|
||||
if (!fh.isOpen()) {
|
||||
qDebug() << "X11 Keyboard model definitions not found!";
|
||||
cDebug() << "X11 Keyboard model definitions not found!";
|
||||
return models;
|
||||
}
|
||||
|
||||
@ -100,7 +102,7 @@ QMap< QString, KeyboardGlobal::KeyboardInfo > KeyboardGlobal::parseKeyboardLayou
|
||||
fh.open(QIODevice::ReadOnly);
|
||||
|
||||
if (!fh.isOpen()) {
|
||||
qDebug() << "X11 Keyboard layout definitions not found!";
|
||||
cDebug() << "X11 Keyboard layout definitions not found!";
|
||||
return layouts;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
# When debugging the timezone widget, add this debugging definition
|
||||
# to have a debugging-friendly timezone widget, debug logging,
|
||||
# and no intrusive timezone-setting while clicking around.
|
||||
#
|
||||
# add_definitions( -DDEBUG_TIMEZONES )
|
||||
option( DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF )
|
||||
if( DEBUG_TIMEZONES )
|
||||
add_definitions( -DDEBUG_TIMEZONES )
|
||||
endif()
|
||||
|
||||
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
|
||||
|
||||
|
@ -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()
|
||||
|
@ -107,8 +107,18 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
|
||||
bool writableOnly = (which == DeviceType::WritableOnly);
|
||||
|
||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||
DeviceList devices = backend->scanDevices( true );
|
||||
#ifdef WITH_KPMCOREGT33
|
||||
DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) );
|
||||
#else
|
||||
DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true );
|
||||
#endif
|
||||
|
||||
#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.";
|
||||
|
||||
// Remove the device which contains / from the list
|
||||
@ -142,6 +152,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
|
||||
}
|
||||
else
|
||||
++it;
|
||||
#endif
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ isPartitionFreeSpace( Partition* partition )
|
||||
bool
|
||||
isPartitionNew( Partition* partition )
|
||||
{
|
||||
return partition->state() == Partition::StateNew;
|
||||
return partition->state() == KPM_PARTITION_STATE(New);
|
||||
}
|
||||
|
||||
|
||||
@ -127,11 +127,11 @@ createNewPartition( PartitionNode* parent,
|
||||
role,
|
||||
fs, fs->firstSector(), fs->lastSector(),
|
||||
QString() /* path */,
|
||||
PartitionTable::FlagNone /* availableFlags */,
|
||||
KPM_PARTITION_FLAG(None) /* availableFlags */,
|
||||
QString() /* mountPoint */,
|
||||
false /* mounted */,
|
||||
flags /* activeFlags */,
|
||||
Partition::StateNew
|
||||
KPM_PARTITION_STATE(New)
|
||||
);
|
||||
}
|
||||
|
||||
@ -169,11 +169,11 @@ createNewEncryptedPartition( PartitionNode* parent,
|
||||
PartitionRole( newRoles ),
|
||||
fs, fs->firstSector(), fs->lastSector(),
|
||||
QString() /* path */,
|
||||
PartitionTable::FlagNone /* availableFlags */,
|
||||
KPM_PARTITION_FLAG(None) /* availableFlags */,
|
||||
QString() /* mountPoint */,
|
||||
false /* mounted */,
|
||||
flags /* activeFlags */,
|
||||
Partition::StateNew );
|
||||
KPM_PARTITION_STATE(New) );
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,16 @@ class Partition;
|
||||
class PartitionNode;
|
||||
class PartitionRole;
|
||||
|
||||
#ifdef WITH_KPMCOREGT33
|
||||
#define KPM_PARTITION_FLAG(x) PartitionTable::Flag::x
|
||||
#define KPM_PARTITION_STATE(x) Partition::State::x
|
||||
#define KPM_PARTITION_FLAG_ESP PartitionTable::Flag::Boot
|
||||
#else
|
||||
#define KPM_PARTITION_FLAG(x) PartitionTable::Flag##x
|
||||
#define KPM_PARTITION_STATE(x) Partition::State##x
|
||||
#define KPM_PARTITION_FLAG_ESP PartitionTable::FlagEsp
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Helper functions to manipulate partitions
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@
|
||||
namespace PartUtils
|
||||
{
|
||||
|
||||
static QString
|
||||
QString
|
||||
convenienceName( const Partition* const candidate )
|
||||
{
|
||||
if ( !candidate->mountPoint().isEmpty() )
|
||||
@ -407,7 +407,7 @@ isEfiBootable( const Partition* candidate )
|
||||
auto flags = PartitionInfo::flags( candidate );
|
||||
|
||||
/* If bit 17 is set, old-style Esp flag, it's OK */
|
||||
if ( flags.testFlag( PartitionTable::FlagEsp ) )
|
||||
if ( flags.testFlag( KPM_PARTITION_FLAG_ESP ) )
|
||||
return true;
|
||||
|
||||
/* Otherwise, if it's a GPT table, Boot (bit 0) is the same as Esp */
|
||||
@ -425,7 +425,7 @@ isEfiBootable( const Partition* candidate )
|
||||
const PartitionTable* table = dynamic_cast<const PartitionTable*>( root );
|
||||
cDebug() << " .. partition table" << (void *)table << "type" << ( table ? table->type() : PartitionTable::TableType::unknownTableType );
|
||||
return table && ( table->type() == PartitionTable::TableType::gpt ) &&
|
||||
flags.testFlag( PartitionTable::FlagBoot );
|
||||
flags.testFlag( KPM_PARTITION_FLAG(Boot) );
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -46,6 +46,15 @@ enum SizeUnit
|
||||
GiB
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Provides a nice human-readable name for @p candidate
|
||||
*
|
||||
* The most-specific human-readable name for the partition @p candidate
|
||||
* is returned (e.g. device name, or partition path). In the worst
|
||||
* case, a string representation of (void *)candidate is returned.
|
||||
*/
|
||||
QString convenienceName( const Partition* const candidate );
|
||||
|
||||
/**
|
||||
* @brief canBeReplaced checks whether the given Partition satisfies the criteria
|
||||
* for replacing it with the new OS.
|
||||
|
@ -129,11 +129,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
||||
FileSystem::Fat32,
|
||||
firstFreeSector,
|
||||
lastSector,
|
||||
PartitionTable::FlagNone
|
||||
KPM_PARTITION_FLAG(None)
|
||||
);
|
||||
PartitionInfo::setFormat( efiPartition, true );
|
||||
PartitionInfo::setMountPoint( efiPartition, o.efiPartitionMountPoint );
|
||||
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp );
|
||||
core->createPartition( dev, efiPartition, KPM_PARTITION_FLAG_ESP );
|
||||
firstFreeSector = lastSector + 1;
|
||||
}
|
||||
else
|
||||
@ -178,7 +178,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
||||
FileSystem::LinuxSwap,
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalLogical() - 1,
|
||||
PartitionTable::FlagNone
|
||||
KPM_PARTITION_FLAG(None)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -191,7 +191,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
||||
lastSectorForRoot + 1,
|
||||
dev->totalLogical() - 1,
|
||||
o.luksPassphrase,
|
||||
PartitionTable::FlagNone
|
||||
KPM_PARTITION_FLAG(None)
|
||||
);
|
||||
}
|
||||
PartitionInfo::setFormat( swapPartition, true );
|
||||
|
@ -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"
|
||||
|
||||
@ -296,7 +299,7 @@ PartitionCoreModule::createPartition( Device* device,
|
||||
|
||||
deviceInfo->jobs << Calamares::job_ptr( job );
|
||||
|
||||
if ( flags != PartitionTable::FlagNone )
|
||||
if ( flags != KPM_PARTITION_FLAG(None) )
|
||||
{
|
||||
SetPartFlagsJob* fJob = new SetPartFlagsJob( device, partition, flags );
|
||||
deviceInfo->jobs << Calamares::job_ptr( fJob );
|
||||
@ -398,7 +401,7 @@ PartitionCoreModule::deletePartition( Device* device, Partition* partition )
|
||||
}
|
||||
|
||||
QList< Calamares::job_ptr >& jobs = deviceInfo->jobs;
|
||||
if ( partition->state() == Partition::StateNew )
|
||||
if ( partition->state() == KPM_PARTITION_STATE(New) )
|
||||
{
|
||||
// First remove matching SetPartFlagsJobs
|
||||
for ( auto it = jobs.begin(); it != jobs.end(); )
|
||||
@ -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 )
|
||||
@ -818,7 +832,7 @@ PartitionCoreModule::layoutApply( Device *dev,
|
||||
if ( part->mountPoint() == "/" )
|
||||
{
|
||||
createPartition( dev, part,
|
||||
part->activeFlags() | ( isEfi ? PartitionTable::FlagNone : PartitionTable::FlagBoot )
|
||||
part->activeFlags() | ( isEfi ? KPM_PARTITION_FLAG(None) : KPM_PARTITION_FLAG(Boot) )
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef PARTITIONCOREMODULE_H
|
||||
#define PARTITIONCOREMODULE_H
|
||||
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "core/PartitionLayout.h"
|
||||
#include "core/PartitionModel.h"
|
||||
#include "Typedefs.h"
|
||||
@ -136,7 +137,7 @@ public:
|
||||
* applied to the newly-created partition.
|
||||
*/
|
||||
void createPartition( Device* device, Partition* partition,
|
||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||
PartitionTable::Flags flags = KPM_PARTITION_FLAG(None) );
|
||||
|
||||
void createVolumeGroup( QString &vgName, QVector< const Partition* > pvList, qint32 peSize );
|
||||
|
||||
|
@ -143,7 +143,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
part.partFileSystem,
|
||||
firstSector,
|
||||
end,
|
||||
PartitionTable::FlagNone
|
||||
KPM_PARTITION_FLAG(None)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -156,7 +156,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
firstSector,
|
||||
end,
|
||||
luksPassphrase,
|
||||
PartitionTable::FlagNone
|
||||
KPM_PARTITION_FLAG(None)
|
||||
);
|
||||
}
|
||||
PartitionInfo::setFormat( currentPartition, true );
|
||||
|
@ -1359,6 +1359,16 @@ ChoicePage::setupActions()
|
||||
)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PARTITION_UNSAFE
|
||||
#ifdef DEBUG_PARTITION_LAME
|
||||
// If things can't be broken, allow all the buttons
|
||||
atLeastOneCanBeReplaced = true;
|
||||
atLeastOneCanBeResized = true;
|
||||
atLeastOneIsMounted = false;
|
||||
isInactiveRAID = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( atLeastOneCanBeReplaced )
|
||||
m_replaceButton->show();
|
||||
else
|
||||
|
@ -154,7 +154,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
|
||||
Partition* partition = model->partitionForIndex( m_ui->partitionTreeView->currentIndex() );
|
||||
if ( !partition ||
|
||||
partition->state() != Partition::StateNone )
|
||||
partition->state() != KPM_PARTITION_STATE(None) )
|
||||
{
|
||||
updateStatus( CalamaresUtils::Fail,
|
||||
tr( "The selected item does not appear to be a valid partition." ) );
|
||||
|
@ -45,7 +45,6 @@ typedef QHash<QString, QString> UuidForPartitionHash;
|
||||
static UuidForPartitionHash
|
||||
findPartitionUuids( QList < Device* > devices )
|
||||
{
|
||||
cDebug() << "Gathering UUIDs for partitions that exist now.";
|
||||
UuidForPartitionHash hash;
|
||||
foreach ( Device* device, devices )
|
||||
{
|
||||
@ -56,12 +55,11 @@ findPartitionUuids( QList < Device* > devices )
|
||||
QString path = p->partitionPath();
|
||||
QString uuid = p->fileSystem().readUUID( p->partitionPath() );
|
||||
hash.insert( path, uuid );
|
||||
cDebug() << ".. added path=" << path << "UUID=" << uuid;
|
||||
}
|
||||
}
|
||||
|
||||
if ( hash.isEmpty() )
|
||||
cDebug() << ".. no UUIDs found.";
|
||||
cDebug() << "No UUIDs found for existing partitions.";
|
||||
return hash;
|
||||
}
|
||||
|
||||
@ -147,7 +145,6 @@ FillGlobalStorageJob::prettyDescription() const
|
||||
QString path = partitionMap.value( "device" ).toString();
|
||||
QString mountPoint = partitionMap.value( "mountPoint" ).toString();
|
||||
QString fsType = partitionMap.value( "fs" ).toString();
|
||||
qDebug() << partitionMap.value( "uuid" ) << path << mountPoint << fsType;
|
||||
if ( mountPoint.isEmpty() || fsType.isEmpty() )
|
||||
continue;
|
||||
if ( path.isEmpty() )
|
||||
|
@ -228,11 +228,11 @@ PartitionJobTests::newCreatePartitionJob( Partition* freeSpacePartition, Partiti
|
||||
role,
|
||||
fs, firstSector, lastSector,
|
||||
QString() /* path */,
|
||||
PartitionTable::FlagNone /* availableFlags */,
|
||||
KPM_PARTITION_FLAG(None) /* availableFlags */,
|
||||
QString() /* mountPoint */,
|
||||
false /* mounted */,
|
||||
PartitionTable::FlagNone /* activeFlags */,
|
||||
Partition::StateNew
|
||||
KPM_PARTITION_FLAG(None) /* activeFlags */,
|
||||
KPM_PARTITION_STATE(New)
|
||||
);
|
||||
return new CreatePartitionJob( m_device.data(), partition );
|
||||
}
|
||||
@ -366,7 +366,7 @@ PartitionJobTests::testResizePartition()
|
||||
FileSystem::Ext4,
|
||||
oldFirst,
|
||||
oldLast,
|
||||
PartitionTable::FlagNone
|
||||
KPM_PARTITION_FLAG(None)
|
||||
);
|
||||
CreatePartitionJob* job = new CreatePartitionJob( m_device.data(), partition );
|
||||
job->updatePreview();
|
||||
|
Loading…
Reference in New Issue
Block a user