[fsresizer] Scan for devices, list partitions
- The is just debugging output, but it's the start of what needs to happen to find the FS that needs resizing.
This commit is contained in:
parent
35ca813064
commit
06a00a15c6
@ -10,11 +10,14 @@ if ( KPMcore_FOUND )
|
|||||||
include_directories( ${KPMCORE_INCLUDE_DIR} )
|
include_directories( ${KPMCORE_INCLUDE_DIR} )
|
||||||
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares )
|
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
|
calamares_add_plugin( fsresizer
|
||||||
TYPE job
|
TYPE job
|
||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
ResizeFSJob.cpp
|
ResizeFSJob.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/src/modules/partition/core/PartitionIterator.cpp
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
kpmcore
|
kpmcore
|
||||||
calamares
|
calamares
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include <kpmcore/backend/corebackend.h>
|
#include <kpmcore/backend/corebackend.h>
|
||||||
#include <kpmcore/backend/corebackendmanager.h>
|
#include <kpmcore/backend/corebackendmanager.h>
|
||||||
|
#include <kpmcore/core/device.h>
|
||||||
|
#include <kpmcore/core/partition.h>
|
||||||
|
|
||||||
#include "CalamaresVersion.h"
|
#include "CalamaresVersion.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
@ -31,6 +33,8 @@
|
|||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
|
#include "modules/partition/core/PartitionIterator.h"
|
||||||
|
|
||||||
ResizeFSJob::RelativeSize::RelativeSize()
|
ResizeFSJob::RelativeSize::RelativeSize()
|
||||||
: m_value( 0 )
|
: m_value( 0 )
|
||||||
, m_unit( None )
|
, m_unit( None )
|
||||||
@ -92,7 +96,40 @@ ResizeFSJob::exec()
|
|||||||
if ( backend_p )
|
if ( backend_p )
|
||||||
cDebug() << "KPMCore backend @" << (void *)backend_p << backend_p->id() << backend_p->version();
|
cDebug() << "KPMCore backend @" << (void *)backend_p << backend_p->id() << backend_p->version();
|
||||||
else
|
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() )
|
if ( !isValid() )
|
||||||
return Calamares::JobResult::error(
|
return Calamares::JobResult::error(
|
||||||
|
Loading…
Reference in New Issue
Block a user