Merge branch 'issue-1175'
This commit is contained in:
commit
eb6270982f
@ -910,9 +910,23 @@ PartitionCoreModule::layoutApply( Device* dev,
|
||||
bool isEfi = PartUtils::isEfiSystem();
|
||||
QList< Partition* > partList = m_partLayout->execute( dev, firstSector, lastSector, luksPassphrase, parent, role );
|
||||
|
||||
foreach ( Partition* part, partList )
|
||||
// Partition::mountPoint() tells us where it is mounted **now**, while
|
||||
// PartitionInfo::mountPoint() says where it will be mounted in the target system.
|
||||
// .. the latter is more interesting.
|
||||
//
|
||||
// If we have a separate /boot, mark that one as bootable, otherwise mark
|
||||
// the root / as bootable.
|
||||
//
|
||||
// TODO: perhaps the partition that holds the bootloader?
|
||||
const QString boot = QStringLiteral( "/boot" );
|
||||
const QString root = QStringLiteral( "/" );
|
||||
const auto is_boot = [&](Partition*p) -> bool {return PartitionInfo::mountPoint(p) == boot || p->mountPoint() == boot;};
|
||||
const auto is_root = [&](Partition*p) -> bool {return PartitionInfo::mountPoint(p) == root || p->mountPoint() == root;};
|
||||
|
||||
const bool separate_boot_partition = std::find_if(partList.constBegin(), partList.constEnd(), is_boot) != partList.constEnd();
|
||||
for( Partition* part : partList )
|
||||
{
|
||||
if ( part->mountPoint() == "/" )
|
||||
if ( ( separate_boot_partition && is_boot(part)) || (!separate_boot_partition && is_root(part)))
|
||||
{
|
||||
createPartition(
|
||||
dev, part, part->activeFlags() | ( isEfi ? KPM_PARTITION_FLAG( None ) : KPM_PARTITION_FLAG( Boot ) ) );
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include "core/PartitionInfo.h"
|
||||
|
||||
#include "partition/Sync.h"
|
||||
#include "partition/PartitionIterator.h"
|
||||
#include "partition/Sync.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
// KPMcore
|
||||
@ -47,16 +47,14 @@ ClearMountsJob::ClearMountsJob( Device* device )
|
||||
QString
|
||||
ClearMountsJob::prettyName() const
|
||||
{
|
||||
return tr( "Clear mounts for partitioning operations on %1" )
|
||||
.arg( m_device->deviceNode() );
|
||||
return tr( "Clear mounts for partitioning operations on %1" ).arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
ClearMountsJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Clearing mounts for partitioning operations on %1." )
|
||||
.arg( m_device->deviceNode() );
|
||||
return tr( "Clearing mounts for partitioning operations on %1." ).arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
|
||||
@ -70,15 +68,16 @@ getPartitionsForDevice( const QString& deviceName )
|
||||
{
|
||||
cDebug() << "Reading from" << dev_partitions.fileName();
|
||||
QTextStream in( &dev_partitions );
|
||||
(void) in.readLine(); // That's the header line, skip it
|
||||
(void)in.readLine(); // That's the header line, skip it
|
||||
while ( !in.atEnd() )
|
||||
{
|
||||
// The fourth column (index from 0, so index 3) is the name of the device;
|
||||
// keep it if it is followed by something.
|
||||
QStringList columns = in.readLine().split( ' ', QString::SkipEmptyParts );
|
||||
if ( ( columns.count() >= 4 ) && ( columns[3].startsWith( deviceName ) ) && ( columns[3] != deviceName ) )
|
||||
if ( ( columns.count() >= 4 ) && ( columns[ 3 ].startsWith( deviceName ) )
|
||||
&& ( columns[ 3 ] != deviceName ) )
|
||||
{
|
||||
partitions.append( columns[3] );
|
||||
partitions.append( columns[ 3 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,50 +117,54 @@ ClearMountsJob::exec()
|
||||
// /dev/sda1 : start= 63, size= 29329345, type=83, bootable
|
||||
// /dev/sda2 : start= 29331456, size= 2125824, type=82
|
||||
|
||||
swapPartitions = QString::fromLocal8Bit( process.readAllStandardOutput() )
|
||||
.split( '\n' );
|
||||
swapPartitions = QString::fromLocal8Bit( process.readAllStandardOutput() ).split( '\n' );
|
||||
swapPartitions = swapPartitions.filter( "type=82" );
|
||||
for ( QStringList::iterator it = swapPartitions.begin();
|
||||
it != swapPartitions.end(); ++it )
|
||||
for ( QStringList::iterator it = swapPartitions.begin(); it != swapPartitions.end(); ++it )
|
||||
{
|
||||
*it = (*it).simplified().split( ' ' ).first();
|
||||
*it = ( *it ).simplified().split( ' ' ).first();
|
||||
}
|
||||
|
||||
const QStringList cryptoDevices = getCryptoDevices();
|
||||
for ( const QString &mapperPath : cryptoDevices )
|
||||
for ( const QString& mapperPath : cryptoDevices )
|
||||
{
|
||||
tryUmount( mapperPath );
|
||||
QString news = tryCryptoClose( mapperPath );
|
||||
if ( !news.isEmpty() )
|
||||
{
|
||||
goodNews.append( news );
|
||||
}
|
||||
}
|
||||
|
||||
// First we umount all LVM logical volumes we can find
|
||||
process.start( "lvscan", { "-a" } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 ) //means LVM2 tools are installed
|
||||
if ( process.exitCode() == 0 ) //means LVM2 tools are installed
|
||||
{
|
||||
const QStringList lvscanLines = QString::fromLocal8Bit( process.readAllStandardOutput() ).split( '\n' );
|
||||
for ( const QString& lvscanLine : lvscanLines )
|
||||
{
|
||||
QString lvPath = lvscanLine.simplified().split( ' ' ).value( 1 ); //second column
|
||||
QString lvPath = lvscanLine.simplified().split( ' ' ).value( 1 ); //second column
|
||||
lvPath = lvPath.replace( '\'', "" );
|
||||
|
||||
QString news = tryUmount( lvPath );
|
||||
if ( !news.isEmpty() )
|
||||
{
|
||||
goodNews.append( news );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "this system does not seem to have LVM2 tools.";
|
||||
}
|
||||
|
||||
// Then we go looking for volume groups that use this device for physical volumes
|
||||
process.start( "pvdisplay", { "-C", "--noheadings" } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 ) //means LVM2 tools are installed
|
||||
if ( process.exitCode() == 0 ) //means LVM2 tools are installed
|
||||
{
|
||||
QString pvdisplayOutput = process.readAllStandardOutput();
|
||||
if ( !pvdisplayOutput.simplified().isEmpty() ) //means there is at least one LVM PV
|
||||
if ( !pvdisplayOutput.simplified().isEmpty() ) //means there is at least one LVM PV
|
||||
{
|
||||
QSet< QString > vgSet;
|
||||
|
||||
@ -171,7 +174,9 @@ ClearMountsJob::exec()
|
||||
QString pvPath = pvdisplayLine.simplified().split( ' ' ).value( 0 );
|
||||
QString vgName = pvdisplayLine.simplified().split( ' ' ).value( 1 );
|
||||
if ( !pvPath.contains( deviceName ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vgSet.insert( vgName );
|
||||
}
|
||||
@ -181,41 +186,50 @@ ClearMountsJob::exec()
|
||||
process.start( "vgchange", { "-an", vgName } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 )
|
||||
{
|
||||
goodNews.append( QString( "Successfully disabled volume group %1." ).arg( vgName ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "this system does not seem to have LVM2 tools.";
|
||||
}
|
||||
|
||||
const QStringList cryptoDevices2 = getCryptoDevices();
|
||||
for ( const QString &mapperPath : cryptoDevices2 )
|
||||
for ( const QString& mapperPath : cryptoDevices2 )
|
||||
{
|
||||
tryUmount( mapperPath );
|
||||
QString news = tryCryptoClose( mapperPath );
|
||||
if ( !news.isEmpty() )
|
||||
{
|
||||
goodNews.append( news );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const QString &p : partitionsList )
|
||||
for ( const QString& p : partitionsList )
|
||||
{
|
||||
QString partPath = QString( "/dev/%1" ).arg( p );
|
||||
|
||||
QString news = tryUmount( partPath );
|
||||
if ( !news.isEmpty() )
|
||||
{
|
||||
goodNews.append( news );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( QString p, swapPartitions )
|
||||
{
|
||||
QString news = tryClearSwap( p );
|
||||
if ( !news.isEmpty() )
|
||||
{
|
||||
goodNews.append( news );
|
||||
}
|
||||
}
|
||||
|
||||
Calamares::JobResult ok = Calamares::JobResult::ok();
|
||||
ok.setMessage( tr( "Cleared all mounts for %1" )
|
||||
.arg( m_device->deviceNode() ) );
|
||||
ok.setMessage( tr( "Cleared all mounts for %1" ).arg( m_device->deviceNode() ) );
|
||||
ok.setDetails( goodNews.join( "\n" ) );
|
||||
|
||||
cDebug() << "ClearMountsJob finished. Here's what was done:\n" << goodNews.join( "\n" );
|
||||
@ -231,12 +245,16 @@ ClearMountsJob::tryUmount( const QString& partPath )
|
||||
process.start( "umount", { partPath } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 )
|
||||
{
|
||||
return QString( "Successfully unmounted %1." ).arg( partPath );
|
||||
}
|
||||
|
||||
process.start( "swapoff", { partPath } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 )
|
||||
{
|
||||
return QString( "Successfully disabled swap %1." ).arg( partPath );
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
@ -249,14 +267,17 @@ ClearMountsJob::tryClearSwap( const QString& partPath )
|
||||
process.start( "blkid", { "-s", "UUID", "-o", "value", partPath } );
|
||||
process.waitForFinished();
|
||||
QString swapPartUuid = QString::fromLocal8Bit( process.readAllStandardOutput() ).simplified();
|
||||
if ( process.exitCode() != 0 ||
|
||||
swapPartUuid.isEmpty() )
|
||||
if ( process.exitCode() != 0 || swapPartUuid.isEmpty() )
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
process.start( "mkswap", { "-U", swapPartUuid, partPath } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() != 0 )
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
return QString( "Successfully cleared swap %1." ).arg( partPath );
|
||||
}
|
||||
@ -269,7 +290,9 @@ ClearMountsJob::tryCryptoClose( const QString& mapperPath )
|
||||
process.start( "cryptsetup", { "close", mapperPath } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 )
|
||||
{
|
||||
return QString( "Successfully closed mapper device %1." ).arg( mapperPath );
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
@ -282,14 +305,16 @@ ClearMountsJob::getCryptoDevices() const
|
||||
const QFileInfoList fiList = mapperDir.entryInfoList( QDir::Files );
|
||||
QStringList list;
|
||||
QProcess process;
|
||||
for ( const QFileInfo &fi : fiList )
|
||||
for ( const QFileInfo& fi : fiList )
|
||||
{
|
||||
QString baseName = fi.baseName();
|
||||
// Fedora live images use /dev/mapper/live-* internally. We must not
|
||||
// unmount those devices, because they are used by the live image and
|
||||
// because we need /dev/mapper/live-base in the unpackfs module.
|
||||
if ( baseName == "control" || baseName.startsWith( "live-" ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.append( fi.absoluteFilePath() );
|
||||
}
|
||||
return list;
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
QString prettyName() const override;
|
||||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
QString tryUmount( const QString& partPath );
|
||||
QString tryClearSwap( const QString& partPath );
|
||||
@ -43,4 +44,4 @@ private:
|
||||
Device* m_device;
|
||||
};
|
||||
|
||||
#endif // CLEARMOUNTSJOB_H
|
||||
#endif // CLEARMOUNTSJOB_H
|
||||
|
@ -54,13 +54,15 @@ Calamares::JobResult
|
||||
ClearTempMountsJob::exec()
|
||||
{
|
||||
// Fetch a list of current mounts to Calamares temporary directories.
|
||||
QList< QPair < QString, QString > > lst;
|
||||
QList< QPair< QString, QString > > lst;
|
||||
QFile mtab( "/etc/mtab" );
|
||||
if ( !mtab.open( QFile::ReadOnly | QFile::Text ) )
|
||||
{
|
||||
return Calamares::JobResult::error( tr( "Cannot get list of temporary mounts." ) );
|
||||
}
|
||||
|
||||
cDebug() << "Opened mtab. Lines:";
|
||||
QTextStream in(&mtab);
|
||||
QTextStream in( &mtab );
|
||||
QString lineIn = in.readLine();
|
||||
while ( !lineIn.isNull() )
|
||||
{
|
||||
@ -76,11 +78,10 @@ ClearTempMountsJob::exec()
|
||||
lineIn = in.readLine();
|
||||
}
|
||||
|
||||
std::sort ( lst.begin(), lst.end(), []( const QPair< QString, QString >& a,
|
||||
const QPair< QString, QString >& b ) -> bool
|
||||
{
|
||||
return a.first > b.first;
|
||||
} );
|
||||
std::sort(
|
||||
lst.begin(), lst.end(), []( const QPair< QString, QString >& a, const QPair< QString, QString >& b ) -> bool {
|
||||
return a.first > b.first;
|
||||
} );
|
||||
|
||||
QStringList goodNews;
|
||||
QProcess process;
|
||||
@ -92,7 +93,9 @@ ClearTempMountsJob::exec()
|
||||
process.start( "umount", { "-lv", partPath } );
|
||||
process.waitForFinished();
|
||||
if ( process.exitCode() == 0 )
|
||||
{
|
||||
goodNews.append( QString( "Successfully unmounted %1." ).arg( partPath ) );
|
||||
}
|
||||
}
|
||||
|
||||
Calamares::JobResult ok = Calamares::JobResult::ok();
|
||||
|
@ -37,4 +37,4 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
};
|
||||
|
||||
#endif // CLEARTEMPMOUNTSJOB_H
|
||||
#endif // CLEARTEMPMOUNTSJOB_H
|
||||
|
@ -45,10 +45,10 @@ QString
|
||||
CreatePartitionJob::prettyName() const
|
||||
{
|
||||
return tr( "Create new %2MiB partition on %4 (%3) with file system %1." )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
||||
.arg( m_device->name() )
|
||||
.arg( m_device->deviceNode() );
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
||||
.arg( m_device->name() )
|
||||
.arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
|
||||
@ -57,10 +57,10 @@ CreatePartitionJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Create new <strong>%2MiB</strong> partition on <strong>%4</strong> "
|
||||
"(%3) with file system <strong>%1</strong>." )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
||||
.arg( m_device->name() )
|
||||
.arg( m_device->deviceNode() );
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
|
||||
.arg( m_device->name() )
|
||||
.arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
|
||||
@ -68,22 +68,24 @@ QString
|
||||
CreatePartitionJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Creating new %1 partition on %2." )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( m_device->deviceNode() );
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
CreatePartitionJob::exec()
|
||||
{
|
||||
Report report( nullptr );
|
||||
NewOperation op(*m_device, m_partition);
|
||||
op.setStatus(Operation::StatusRunning);
|
||||
NewOperation op( *m_device, m_partition );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
|
||||
QString message = tr( "The installer failed to create partition on disk '%1'." ).arg( m_device->name() );
|
||||
if (op.execute(report))
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -44,10 +44,7 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
void updatePreview();
|
||||
Device* device() const
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
Device* device() const { return m_device; }
|
||||
|
||||
private:
|
||||
Device* m_device;
|
||||
|
@ -18,7 +18,7 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "jobs/CreatePartitionTableJob.h"
|
||||
#include "CreatePartitionTableJob.h"
|
||||
|
||||
#include "partition/PartitionIterator.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -46,16 +46,17 @@ QString
|
||||
CreatePartitionTableJob::prettyName() const
|
||||
{
|
||||
return tr( "Create new %1 partition table on %2." )
|
||||
.arg( PartitionTable::tableTypeToName( m_type ) )
|
||||
.arg( m_device->deviceNode() );
|
||||
.arg( PartitionTable::tableTypeToName( m_type ) )
|
||||
.arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
QString CreatePartitionTableJob::prettyDescription() const
|
||||
QString
|
||||
CreatePartitionTableJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Create new <strong>%1</strong> partition table on <strong>%2</strong> (%3)." )
|
||||
.arg( PartitionTable::tableTypeToName( m_type ).toUpper() )
|
||||
.arg( m_device->deviceNode() )
|
||||
.arg( m_device->name() );
|
||||
.arg( PartitionTable::tableTypeToName( m_type ).toUpper() )
|
||||
.arg( m_device->deviceNode() )
|
||||
.arg( m_device->name() );
|
||||
}
|
||||
|
||||
|
||||
@ -63,13 +64,13 @@ QString
|
||||
CreatePartitionTableJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Creating new %1 partition table on %2." )
|
||||
.arg( PartitionTable::tableTypeToName( m_type ).toUpper() )
|
||||
.arg( m_device->deviceNode() );
|
||||
.arg( PartitionTable::tableTypeToName( m_type ).toUpper() )
|
||||
.arg( m_device->deviceNode() );
|
||||
}
|
||||
|
||||
|
||||
static inline QDebug&
|
||||
operator <<( QDebug&& s, PartitionIterator& it )
|
||||
operator<<( QDebug&& s, PartitionIterator& it )
|
||||
{
|
||||
s << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) );
|
||||
return s;
|
||||
@ -83,14 +84,14 @@ CreatePartitionTableJob::exec()
|
||||
QString message = tr( "The installer failed to create a partition table on %1." ).arg( m_device->name() );
|
||||
|
||||
PartitionTable* table = m_device->partitionTable();
|
||||
cDebug() << "Creating new partition table of type" << table->typeName()
|
||||
<< ", uncommitted yet:";
|
||||
cDebug() << "Creating new partition table of type" << table->typeName() << ", uncommitted yet:";
|
||||
|
||||
if ( Logger::logLevelEnabled( Logger::LOGDEBUG ) )
|
||||
{
|
||||
for ( auto it = PartitionIterator::begin( table );
|
||||
it != PartitionIterator::end( table ); ++it )
|
||||
for ( auto it = PartitionIterator::begin( table ); it != PartitionIterator::end( table ); ++it )
|
||||
{
|
||||
cDebug() << it;
|
||||
}
|
||||
|
||||
QProcess lsblk;
|
||||
lsblk.setProgram( "lsblk" );
|
||||
@ -107,13 +108,15 @@ CreatePartitionTableJob::exec()
|
||||
cDebug() << "mount:\n" << mount.readAllStandardOutput();
|
||||
}
|
||||
|
||||
CreatePartitionTableOperation op(*m_device, table);
|
||||
op.setStatus(Operation::StatusRunning);
|
||||
CreatePartitionTableOperation op( *m_device, table );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
|
||||
if (op.execute(report))
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
||||
void
|
||||
@ -129,10 +132,8 @@ CreatePartitionTableJob::updatePreview()
|
||||
PartitionTable*
|
||||
CreatePartitionTableJob::createTable()
|
||||
{
|
||||
cDebug() << "CreatePartitionTableJob::createTable trying to make table for device"
|
||||
<< m_device->deviceNode();
|
||||
cDebug() << "CreatePartitionTableJob::createTable trying to make table for device" << m_device->deviceNode();
|
||||
return new PartitionTable( m_type,
|
||||
PartitionTable::defaultFirstUsable( *m_device, m_type ),
|
||||
PartitionTable::defaultLastUsable( *m_device, m_type )
|
||||
);
|
||||
PartitionTable::defaultLastUsable( *m_device, m_type ) );
|
||||
}
|
||||
|
@ -45,10 +45,7 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
void updatePreview();
|
||||
Device* device() const
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
Device* device() const { return m_device; }
|
||||
|
||||
private:
|
||||
CalamaresUtils::Partition::KPMManager m_kpmcore;
|
||||
|
@ -25,32 +25,28 @@
|
||||
#include <kpmcore/util/report.h>
|
||||
|
||||
CreateVolumeGroupJob::CreateVolumeGroupJob( QString& vgName, QVector< const Partition* > pvList, const qint32 peSize )
|
||||
: m_vgName(vgName)
|
||||
, m_pvList(pvList)
|
||||
, m_peSize(peSize)
|
||||
: m_vgName( vgName )
|
||||
, m_pvList( pvList )
|
||||
, m_peSize( peSize )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
CreateVolumeGroupJob::prettyName() const
|
||||
{
|
||||
return tr( "Create new volume group named %1." )
|
||||
.arg( m_vgName );
|
||||
return tr( "Create new volume group named %1." ).arg( m_vgName );
|
||||
}
|
||||
|
||||
QString
|
||||
CreateVolumeGroupJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Create new volume group named <strong>%1</strong>." )
|
||||
.arg( m_vgName );
|
||||
return tr( "Create new volume group named <strong>%1</strong>." ).arg( m_vgName );
|
||||
}
|
||||
|
||||
QString
|
||||
CreateVolumeGroupJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Creating new volume group named %1." )
|
||||
.arg( m_vgName );
|
||||
return tr( "Creating new volume group named %1." ).arg( m_vgName );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
@ -62,11 +58,13 @@ CreateVolumeGroupJob::exec()
|
||||
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
|
||||
QString message = tr( "The installer failed to create a volume group named '%1'.").arg( m_vgName );
|
||||
if (op.execute(report))
|
||||
QString message = tr( "The installer failed to create a volume group named '%1'." ).arg( m_vgName );
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
||||
void
|
||||
@ -79,6 +77,10 @@ void
|
||||
CreateVolumeGroupJob::undoPreview()
|
||||
{
|
||||
for ( const auto& pv : m_pvList )
|
||||
if ( LvmDevice::s_DirtyPVs.contains( pv ))
|
||||
{
|
||||
if ( LvmDevice::s_DirtyPVs.contains( pv ) )
|
||||
{
|
||||
LvmDevice::s_DirtyPVs.removeAll( pv );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,4 +47,4 @@ private:
|
||||
qint32 m_peSize;
|
||||
};
|
||||
|
||||
#endif // CREATEVOLUMEGROUPJOB_H
|
||||
#endif // CREATEVOLUMEGROUPJOB_H
|
||||
|
@ -25,28 +25,24 @@
|
||||
DeactivateVolumeGroupJob::DeactivateVolumeGroupJob( LvmDevice* device )
|
||||
: m_device( device )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
DeactivateVolumeGroupJob::prettyName() const
|
||||
{
|
||||
return tr( "Deactivate volume group named %1." )
|
||||
.arg( m_device->name() );
|
||||
return tr( "Deactivate volume group named %1." ).arg( m_device->name() );
|
||||
}
|
||||
|
||||
QString
|
||||
DeactivateVolumeGroupJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Deactivate volume group named <strong>%1</strong>." )
|
||||
.arg( m_device->name() );
|
||||
return tr( "Deactivate volume group named <strong>%1</strong>." ).arg( m_device->name() );
|
||||
}
|
||||
|
||||
QString
|
||||
DeactivateVolumeGroupJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Deactivate volume group named %1." )
|
||||
.arg( m_device->name() );
|
||||
return tr( "Deactivate volume group named %1." ).arg( m_device->name() );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
@ -65,5 +61,5 @@ DeactivateVolumeGroupJob::exec()
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
@ -40,4 +40,4 @@ private:
|
||||
LvmDevice* m_device;
|
||||
};
|
||||
|
||||
#endif // DEACTIVATEVOLUMEGROUPJOB_H
|
||||
#endif // DEACTIVATEVOLUMEGROUPJOB_H
|
||||
|
@ -18,7 +18,7 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "jobs/DeletePartitionJob.h"
|
||||
#include "DeletePartitionJob.h"
|
||||
|
||||
// KPMcore
|
||||
#include <kpmcore/core/device.h>
|
||||
@ -37,24 +37,21 @@ DeletePartitionJob::DeletePartitionJob( Device* device, Partition* partition )
|
||||
QString
|
||||
DeletePartitionJob::prettyName() const
|
||||
{
|
||||
return tr( "Delete partition %1." )
|
||||
.arg( m_partition->partitionPath() );
|
||||
return tr( "Delete partition %1." ).arg( m_partition->partitionPath() );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
DeletePartitionJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Delete partition <strong>%1</strong>." )
|
||||
.arg( m_partition->partitionPath() );
|
||||
return tr( "Delete partition <strong>%1</strong>." ).arg( m_partition->partitionPath() );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
DeletePartitionJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Deleting partition %1." )
|
||||
.arg( m_partition->partitionPath() );
|
||||
return tr( "Deleting partition %1." ).arg( m_partition->partitionPath() );
|
||||
}
|
||||
|
||||
|
||||
@ -62,14 +59,16 @@ Calamares::JobResult
|
||||
DeletePartitionJob::exec()
|
||||
{
|
||||
Report report( nullptr );
|
||||
DeleteOperation op(*m_device, m_partition);
|
||||
op.setStatus(Operation::StatusRunning);
|
||||
DeleteOperation op( *m_device, m_partition );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
|
||||
QString message = tr( "The installer failed to delete partition %1." ).arg( m_partition->devicePath() );
|
||||
if (op.execute(report))
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
||||
void
|
||||
@ -87,5 +86,7 @@ DeletePartitionJob::updatePreview()
|
||||
// become sda5, sda6, sda7
|
||||
Partition* parentPartition = dynamic_cast< Partition* >( m_partition->parent() );
|
||||
if ( parentPartition && parentPartition->roles().has( PartitionRole::Extended ) )
|
||||
{
|
||||
parentPartition->adjustLogicalNumbers( m_partition->number(), -1 );
|
||||
}
|
||||
}
|
||||
|
@ -44,10 +44,7 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
void updatePreview();
|
||||
Device* device() const
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
Device* device() const { return m_device; }
|
||||
|
||||
private:
|
||||
Device* m_device;
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
QString prettyDescription() const override;
|
||||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
QList< Device* > m_devices;
|
||||
QString m_bootLoaderPath;
|
||||
|
@ -43,10 +43,10 @@ QString
|
||||
FormatPartitionJob::prettyName() const
|
||||
{
|
||||
return tr( "Format partition %1 (file system: %2, size: %3 MiB) on %4." )
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( m_partition->capacity() / 1024 / 1024 )
|
||||
.arg( m_device->name() );
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( m_partition->capacity() / 1024 / 1024 )
|
||||
.arg( m_device->name() );
|
||||
}
|
||||
|
||||
|
||||
@ -55,9 +55,9 @@ FormatPartitionJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Format <strong>%3MiB</strong> partition <strong>%1</strong> with "
|
||||
"file system <strong>%2</strong>." )
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( m_partition->capacity() / 1024 / 1024 );
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) )
|
||||
.arg( m_partition->capacity() / 1024 / 1024 );
|
||||
}
|
||||
|
||||
|
||||
@ -66,8 +66,8 @@ FormatPartitionJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Formatting partition %1 with "
|
||||
"file system %2." )
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) );
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( userVisibleFS( m_partition->fileSystem() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -75,13 +75,16 @@ Calamares::JobResult
|
||||
FormatPartitionJob::exec()
|
||||
{
|
||||
Report report( nullptr ); // Root of the report tree, no parent
|
||||
CreateFileSystemOperation op(*m_device, *m_partition, m_partition->fileSystem().type());
|
||||
op.setStatus(Operation::StatusRunning);
|
||||
CreateFileSystemOperation op( *m_device, *m_partition, m_partition->fileSystem().type() );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
|
||||
QString message = tr( "The installer failed to format partition %1 on disk '%2'." ).arg( m_partition->partitionPath(), m_device->name() );
|
||||
QString message = tr( "The installer failed to format partition %1 on disk '%2'." )
|
||||
.arg( m_partition->partitionPath(), m_device->name() );
|
||||
|
||||
if (op.execute(report))
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
@ -42,10 +42,7 @@ public:
|
||||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
Device* device() const
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
Device* device() const { return m_device; }
|
||||
|
||||
private:
|
||||
Device* m_device;
|
||||
|
@ -20,13 +20,19 @@
|
||||
|
||||
PartitionJob::PartitionJob( Partition* partition )
|
||||
: m_partition( partition )
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void PartitionJob::iprogress(int percent)
|
||||
void
|
||||
PartitionJob::iprogress( int percent )
|
||||
{
|
||||
if ( percent < 0 )
|
||||
{
|
||||
percent = 0;
|
||||
}
|
||||
if ( percent > 100 )
|
||||
{
|
||||
percent = 100;
|
||||
}
|
||||
emit progress( qreal( percent / 100.0 ) );
|
||||
}
|
||||
|
@ -34,10 +34,7 @@ class PartitionJob : public Calamares::Job
|
||||
public:
|
||||
PartitionJob( Partition* partition );
|
||||
|
||||
Partition* partition() const
|
||||
{
|
||||
return m_partition;
|
||||
}
|
||||
Partition* partition() const { return m_partition; }
|
||||
|
||||
public slots:
|
||||
/** @brief Translate from KPMCore to Calamares progress.
|
||||
|
@ -25,28 +25,24 @@
|
||||
RemoveVolumeGroupJob::RemoveVolumeGroupJob( LvmDevice* device )
|
||||
: m_device( device )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
RemoveVolumeGroupJob::prettyName() const
|
||||
{
|
||||
return tr( "Remove Volume Group named %1." )
|
||||
.arg( m_device->name() );
|
||||
return tr( "Remove Volume Group named %1." ).arg( m_device->name() );
|
||||
}
|
||||
|
||||
QString
|
||||
RemoveVolumeGroupJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Remove Volume Group named <strong>%1</strong>.")
|
||||
.arg( m_device->name() );
|
||||
return tr( "Remove Volume Group named <strong>%1</strong>." ).arg( m_device->name() );
|
||||
}
|
||||
|
||||
QString
|
||||
RemoveVolumeGroupJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Remove Volume Group named %1." )
|
||||
.arg( m_device->name() );
|
||||
return tr( "Remove Volume Group named %1." ).arg( m_device->name() );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
@ -60,7 +56,9 @@ RemoveVolumeGroupJob::exec()
|
||||
|
||||
QString message = tr( "The installer failed to remove a volume group named '%1'." ).arg( m_device->name() );
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(message, report.toText());
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
|
@ -40,4 +40,4 @@ private:
|
||||
LvmDevice* m_device;
|
||||
};
|
||||
|
||||
#endif // REMOVEVOLUMEGROUPJOB_H
|
||||
#endif // REMOVEVOLUMEGROUPJOB_H
|
||||
|
@ -18,7 +18,7 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "jobs/ResizePartitionJob.h"
|
||||
#include "ResizePartitionJob.h"
|
||||
|
||||
#include "utils/Units.h"
|
||||
|
||||
@ -33,7 +33,8 @@ using CalamaresUtils::BytesToMiB;
|
||||
ResizePartitionJob::ResizePartitionJob( Device* device, Partition* partition, qint64 firstSector, qint64 lastSector )
|
||||
: PartitionJob( partition )
|
||||
, m_device( device )
|
||||
, m_oldFirstSector( partition->firstSector() ) // Keep a copy of old sectors because they will be overwritten in updatePreview()
|
||||
, m_oldFirstSector(
|
||||
partition->firstSector() ) // Keep a copy of old sectors because they will be overwritten in updatePreview()
|
||||
, m_oldLastSector( partition->lastSector() )
|
||||
, m_newFirstSector( firstSector )
|
||||
, m_newLastSector( lastSector )
|
||||
@ -54,9 +55,9 @@ ResizePartitionJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Resize <strong>%2MiB</strong> partition <strong>%1</strong> to "
|
||||
"<strong>%3MiB</strong>." )
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
||||
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
||||
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -65,30 +66,32 @@ ResizePartitionJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Resizing %2MiB partition %1 to "
|
||||
"%3MiB." )
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
||||
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
|
||||
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
ResizePartitionJob::exec()
|
||||
{
|
||||
Report report (nullptr);
|
||||
Report report( nullptr );
|
||||
// Restore partition sectors that were modified for preview
|
||||
m_partition->setFirstSector( m_oldFirstSector );
|
||||
m_partition->setLastSector( m_oldLastSector );
|
||||
ResizeOperation op(*m_device, *m_partition, m_newFirstSector, m_newLastSector);
|
||||
op.setStatus(Operation::StatusRunning);
|
||||
connect(&op, &Operation::progress, this, &ResizePartitionJob::iprogress );
|
||||
ResizeOperation op( *m_device, *m_partition, m_newFirstSector, m_newLastSector );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
connect( &op, &Operation::progress, this, &ResizePartitionJob::iprogress );
|
||||
|
||||
QString errorMessage = tr( "The installer failed to resize partition %1 on disk '%2'." )
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( m_device->name() );
|
||||
if (op.execute(report))
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( m_device->name() );
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error(errorMessage, report.toText());
|
||||
return Calamares::JobResult::error( errorMessage, report.toText() );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -28,34 +28,33 @@ ResizeVolumeGroupJob::ResizeVolumeGroupJob( LvmDevice* device, QVector< const Pa
|
||||
: m_device( device )
|
||||
, m_partitionList( partitionList )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
ResizeVolumeGroupJob::prettyName() const
|
||||
{
|
||||
return tr( "Resize volume group named %1 from %2 to %3." )
|
||||
.arg( m_device->name() )
|
||||
.arg( currentPartitions() )
|
||||
.arg( targetPartitions() );
|
||||
.arg( m_device->name() )
|
||||
.arg( currentPartitions() )
|
||||
.arg( targetPartitions() );
|
||||
}
|
||||
|
||||
QString
|
||||
ResizeVolumeGroupJob::prettyDescription() const
|
||||
{
|
||||
return tr( "Resize volume group named <strong>%1</strong> from <strong>%2</strong> to <strong>%3</strong>." )
|
||||
.arg( m_device->name() )
|
||||
.arg( currentPartitions() )
|
||||
.arg( targetPartitions() );
|
||||
.arg( m_device->name() )
|
||||
.arg( currentPartitions() )
|
||||
.arg( targetPartitions() );
|
||||
}
|
||||
|
||||
QString
|
||||
ResizeVolumeGroupJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Resize volume group named %1 from %2 to %3." )
|
||||
.arg( m_device->name() )
|
||||
.arg( currentPartitions() )
|
||||
.arg( targetPartitions() );
|
||||
.arg( m_device->name() )
|
||||
.arg( currentPartitions() )
|
||||
.arg( targetPartitions() );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
@ -69,7 +68,9 @@ ResizeVolumeGroupJob::exec()
|
||||
|
||||
QString message = tr( "The installer failed to resize a volume group named '%1'." ).arg( m_device->name() );
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error( message, report.toText() );
|
||||
}
|
||||
@ -79,10 +80,12 @@ ResizeVolumeGroupJob::currentPartitions() const
|
||||
{
|
||||
QString result;
|
||||
|
||||
for ( const Partition *p : m_device->physicalVolumes() )
|
||||
for ( const Partition* p : m_device->physicalVolumes() )
|
||||
{
|
||||
result += p->deviceNode() + ", ";
|
||||
}
|
||||
|
||||
result.chop(2);
|
||||
result.chop( 2 );
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -92,10 +95,12 @@ ResizeVolumeGroupJob::targetPartitions() const
|
||||
{
|
||||
QString result;
|
||||
|
||||
for ( const Partition *p : m_partitionList )
|
||||
for ( const Partition* p : m_partitionList )
|
||||
{
|
||||
result += p->deviceNode() + ", ";
|
||||
}
|
||||
|
||||
result.chop(2);
|
||||
result.chop( 2 );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -48,4 +48,4 @@ private:
|
||||
QVector< const Partition* > m_partitionList;
|
||||
};
|
||||
|
||||
#endif // RESIZEVOLUMEGROUPJOB_H
|
||||
#endif // RESIZEVOLUMEGROUPJOB_H
|
||||
|
@ -36,27 +36,29 @@ using CalamaresUtils::BytesToMiB;
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
SetPartFlagsJob::SetPartFlagsJob( Device* device,
|
||||
Partition* partition,
|
||||
PartitionTable::Flags flags )
|
||||
SetPartFlagsJob::SetPartFlagsJob( Device* device, Partition* partition, PartitionTable::Flags flags )
|
||||
: PartitionJob( partition )
|
||||
, m_device( device )
|
||||
, m_flags( flags )
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
SetPartFlagsJob::prettyName() const
|
||||
{
|
||||
if ( !partition()->partitionPath().isEmpty() )
|
||||
{
|
||||
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
|
||||
}
|
||||
|
||||
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
|
||||
if ( !fsNameForUser.isEmpty() )
|
||||
{
|
||||
return tr( "Set flags on %1MiB %2 partition." )
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser );
|
||||
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser );
|
||||
}
|
||||
return tr( "Set flags on new partition." );
|
||||
}
|
||||
|
||||
@ -68,34 +70,39 @@ SetPartFlagsJob::prettyDescription() const
|
||||
if ( flagsList.count() == 0 )
|
||||
{
|
||||
if ( !partition()->partitionPath().isEmpty() )
|
||||
return tr( "Clear flags on partition <strong>%1</strong>." )
|
||||
.arg( partition()->partitionPath() );
|
||||
{
|
||||
return tr( "Clear flags on partition <strong>%1</strong>." ).arg( partition()->partitionPath() );
|
||||
}
|
||||
|
||||
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
|
||||
if ( !fsNameForUser.isEmpty() )
|
||||
{
|
||||
return tr( "Clear flags on %1MiB <strong>%2</strong> partition." )
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser );
|
||||
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser );
|
||||
}
|
||||
return tr( "Clear flags on new partition." );
|
||||
}
|
||||
|
||||
if ( !partition()->partitionPath().isEmpty() )
|
||||
{
|
||||
return tr( "Flag partition <strong>%1</strong> as "
|
||||
"<strong>%2</strong>." )
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
}
|
||||
|
||||
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
|
||||
if ( !fsNameForUser.isEmpty() )
|
||||
{
|
||||
return tr( "Flag %1MiB <strong>%2</strong> partition as "
|
||||
"<strong>%3</strong>." )
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
}
|
||||
|
||||
return tr( "Flag new partition as <strong>%1</strong>." )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
return tr( "Flag new partition as <strong>%1</strong>." ).arg( flagsList.join( ", " ) );
|
||||
}
|
||||
|
||||
|
||||
@ -106,53 +113,60 @@ SetPartFlagsJob::prettyStatusMessage() const
|
||||
if ( flagsList.count() == 0 )
|
||||
{
|
||||
if ( !partition()->partitionPath().isEmpty() )
|
||||
return tr( "Clearing flags on partition <strong>%1</strong>." )
|
||||
.arg( partition()->partitionPath() );
|
||||
{
|
||||
return tr( "Clearing flags on partition <strong>%1</strong>." ).arg( partition()->partitionPath() );
|
||||
}
|
||||
|
||||
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
|
||||
if ( !fsNameForUser.isEmpty() )
|
||||
{
|
||||
return tr( "Clearing flags on %1MiB <strong>%2</strong> partition." )
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser );
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser );
|
||||
}
|
||||
|
||||
return tr( "Clearing flags on new partition." );
|
||||
}
|
||||
|
||||
if ( !partition()->partitionPath().isEmpty() )
|
||||
{
|
||||
return tr( "Setting flags <strong>%2</strong> on partition "
|
||||
"<strong>%1</strong>." )
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
.arg( partition()->partitionPath() )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
}
|
||||
|
||||
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
|
||||
if ( !fsNameForUser.isEmpty() )
|
||||
{
|
||||
return tr( "Setting flags <strong>%3</strong> on "
|
||||
"%1MiB <strong>%2</strong> partition." )
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
.arg( BytesToMiB( partition()->capacity() ) )
|
||||
.arg( fsNameForUser )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
}
|
||||
|
||||
return tr( "Setting flags <strong>%1</strong> on new partition." )
|
||||
.arg( flagsList.join( ", " ) );
|
||||
return tr( "Setting flags <strong>%1</strong> on new partition." ).arg( flagsList.join( ", " ) );
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
SetPartFlagsJob::exec()
|
||||
{
|
||||
cDebug() << "Setting flags on" << m_device->deviceNode()
|
||||
<< "partition" << partition()->deviceNode()
|
||||
<< "to" << m_flags;
|
||||
cDebug() << "Setting flags on" << m_device->deviceNode() << "partition" << partition()->deviceNode() << "to"
|
||||
<< m_flags;
|
||||
|
||||
Report report ( nullptr );
|
||||
Report report( nullptr );
|
||||
SetPartFlagsOperation op( *m_device, *partition(), m_flags );
|
||||
op.setStatus( Operation::StatusRunning );
|
||||
connect( &op, &Operation::progress, this, &SetPartFlagsJob::iprogress );
|
||||
|
||||
QString errorMessage = tr( "The installer failed to set flags on partition %1." )
|
||||
.arg( m_partition->partitionPath() );
|
||||
QString errorMessage
|
||||
= tr( "The installer failed to set flags on partition %1." ).arg( m_partition->partitionPath() );
|
||||
if ( op.execute( report ) )
|
||||
{
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
return Calamares::JobResult::error( errorMessage, report.toText() );
|
||||
}
|
||||
|
@ -49,4 +49,4 @@ private:
|
||||
PartitionTable::Flags m_flags;
|
||||
};
|
||||
|
||||
#endif // SETPARTITIONFLAGSJOB_H
|
||||
#endif // SETPARTITIONFLAGSJOB_H
|
||||
|
Loading…
Reference in New Issue
Block a user