/* === This file is part of Calamares - === * * SPDX-FileCopyrightText: 2016, Lisa Vitolo * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. * */ #include "ChangeFilesystemLabelJob.h" #include "utils/Logger.h" #include #include #include #include #include #include ChangeFilesystemLabelJob::ChangeFilesystemLabelJob( Device* device, Partition* partition, const QString& newLabel ) : PartitionJob( partition ) , m_device( device ) , m_label( newLabel ) { } QString ChangeFilesystemLabelJob::prettyName() const { return tr( "Set filesystem label on %1." ).arg( partition()->partitionPath() ); } QString ChangeFilesystemLabelJob::prettyDescription() const { return tr( "Set filesystem label %1 to partition " "%2." ) .arg( m_label ) .arg( partition()->partitionPath() ); } QString ChangeFilesystemLabelJob::prettyStatusMessage() const { return prettyDescription(); } Calamares::JobResult ChangeFilesystemLabelJob::exec() { if ( m_label == partition()->fileSystem().label() ) { return Calamares::JobResult::ok(); } Report report( nullptr ); SetFileSystemLabelOperation op( *partition(), m_label ); op.setStatus( Operation::StatusRunning ); if ( op.execute( report ) ) { 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() ); }