diff --git a/src/modules/fsresizer/CMakeLists.txt b/src/modules/fsresizer/CMakeLists.txt index ae87de160..9f0234406 100644 --- a/src/modules/fsresizer/CMakeLists.txt +++ b/src/modules/fsresizer/CMakeLists.txt @@ -10,17 +10,20 @@ if ( KPMcore_FOUND ) include_directories( ${KPMCORE_INCLUDE_DIR} ) include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares ) + # 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 TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES ResizeFSJob.cpp + ${PROJECT_SOURCE_DIR}/src/modules/partition/core/PartitionIterator.cpp LINK_PRIVATE_LIBRARIES kpmcore calamares SHARED_LIB ) - + if( ECM_FOUND ) find_package( Qt5 COMPONENTS Test REQUIRED ) include( ECMAddTests ) diff --git a/src/modules/fsresizer/ResizeFSJob.cpp b/src/modules/fsresizer/ResizeFSJob.cpp index 490010e0c..e3820e535 100644 --- a/src/modules/fsresizer/ResizeFSJob.cpp +++ b/src/modules/fsresizer/ResizeFSJob.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include #include "CalamaresVersion.h" #include "JobQueue.h" @@ -31,6 +33,8 @@ #include "utils/Logger.h" +#include "modules/partition/core/PartitionIterator.h" + ResizeFSJob::RelativeSize::RelativeSize() : m_value( 0 ) , m_unit( None ) @@ -92,7 +96,40 @@ ResizeFSJob::exec() if ( backend_p ) cDebug() << "KPMCore backend @" << (void *)backend_p << backend_p->id() << backend_p->version(); else - cDebug() << "No KPMCore backend"; + { + cDebug() << "No KPMCore backend loaded yet"; + QByteArray backendName = qgetenv( "KPMCORE_BACKEND" ); + if ( !CoreBackendManager::self()->load( backendName.isEmpty() ? CoreBackendManager::defaultBackendName() : backendName ) ) + { + cWarning() << "Could not load KPMCore backend."; + return Calamares::JobResult::error( + tr( "KPMCore not Available" ), + tr( "Calamares cannot start KPMCore for the file-system resize job." ) ); + } + + backend_p = CoreBackendManager::self()->backend(); + } + if ( !backend_p ) + { + cWarning() << "Could not load KPMCore backend (2)."; + return Calamares::JobResult::error( + tr( "KPMCore not Available" ), + tr( "Calamares cannot start KPMCore for the file-system resize job." ) ); + } + + using DeviceList = QList< Device* >; + DeviceList devices = backend_p->scanDevices( false ); + cDebug() << "ResizeFSJob found" << devices.count() << "devices."; + for ( DeviceList::iterator it = devices.begin(); it != devices.end(); ) + { + if ( ! (*it) ) + continue; + cDebug() << "ResizeFSJob found" << ( *it )->deviceNode(); + for ( auto pit = PartitionIterator::begin( *it); pit != PartitionIterator::end( *it); ++pit ) + { + cDebug() << ".." << ( *pit )->mountPoint(); + } + } if ( !isValid() ) return Calamares::JobResult::error(