Merge branch 'ff-fslabel' into calamares
Fix build with newer KPMCore (still builds on Netrunner 19).
This commit is contained in:
commit
b95b3dbc78
@ -12,12 +12,10 @@
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <kpmcore/backend/corebackend.h>
|
||||
#include <kpmcore/backend/corebackenddevice.h>
|
||||
#include <kpmcore/backend/corebackendmanager.h>
|
||||
#include <kpmcore/backend/corebackendpartition.h>
|
||||
#include <kpmcore/backend/corebackendpartitiontable.h>
|
||||
#include <kpmcore/core/device.h>
|
||||
#include <kpmcore/core/partition.h>
|
||||
#include <kpmcore/ops/setfilesystemlabeloperation.h>
|
||||
#include <kpmcore/util/report.h>
|
||||
|
||||
ChangeFilesystemLabelJob::ChangeFilesystemLabelJob( Device* device, Partition* partition, const QString& newLabel )
|
||||
@ -61,45 +59,13 @@ ChangeFilesystemLabelJob::exec()
|
||||
}
|
||||
|
||||
Report report( nullptr );
|
||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||
SetFileSystemLabelOperation op( *partition(), m_label );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
|
||||
QScopedPointer< CoreBackendDevice > backendDevice( backend->openDevice( m_device->deviceNode() ) );
|
||||
if ( !backendDevice.data() )
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::error( tr( "Could not open device '%1'." ).arg( m_device->deviceNode() ),
|
||||
report.toText() );
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
QScopedPointer< CoreBackendPartitionTable > backendPartitionTable( backendDevice->openPartitionTable() );
|
||||
if ( !backendPartitionTable.data() )
|
||||
{
|
||||
return Calamares::JobResult::error(
|
||||
tr( "Could not open partition table on device '%1'." ).arg( m_device->deviceNode() ), report.toText() );
|
||||
}
|
||||
|
||||
QScopedPointer< CoreBackendPartition > backendPartition(
|
||||
( partition()->roles().has( PartitionRole::Extended ) )
|
||||
? backendPartitionTable->getExtendedPartition()
|
||||
: backendPartitionTable->getPartitionBySector( partition()->firstSector() ) );
|
||||
if ( !backendPartition.data() )
|
||||
{
|
||||
return Calamares::JobResult::error( tr( "Could not find partition '%1'." ).arg( partition()->partitionPath() ),
|
||||
report.toText() );
|
||||
}
|
||||
|
||||
FileSystem& fs = m_partition->fileSystem();
|
||||
fs.setLabel( m_label );
|
||||
|
||||
if ( !backendPartitionTable->setPartitionSystemType( report, *m_partition ) )
|
||||
{
|
||||
return Calamares::JobResult::error(
|
||||
tr( "The installer failed to update partition table on disk '%1'." ).arg( m_device->name() ),
|
||||
report.toText() );
|
||||
}
|
||||
|
||||
backendPartitionTable->commit();
|
||||
return Calamares::JobResult::ok();
|
||||
return Calamares::JobResult::error(
|
||||
tr( "The installer failed to update partition table on disk '%1'." ).arg( m_device->name() ), report.toText() );
|
||||
}
|
||||
|
||||
|
||||
#include "ChangeFilesystemLabelJob.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user