[partition] use v3.2.3 version
This commit is contained in:
parent
07cd182fae
commit
3ae4b51308
@ -113,12 +113,8 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
|
|||||||
|
|
||||||
// Remove the device which contains / from the list
|
// Remove the device which contains / from the list
|
||||||
for ( DeviceList::iterator it = devices.begin(); it != devices.end(); )
|
for ( DeviceList::iterator it = devices.begin(); it != devices.end(); )
|
||||||
if ( !( *it ) )
|
if ( ! ( *it ) ||
|
||||||
{
|
( *it )->deviceNode().startsWith( "/dev/zram" )
|
||||||
cDebug() << " .. Skipping nullptr device";
|
|
||||||
it = erase( devices, it);
|
|
||||||
}
|
|
||||||
else if ( ( *it )->deviceNode().startsWith( "/dev/zram" )
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
cDebug() << " .. Removing zram" << it;
|
cDebug() << " .. Removing zram" << it;
|
||||||
|
@ -89,7 +89,7 @@ Partition* createNewPartition( PartitionNode* parent,
|
|||||||
FileSystem::Type fsType,
|
FileSystem::Type fsType,
|
||||||
qint64 firstSector,
|
qint64 firstSector,
|
||||||
qint64 lastSector,
|
qint64 lastSector,
|
||||||
PartitionTable::Flags flags );
|
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||||
|
|
||||||
Partition* createNewEncryptedPartition( PartitionNode* parent,
|
Partition* createNewEncryptedPartition( PartitionNode* parent,
|
||||||
const Device& device,
|
const Device& device,
|
||||||
@ -98,7 +98,7 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
|
|||||||
qint64 firstSector,
|
qint64 firstSector,
|
||||||
qint64 lastSector,
|
qint64 lastSector,
|
||||||
const QString& passphrase,
|
const QString& passphrase,
|
||||||
PartitionTable::Flags flags );
|
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||||
|
|
||||||
Partition* clonePartition( Device* device, Partition* partition );
|
Partition* clonePartition( Device* device, Partition* partition );
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,18 +29,6 @@ struct FstabEntry
|
|||||||
QString options;
|
QString options;
|
||||||
int dump;
|
int dump;
|
||||||
int pass;
|
int pass;
|
||||||
|
|
||||||
/// Does this entry make sense and is it complete?
|
|
||||||
bool isValid() const; // implemented in Partutils.cpp
|
|
||||||
|
|
||||||
/** @brief Create an entry from a live of /etc/fstab
|
|
||||||
*
|
|
||||||
* Splits the given string (which ought to follow the format
|
|
||||||
* of /etc/fstab) and returns a corresponding Fstab entry.
|
|
||||||
* If the string isn't valid (e.g. comment-line, or broken
|
|
||||||
* fstab entry) then the entry that is returned is invalid.
|
|
||||||
*/
|
|
||||||
static FstabEntry fromEtcFstab( const QString& ); // implemented in Partutils.cpp
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList< FstabEntry > FstabEntryList;
|
typedef QList< FstabEntry > FstabEntryList;
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
|
|
||||||
#include <utils/CalamaresUtilsSystem.h>
|
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
#include <JobQueue.h>
|
#include <JobQueue.h>
|
||||||
#include <GlobalStorage.h>
|
#include <GlobalStorage.h>
|
||||||
@ -80,48 +79,27 @@ bool
|
|||||||
canBeResized( Partition* candidate )
|
canBeResized( Partition* candidate )
|
||||||
{
|
{
|
||||||
if ( !candidate )
|
if ( !candidate )
|
||||||
{
|
|
||||||
cDebug() << "Partition* is NULL";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
cDebug() << "Checking if" << candidate->partitionPath() << "can be resized.";
|
|
||||||
if ( !candidate->fileSystem().supportGrow() ||
|
if ( !candidate->fileSystem().supportGrow() ||
|
||||||
!candidate->fileSystem().supportShrink() )
|
!candidate->fileSystem().supportShrink() )
|
||||||
{
|
|
||||||
cDebug() << " .. filesystem" << candidate->fileSystem().name()
|
|
||||||
<< "does not support resize.";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if ( KPMHelpers::isPartitionFreeSpace( candidate ) )
|
if ( KPMHelpers::isPartitionFreeSpace( candidate ) )
|
||||||
{
|
|
||||||
cDebug() << " .. partition is free space";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if ( candidate->isMounted() )
|
if ( candidate->isMounted() )
|
||||||
{
|
|
||||||
cDebug() << " .. partition is mounted";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if ( candidate->roles().has( PartitionRole::Primary ) )
|
if ( candidate->roles().has( PartitionRole::Primary ) )
|
||||||
{
|
{
|
||||||
PartitionTable* table = dynamic_cast< PartitionTable* >( candidate->parent() );
|
PartitionTable* table = dynamic_cast< PartitionTable* >( candidate->parent() );
|
||||||
if ( !table )
|
if ( !table )
|
||||||
{
|
|
||||||
cDebug() << " .. no partition table found";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if ( table->numPrimaries() >= table->maxPrimaries() )
|
if ( table->numPrimaries() >= table->maxPrimaries() )
|
||||||
{
|
|
||||||
cDebug() << " .. partition table already has"
|
|
||||||
<< table->maxPrimaries() << "primary partitions.";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGB = Calamares::JobQueue::instance()
|
||||||
@ -157,10 +135,11 @@ bool
|
|||||||
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
||||||
{
|
{
|
||||||
//FIXME: check for max partitions count on DOS MBR
|
//FIXME: check for max partitions count on DOS MBR
|
||||||
cDebug() << "Checking if" << partitionPath << "can be resized.";
|
cDebug() << "checking if" << partitionPath << "can be resized.";
|
||||||
QString partitionWithOs = partitionPath;
|
QString partitionWithOs = partitionPath;
|
||||||
if ( partitionWithOs.startsWith( "/dev/" ) )
|
if ( partitionWithOs.startsWith( "/dev/" ) )
|
||||||
{
|
{
|
||||||
|
cDebug() << partitionWithOs << "seems like a good path";
|
||||||
DeviceModel* dm = core->deviceModel();
|
DeviceModel* dm = core->deviceModel();
|
||||||
for ( int i = 0; i < dm->rowCount(); ++i )
|
for ( int i = 0; i < dm->rowCount(); ++i )
|
||||||
{
|
{
|
||||||
@ -168,11 +147,10 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
|||||||
Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
|
Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
|
||||||
if ( candidate )
|
if ( candidate )
|
||||||
{
|
{
|
||||||
cDebug() << " .. found Partition* for" << partitionWithOs;
|
cDebug() << "found Partition* for" << partitionWithOs;
|
||||||
return canBeResized( candidate );
|
return canBeResized( candidate );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cDebug() << " .. no Partition* found for" << partitionWithOs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";
|
cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";
|
||||||
@ -183,55 +161,43 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
|||||||
static FstabEntryList
|
static FstabEntryList
|
||||||
lookForFstabEntries( const QString& partitionPath )
|
lookForFstabEntries( const QString& partitionPath )
|
||||||
{
|
{
|
||||||
QStringList mountOptions{ "ro" };
|
|
||||||
|
|
||||||
auto r = CalamaresUtils::System::runCommand(
|
|
||||||
CalamaresUtils::System::RunLocation::RunInHost,
|
|
||||||
{ "blkid", "-s", "TYPE", "-o", "value", partitionPath }
|
|
||||||
);
|
|
||||||
if ( r.getExitCode() )
|
|
||||||
cWarning() << "blkid on" << partitionPath << "failed.";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString fstype = r.getOutput().trimmed();
|
|
||||||
if ( ( fstype == "ext3" ) || ( fstype == "ext4" ) )
|
|
||||||
mountOptions.append( "noload" );
|
|
||||||
}
|
|
||||||
|
|
||||||
cDebug() << "Checking device" << partitionPath
|
|
||||||
<< "for fstab (fs=" << r.getOutput() << ')';
|
|
||||||
|
|
||||||
FstabEntryList fstabEntries;
|
FstabEntryList fstabEntries;
|
||||||
QTemporaryDir mountsDir;
|
QTemporaryDir mountsDir;
|
||||||
mountsDir.setAutoRemove( false );
|
mountsDir.setAutoRemove( false );
|
||||||
|
|
||||||
int exit = QProcess::execute( "mount", { "-o", mountOptions.join(','), partitionPath, mountsDir.path() } );
|
int exit = QProcess::execute( "mount", { partitionPath, mountsDir.path() } );
|
||||||
if ( !exit ) // if all is well
|
if ( !exit ) // if all is well
|
||||||
{
|
{
|
||||||
QFile fstabFile( mountsDir.path() + "/etc/fstab" );
|
QFile fstabFile( mountsDir.path() + "/etc/fstab" );
|
||||||
|
|
||||||
cDebug() << " .. reading" << fstabFile.fileName();
|
|
||||||
|
|
||||||
if ( fstabFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
if ( fstabFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
{
|
{
|
||||||
const QStringList fstabLines = QString::fromLocal8Bit( fstabFile.readAll() )
|
const QStringList fstabLines = QString::fromLocal8Bit( fstabFile.readAll() )
|
||||||
.split( '\n' );
|
.split( '\n' );
|
||||||
|
|
||||||
for ( const QString& rawLine : fstabLines )
|
for ( const QString& rawLine : fstabLines )
|
||||||
fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) );
|
{
|
||||||
fstabFile.close();
|
QString line = rawLine.simplified();
|
||||||
cDebug() << " .. got" << fstabEntries.count() << "lines.";
|
if ( line.startsWith( '#' ) )
|
||||||
std::remove_if( fstabEntries.begin(), fstabEntries.end(), [](const FstabEntry& x) { return !x.isValid(); } );
|
continue;
|
||||||
cDebug() << " .. got" << fstabEntries.count() << "fstab entries.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cWarning() << "Could not read fstab from mounted fs";
|
|
||||||
|
|
||||||
if ( QProcess::execute( "umount", { "-R", mountsDir.path() } ) )
|
QStringList splitLine = line.split( ' ' );
|
||||||
cWarning() << "Could not unmount" << mountsDir.path();
|
if ( splitLine.length() != 6 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
fstabEntries.append( { splitLine.at( 0 ), // path, or UUID, or LABEL, etc.
|
||||||
|
splitLine.at( 1 ), // mount point
|
||||||
|
splitLine.at( 2 ), // fs type
|
||||||
|
splitLine.at( 3 ), // options
|
||||||
|
splitLine.at( 4 ).toInt(), //dump
|
||||||
|
splitLine.at( 5 ).toInt() //pass
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
fstabFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
QProcess::execute( "umount", { "-R", mountsDir.path() } );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cWarning() << "Could not mount existing fs";
|
|
||||||
|
|
||||||
return fstabEntries;
|
return fstabEntries;
|
||||||
}
|
}
|
||||||
@ -330,6 +296,7 @@ runOsprober( PartitionCoreModule* core )
|
|||||||
osprober.readAllStandardOutput() ).trimmed() );
|
osprober.readAllStandardOutput() ).trimmed() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString osProberReport( "Osprober lines, clean:\n" );
|
||||||
QStringList osproberCleanLines;
|
QStringList osproberCleanLines;
|
||||||
OsproberEntryList osproberEntries;
|
OsproberEntryList osproberEntries;
|
||||||
const auto lines = osproberOutput.split( '\n' );
|
const auto lines = osproberOutput.split( '\n' );
|
||||||
@ -361,11 +328,8 @@ runOsprober( PartitionCoreModule* core )
|
|||||||
osproberCleanLines.append( line );
|
osproberCleanLines.append( line );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
osProberReport.append( osproberCleanLines.join( '\n' ) );
|
||||||
if ( osproberCleanLines.count() > 0 )
|
cDebug() << osProberReport;
|
||||||
cDebug() << "os-prober lines after cleanup:" << Logger::DebugList( osproberCleanLines );
|
|
||||||
else
|
|
||||||
cDebug() << "os-prober gave no output.";
|
|
||||||
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "osproberLines", osproberCleanLines );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "osproberLines", osproberCleanLines );
|
||||||
|
|
||||||
@ -409,31 +373,3 @@ isEfiBootable( const Partition* candidate )
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // nmamespace PartUtils
|
} // nmamespace PartUtils
|
||||||
|
|
||||||
/* Implementation of methods for FstabEntry, from OsproberEntry.h */
|
|
||||||
|
|
||||||
bool
|
|
||||||
FstabEntry::isValid() const
|
|
||||||
{
|
|
||||||
return !partitionNode.isEmpty() && !mountPoint.isEmpty() && !fsType.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
FstabEntry
|
|
||||||
FstabEntry::fromEtcFstab( const QString& rawLine )
|
|
||||||
{
|
|
||||||
QString line = rawLine.simplified();
|
|
||||||
if ( line.startsWith( '#' ) )
|
|
||||||
return FstabEntry{ QString(), QString(), QString(), QString(), 0, 0 };
|
|
||||||
|
|
||||||
QStringList splitLine = line.split( ' ' );
|
|
||||||
if ( splitLine.length() != 6 )
|
|
||||||
return FstabEntry{ QString(), QString(), QString(), QString(), 0, 0 };
|
|
||||||
|
|
||||||
return FstabEntry{ splitLine.at( 0 ), // path, or UUID, or LABEL, etc.
|
|
||||||
splitLine.at( 1 ), // mount point
|
|
||||||
splitLine.at( 2 ), // fs type
|
|
||||||
splitLine.at( 3 ), // options
|
|
||||||
splitLine.at( 4 ).toInt(), //dump
|
|
||||||
splitLine.at( 5 ).toInt() //pass
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "GlobalStorage.h"
|
||||||
|
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
@ -42,38 +43,58 @@ using CalamaresUtils::operator""_GiB;
|
|||||||
using CalamaresUtils::operator""_MiB;
|
using CalamaresUtils::operator""_MiB;
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
swapSuggestion( const qint64 availableSpaceB, Choices::SwapChoice swap )
|
swapSuggestion( const qint64 availableSpaceB )
|
||||||
{
|
{
|
||||||
if ( ( swap != Choices::SmallSwap ) && ( swap != Choices::FullSwap ) )
|
/* If suspend-to-disk is demanded, then we always need enough
|
||||||
return 0;
|
* swap to write the whole memory to disk -- between 2GB and 8GB
|
||||||
|
* RAM give proportionally more swap, and from 8GB RAM keep
|
||||||
// See partition.conf for explanation
|
* swap = RAM.
|
||||||
|
*
|
||||||
|
* If suspend-to-disk is not demanded, then ramp up more slowly,
|
||||||
|
* to 8GB swap at 16GB memory, and then drop to 4GB for "large
|
||||||
|
* memory" machines, on the assumption that those don't need swap
|
||||||
|
* because they have tons of memory (or whatever they are doing,
|
||||||
|
* had better not run into swap).
|
||||||
|
*/
|
||||||
qint64 suggestedSwapSizeB = 0;
|
qint64 suggestedSwapSizeB = 0;
|
||||||
auto memory = CalamaresUtils::System::instance()->getTotalMemoryB();
|
auto memory = CalamaresUtils::System::instance()->getTotalMemoryB();
|
||||||
qint64 availableRamB = memory.first;
|
qint64 availableRamB = memory.first;
|
||||||
qreal overestimationFactor = memory.second;
|
qreal overestimationFactor = memory.second;
|
||||||
|
|
||||||
bool ensureSuspendToDisk = swap == Choices::FullSwap;
|
bool ensureSuspendToDisk =
|
||||||
|
Calamares::JobQueue::instance()->globalStorage()->
|
||||||
|
value( "ensureSuspendToDisk" ).toBool();
|
||||||
|
|
||||||
// Ramp up quickly to 8GiB, then follow memory size
|
if ( ensureSuspendToDisk )
|
||||||
if ( availableRamB <= 4_GiB )
|
{
|
||||||
suggestedSwapSizeB = availableRamB * 2;
|
if ( availableRamB < 4_GiB )
|
||||||
else if ( availableRamB <= 8_GiB )
|
suggestedSwapSizeB = qMax( 2_GiB, availableRamB * 2 );
|
||||||
|
else if ( availableRamB >= 4_GiB && availableRamB < 8_GiB )
|
||||||
suggestedSwapSizeB = 8_GiB;
|
suggestedSwapSizeB = 8_GiB;
|
||||||
else
|
else
|
||||||
suggestedSwapSizeB = availableRamB;
|
suggestedSwapSizeB = availableRamB;
|
||||||
|
|
||||||
// .. top out at 8GiB if we don't care about suspend
|
suggestedSwapSizeB *= overestimationFactor;
|
||||||
if ( !ensureSuspendToDisk )
|
}
|
||||||
suggestedSwapSizeB = qMin( 8_GiB, suggestedSwapSizeB );
|
else //if we don't care about suspend to disk
|
||||||
|
{
|
||||||
|
if ( availableRamB < 2_GiB )
|
||||||
|
suggestedSwapSizeB = qMax( 2_GiB, availableRamB * 2 );
|
||||||
|
else if ( availableRamB >= 2_GiB && availableRamB < 8_GiB )
|
||||||
|
suggestedSwapSizeB = availableRamB;
|
||||||
|
else if ( availableRamB >= 8_GiB && availableRamB < 16_GiB )
|
||||||
|
suggestedSwapSizeB = 8_GiB;
|
||||||
|
else
|
||||||
|
suggestedSwapSizeB = 4_GiB;
|
||||||
|
|
||||||
|
|
||||||
// Allow for a fudge factor
|
|
||||||
suggestedSwapSizeB *= overestimationFactor;
|
suggestedSwapSizeB *= overestimationFactor;
|
||||||
|
|
||||||
// don't use more than 10% of available space
|
// don't use more than 10% of available space
|
||||||
if ( !ensureSuspendToDisk )
|
qreal maxSwapDiskRatio = 0.10;
|
||||||
suggestedSwapSizeB = qMin( suggestedSwapSizeB, qint64( 0.10 * availableSpaceB ) );
|
qint64 maxSwapSizeB = availableSpaceB * maxSwapDiskRatio;
|
||||||
|
if ( suggestedSwapSizeB > maxSwapSizeB )
|
||||||
|
suggestedSwapSizeB = maxSwapSizeB;
|
||||||
|
}
|
||||||
|
|
||||||
cDebug() << "Suggested swap size:" << suggestedSwapSizeB / 1024. / 1024. / 1024. << "GiB";
|
cDebug() << "Suggested swap size:" << suggestedSwapSizeB / 1024. / 1024. / 1024. << "GiB";
|
||||||
|
|
||||||
@ -83,7 +104,10 @@ swapSuggestion( const qint64 availableSpaceB, Choices::SwapChoice swap )
|
|||||||
constexpr qint64
|
constexpr qint64
|
||||||
alignBytesToBlockSize( qint64 bytes, qint64 blocksize )
|
alignBytesToBlockSize( qint64 bytes, qint64 blocksize )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( bytes >= 0 );
|
||||||
|
Q_ASSERT( blocksize > 0 );
|
||||||
qint64 blocks = bytes / blocksize;
|
qint64 blocks = bytes / blocksize;
|
||||||
|
Q_ASSERT( blocks >= 0 );
|
||||||
|
|
||||||
if ( blocks * blocksize != bytes )
|
if ( blocks * blocksize != bytes )
|
||||||
++blocks;
|
++blocks;
|
||||||
@ -97,29 +121,31 @@ bytesToSectors( qint64 bytes, qint64 blocksize )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionOptions o )
|
doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPassphrase )
|
||||||
{
|
{
|
||||||
QString defaultFsType = o.defaultFsType;
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
|
||||||
defaultFsType = "ext4";
|
|
||||||
|
|
||||||
bool isEfi = PartUtils::isEfiSystem();
|
bool isEfi = PartUtils::isEfiSystem();
|
||||||
|
|
||||||
|
QString defaultFsType = gs->value( "defaultFileSystemType" ).toString();
|
||||||
|
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
||||||
|
defaultFsType = "ext4";
|
||||||
|
|
||||||
// Partition sizes are expressed in MiB, should be multiples of
|
// Partition sizes are expressed in MiB, should be multiples of
|
||||||
// the logical sector size (usually 512B). EFI starts with 2MiB
|
// the logical sector size (usually 512B). EFI starts with 2MiB
|
||||||
// empty and a 300MiB EFI boot partition, while BIOS starts at
|
// empty and a 300MiB EFI boot partition, while BIOS starts at
|
||||||
// the 1MiB boundary (usually sector 2048).
|
// the 1MiB boundary (usually sector 2048).
|
||||||
int uefisys_part_sizeB = isEfi ? 300_MiB : 0_MiB;
|
int uefisys_part_size = isEfi ? 300 : 0;
|
||||||
int empty_space_sizeB = isEfi ? 2_MiB : 1_MiB;
|
int empty_space_size = isEfi ? 2 : 1;
|
||||||
|
|
||||||
// Since sectors count from 0, if the space is 2048 sectors in size,
|
// Since sectors count from 0, if the space is 2048 sectors in size,
|
||||||
// the first free sector has number 2048 (and there are 2048 sectors
|
// the first free sector has number 2048 (and there are 2048 sectors
|
||||||
// before that one, numbered 0..2047).
|
// before that one, numbered 0..2047).
|
||||||
qint64 firstFreeSector = bytesToSectors( empty_space_sizeB, dev->logicalSize() );
|
qint64 firstFreeSector = bytesToSectors( MiBtoBytes(empty_space_size), dev->logicalSize() );
|
||||||
|
|
||||||
if ( isEfi )
|
if ( isEfi )
|
||||||
{
|
{
|
||||||
qint64 efiSectorCount = bytesToSectors( uefisys_part_sizeB, dev->logicalSize() );
|
qint64 efiSectorCount = bytesToSectors( MiBtoBytes(uefisys_part_size), dev->logicalSize() );
|
||||||
Q_ASSERT( efiSectorCount > 0 );
|
Q_ASSERT( efiSectorCount > 0 );
|
||||||
|
|
||||||
// Since sectors count from 0, and this partition is created starting
|
// Since sectors count from 0, and this partition is created starting
|
||||||
@ -137,7 +163,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
PartitionTable::FlagNone
|
PartitionTable::FlagNone
|
||||||
);
|
);
|
||||||
PartitionInfo::setFormat( efiPartition, true );
|
PartitionInfo::setFormat( efiPartition, true );
|
||||||
PartitionInfo::setMountPoint( efiPartition, o.efiPartitionMountPoint );
|
PartitionInfo::setMountPoint( efiPartition, gs->value( "efiSystemPartition" )
|
||||||
|
.toString() );
|
||||||
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp );
|
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp );
|
||||||
firstFreeSector = lastSector + 1;
|
firstFreeSector = lastSector + 1;
|
||||||
}
|
}
|
||||||
@ -146,18 +173,20 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
core->createPartitionTable( dev, PartitionTable::msdos );
|
core->createPartitionTable( dev, PartitionTable::msdos );
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool mayCreateSwap = ( o.swap == Choices::SmallSwap ) || ( o.swap == Choices::FullSwap );
|
const bool mayCreateSwap = !gs->value( "neverCreateSwap" ).toBool();
|
||||||
bool shouldCreateSwap = false;
|
bool shouldCreateSwap = false;
|
||||||
qint64 suggestedSwapSizeB = 0;
|
qint64 suggestedSwapSizeB = 0;
|
||||||
|
|
||||||
if ( mayCreateSwap )
|
if ( mayCreateSwap )
|
||||||
{
|
{
|
||||||
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
|
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
|
||||||
suggestedSwapSizeB = swapSuggestion( availableSpaceB, o.swap );
|
suggestedSwapSizeB = swapSuggestion( availableSpaceB );
|
||||||
// Space required by this installation is what the distro claims is needed
|
// Space required by this installation is what the distro claims is needed
|
||||||
// (via global configuration) plus the swap size plus a fudge factor of
|
// (via global configuration) plus the swap size plus a fudge factor of
|
||||||
// 0.6GiB (this was 2.1GiB up to Calamares 3.2.2).
|
// 0.6GiB (this was 2.1GiB up to Calamares 3.2.2).
|
||||||
qint64 requiredSpaceB = o.requiredSpaceB + 600_MiB + suggestedSwapSizeB;
|
qint64 requiredSpaceB =
|
||||||
|
GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() + 0.6 ) +
|
||||||
|
suggestedSwapSizeB;
|
||||||
|
|
||||||
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
|
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
|
||||||
shouldCreateSwap = availableSpaceB > requiredSpaceB;
|
shouldCreateSwap = availableSpaceB > requiredSpaceB;
|
||||||
@ -170,7 +199,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
}
|
}
|
||||||
|
|
||||||
Partition* rootPartition = nullptr;
|
Partition* rootPartition = nullptr;
|
||||||
if ( o.luksPassphrase.isEmpty() )
|
if ( luksPassphrase.isEmpty() )
|
||||||
{
|
{
|
||||||
rootPartition = KPMHelpers::createNewPartition(
|
rootPartition = KPMHelpers::createNewPartition(
|
||||||
dev->partitionTable(),
|
dev->partitionTable(),
|
||||||
@ -178,8 +207,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
firstFreeSector,
|
firstFreeSector,
|
||||||
lastSectorForRoot,
|
lastSectorForRoot
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -191,22 +219,17 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
firstFreeSector,
|
firstFreeSector,
|
||||||
lastSectorForRoot,
|
lastSectorForRoot,
|
||||||
o.luksPassphrase,
|
luksPassphrase
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setFormat( rootPartition, true );
|
PartitionInfo::setFormat( rootPartition, true );
|
||||||
PartitionInfo::setMountPoint( rootPartition, "/" );
|
PartitionInfo::setMountPoint( rootPartition, "/" );
|
||||||
// Some buggy (legacy) BIOSes test if the bootflag of at least one partition is set.
|
core->createPartition( dev, rootPartition );
|
||||||
// Otherwise they ignore the device in boot-order, so add it here.
|
|
||||||
core->createPartition( dev, rootPartition,
|
|
||||||
rootPartition->activeFlags() | ( isEfi ? PartitionTable::FlagNone : PartitionTable::FlagBoot )
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( shouldCreateSwap )
|
if ( shouldCreateSwap )
|
||||||
{
|
{
|
||||||
Partition* swapPartition = nullptr;
|
Partition* swapPartition = nullptr;
|
||||||
if ( o.luksPassphrase.isEmpty() )
|
if ( luksPassphrase.isEmpty() )
|
||||||
{
|
{
|
||||||
swapPartition = KPMHelpers::createNewPartition(
|
swapPartition = KPMHelpers::createNewPartition(
|
||||||
dev->partitionTable(),
|
dev->partitionTable(),
|
||||||
@ -214,8 +237,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
dev->totalLogical() - 1,
|
dev->totalLogical() - 1
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -227,8 +249,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
|||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
dev->totalLogical() - 1,
|
dev->totalLogical() - 1,
|
||||||
o.luksPassphrase,
|
luksPassphrase
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setFormat( swapPartition, true );
|
PartitionInfo::setFormat( swapPartition, true );
|
||||||
@ -243,11 +264,13 @@ void
|
|||||||
doReplacePartition( PartitionCoreModule* core,
|
doReplacePartition( PartitionCoreModule* core,
|
||||||
Device* dev,
|
Device* dev,
|
||||||
Partition* partition,
|
Partition* partition,
|
||||||
Choices::ReplacePartitionOptions o )
|
const QString& luksPassphrase )
|
||||||
{
|
{
|
||||||
cDebug() << "doReplacePartition for device" << partition->partitionPath();
|
cDebug() << "doReplacePartition for device" << partition->partitionPath();
|
||||||
|
|
||||||
QString defaultFsType = o.defaultFsType;
|
QString defaultFsType = Calamares::JobQueue::instance()->
|
||||||
|
globalStorage()->
|
||||||
|
value( "defaultFileSystemType" ).toString();
|
||||||
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
||||||
defaultFsType = "ext4";
|
defaultFsType = "ext4";
|
||||||
|
|
||||||
@ -268,7 +291,7 @@ doReplacePartition( PartitionCoreModule* core,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Partition* newPartition = nullptr;
|
Partition* newPartition = nullptr;
|
||||||
if ( o.luksPassphrase.isEmpty() )
|
if ( luksPassphrase.isEmpty() )
|
||||||
{
|
{
|
||||||
newPartition = KPMHelpers::createNewPartition(
|
newPartition = KPMHelpers::createNewPartition(
|
||||||
partition->parent(),
|
partition->parent(),
|
||||||
@ -276,8 +299,7 @@ doReplacePartition( PartitionCoreModule* core,
|
|||||||
newRoles,
|
newRoles,
|
||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
partition->firstSector(),
|
partition->firstSector(),
|
||||||
partition->lastSector(),
|
partition->lastSector()
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -289,8 +311,7 @@ doReplacePartition( PartitionCoreModule* core,
|
|||||||
FileSystem::typeForName( defaultFsType ),
|
FileSystem::typeForName( defaultFsType ),
|
||||||
partition->firstSector(),
|
partition->firstSector(),
|
||||||
partition->lastSector(),
|
partition->lastSector(),
|
||||||
o.luksPassphrase,
|
luksPassphrase
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||||
|
@ -27,74 +27,29 @@ class Partition;
|
|||||||
|
|
||||||
namespace PartitionActions
|
namespace PartitionActions
|
||||||
{
|
{
|
||||||
/** @brief Namespace for enums
|
|
||||||
*
|
|
||||||
* This namespace houses non-class enums.....
|
|
||||||
*/
|
|
||||||
namespace Choices
|
|
||||||
{
|
|
||||||
/** @brief Ccchoice of swap (size and type) */
|
|
||||||
enum SwapChoice
|
|
||||||
{
|
|
||||||
NoSwap, // don't create any swap, don't use any
|
|
||||||
ReuseSwap, // don't create, but do use existing
|
|
||||||
SmallSwap, // up to 8GiB of swap
|
|
||||||
FullSwap, // ensureSuspendToDisk -- at least RAM size
|
|
||||||
SwapFile // use a file (if supported)
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ReplacePartitionOptions
|
|
||||||
{
|
|
||||||
QString defaultFsType; // e.g. "ext4" or "btrfs"
|
|
||||||
QString luksPassphrase; // optional
|
|
||||||
|
|
||||||
ReplacePartitionOptions( const QString& fs, const QString& luks )
|
|
||||||
: defaultFsType( fs )
|
|
||||||
, luksPassphrase( luks )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct AutoPartitionOptions : ReplacePartitionOptions
|
|
||||||
{
|
|
||||||
QString efiPartitionMountPoint; // optional, e.g. "/boot"
|
|
||||||
quint64 requiredSpaceB; // estimated required space for root partition
|
|
||||||
SwapChoice swap;
|
|
||||||
|
|
||||||
AutoPartitionOptions( const QString& fs, const QString& luks, const QString& efi, qint64 r, SwapChoice s )
|
|
||||||
: ReplacePartitionOptions( fs, luks )
|
|
||||||
, efiPartitionMountPoint( efi )
|
|
||||||
, requiredSpaceB( r > 0 ? r : 0 )
|
|
||||||
, swap( s )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Choices
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief doAutopartition sets up an autopartitioning operation on the given Device.
|
* @brief doAutopartition sets up an autopartitioning operation on the given Device.
|
||||||
* @param core a pointer to the PartitionCoreModule instance.
|
* @param core a pointer to the PartitionCoreModule instance.
|
||||||
* @param dev the device to wipe.
|
* @param dev the device to wipe.
|
||||||
* @param options settings for autopartitioning.
|
* @param luksPassphrase the passphrase for LUKS encryption (optional, default is empty).
|
||||||
*/
|
*/
|
||||||
void doAutopartition( PartitionCoreModule* core,
|
void doAutopartition( PartitionCoreModule* core,
|
||||||
Device* dev,
|
Device* dev,
|
||||||
Choices::AutoPartitionOptions options );
|
const QString& luksPassphrase = QString() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief doReplacePartition sets up replace-partitioning with the given partition.
|
* @brief doReplacePartition sets up replace-partitioning with the given partition.
|
||||||
* @param core a pointer to the PartitionCoreModule instance.
|
* @param core a pointer to the PartitionCoreModule instance.
|
||||||
* @param dev a pointer to the Device on which to replace a partition.
|
* @param dev a pointer to the Device on which to replace a partition.
|
||||||
* @param partition a pointer to the Partition to be replaced.
|
* @param partition a pointer to the Partition to be replaced.
|
||||||
* @param options settings for partitioning (not all fields apply)
|
* @param luksPassphrase the passphrase for LUKS encryption (optional, default is empty).
|
||||||
*
|
|
||||||
* @note this function also takes care of requesting PCM to delete the partition.
|
* @note this function also takes care of requesting PCM to delete the partition.
|
||||||
*/
|
*/
|
||||||
void doReplacePartition( PartitionCoreModule* core,
|
void doReplacePartition( PartitionCoreModule* core,
|
||||||
Device* dev,
|
Device* dev,
|
||||||
Partition* partition,
|
Partition* partition,
|
||||||
Choices::ReplacePartitionOptions options );
|
const QString& luksPassphrase = QString() );
|
||||||
} // namespace PartitionActions
|
}
|
||||||
|
|
||||||
#endif // PARTITIONACTIONS_H
|
#endif // PARTITIONACTIONS_H
|
||||||
|
@ -509,8 +509,17 @@ PartitionCoreModule::jobs() const
|
|||||||
lst << info->jobs;
|
lst << info->jobs;
|
||||||
devices << info->device.data();
|
devices << info->device.data();
|
||||||
}
|
}
|
||||||
|
cDebug() << "Creating FillGlobalStorageJob with bootLoader path" << m_bootLoaderInstallPath;
|
||||||
lst << Calamares::job_ptr( new FillGlobalStorageJob( devices, m_bootLoaderInstallPath ) );
|
lst << Calamares::job_ptr( new FillGlobalStorageJob( devices, m_bootLoaderInstallPath ) );
|
||||||
|
|
||||||
|
|
||||||
|
QStringList jobsDebug;
|
||||||
|
foreach ( auto job, lst )
|
||||||
|
jobsDebug.append( job->prettyName() );
|
||||||
|
|
||||||
|
cDebug() << "PartitionCodeModule has been asked for jobs. About to return:"
|
||||||
|
<< jobsDebug.join( "\n" );
|
||||||
|
|
||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,12 +128,6 @@ public:
|
|||||||
|
|
||||||
void createPartitionTable( Device* device, PartitionTable::TableType type );
|
void createPartitionTable( Device* device, PartitionTable::TableType type );
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Add a job to do the actual partition-creation.
|
|
||||||
*
|
|
||||||
* If @p flags is not FlagNone, then the given flags are
|
|
||||||
* applied to the newly-created partition.
|
|
||||||
*/
|
|
||||||
void createPartition( Device* device, Partition* partition,
|
void createPartition( Device* device, Partition* partition,
|
||||||
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
PartitionTable::Flags flags = PartitionTable::FlagNone );
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PartitionIterator.h"
|
#include <core/PartitionIterator.h>
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2019, Collabora Ltd
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,39 +20,34 @@
|
|||||||
#include "ChoicePage.h"
|
#include "ChoicePage.h"
|
||||||
|
|
||||||
#include "core/BootLoaderModel.h"
|
#include "core/BootLoaderModel.h"
|
||||||
#include "core/DeviceModel.h"
|
|
||||||
#include "core/KPMHelpers.h"
|
|
||||||
#include "core/OsproberEntry.h"
|
|
||||||
#include "core/PartUtils.h"
|
|
||||||
#include "core/PartitionActions.h"
|
#include "core/PartitionActions.h"
|
||||||
#include "core/PartitionCoreModule.h"
|
#include "core/PartitionCoreModule.h"
|
||||||
#include "core/PartitionInfo.h"
|
#include "core/DeviceModel.h"
|
||||||
#include "core/PartitionIterator.h"
|
|
||||||
#include "core/PartitionModel.h"
|
#include "core/PartitionModel.h"
|
||||||
|
#include "core/OsproberEntry.h"
|
||||||
|
#include "core/PartUtils.h"
|
||||||
|
#include "core/PartitionIterator.h"
|
||||||
|
|
||||||
#include "BootInfoWidget.h"
|
#include "ReplaceWidget.h"
|
||||||
#include "DeviceInfoWidget.h"
|
#include "PrettyRadioButton.h"
|
||||||
#include "PartitionBarsView.h"
|
#include "PartitionBarsView.h"
|
||||||
#include "PartitionLabelsView.h"
|
#include "PartitionLabelsView.h"
|
||||||
#include "PartitionSplitterWidget.h"
|
#include "PartitionSplitterWidget.h"
|
||||||
#include "PrettyRadioButton.h"
|
#include "BootInfoWidget.h"
|
||||||
#include "ReplaceWidget.h"
|
#include "DeviceInfoWidget.h"
|
||||||
#include "ScanningDialog.h"
|
#include "ScanningDialog.h"
|
||||||
|
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "utils/Units.h"
|
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "GlobalStorage.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
#include "GlobalStorage.h"
|
||||||
|
#include "core/PartitionInfo.h"
|
||||||
|
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
#ifdef WITH_KPMCOREGT33
|
|
||||||
#include <kpmcore/core/softwareraid.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
@ -64,7 +58,7 @@
|
|||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
using PartitionActions::Choices::SwapChoice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ChoicePage::ChoicePage is the default constructor. Called on startup as part of
|
* @brief ChoicePage::ChoicePage is the default constructor. Called on startup as part of
|
||||||
@ -84,9 +78,6 @@ ChoicePage::ChoicePage( QWidget* parent )
|
|||||||
, m_eraseButton( nullptr )
|
, m_eraseButton( nullptr )
|
||||||
, m_replaceButton( nullptr )
|
, m_replaceButton( nullptr )
|
||||||
, m_somethingElseButton( nullptr )
|
, m_somethingElseButton( nullptr )
|
||||||
, m_eraseSwapChoices( nullptr )
|
|
||||||
, m_replaceSwapChoices( nullptr )
|
|
||||||
, m_alongsideSwapChoices( nullptr )
|
|
||||||
, m_deviceInfoWidget( nullptr )
|
, m_deviceInfoWidget( nullptr )
|
||||||
, m_beforePartitionBarsView( nullptr )
|
, m_beforePartitionBarsView( nullptr )
|
||||||
, m_beforePartitionLabelsView( nullptr )
|
, m_beforePartitionLabelsView( nullptr )
|
||||||
@ -182,19 +173,6 @@ ChoicePage::init( PartitionCoreModule* core )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @brief Creates a combobox with the given choices in it.
|
|
||||||
*
|
|
||||||
* No texts are set -- that happens later by the translator functions.
|
|
||||||
*/
|
|
||||||
static inline QComboBox*
|
|
||||||
createCombo( std::initializer_list< SwapChoice > l )
|
|
||||||
{
|
|
||||||
QComboBox* box = new QComboBox;
|
|
||||||
for ( SwapChoice c : l )
|
|
||||||
box->addItem( QString(), c );
|
|
||||||
return box;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ChoicePage::setupChoices creates PrettyRadioButton objects for the action
|
* @brief ChoicePage::setupChoices creates PrettyRadioButton objects for the action
|
||||||
* choices.
|
* choices.
|
||||||
@ -248,19 +226,6 @@ ChoicePage::setupChoices()
|
|||||||
iconSize ) );
|
iconSize ) );
|
||||||
m_grp->addButton( m_replaceButton->buttonWidget(), Replace );
|
m_grp->addButton( m_replaceButton->buttonWidget(), Replace );
|
||||||
|
|
||||||
// Fill up swap options
|
|
||||||
// .. TODO: only if enabled in the config
|
|
||||||
m_eraseSwapChoices = createCombo( { SwapChoice::NoSwap, SwapChoice::SmallSwap, SwapChoice::FullSwap } );
|
|
||||||
m_eraseButton->addOptionsComboBox( m_eraseSwapChoices );
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
m_replaceSwapChoices = createCombo( { SwapChoice::NoSwap, SwapChoice::ReuseSwap, SwapChoice::SmallSwap, SwapChoice::FullSwap } );
|
|
||||||
m_replaceButton->addOptionsComboBox( m_replaceSwapChoices );
|
|
||||||
|
|
||||||
m_alongsideSwapChoices = createCombo( { SwapChoice::NoSwap, SwapChoice::ReuseSwap, SwapChoice::SmallSwap, SwapChoice::FullSwap } );
|
|
||||||
m_alongsideButton->addOptionsComboBox( m_alongsideSwapChoices );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_itemsLayout->addWidget( m_alongsideButton );
|
m_itemsLayout->addWidget( m_alongsideButton );
|
||||||
m_itemsLayout->addWidget( m_replaceButton );
|
m_itemsLayout->addWidget( m_replaceButton );
|
||||||
m_itemsLayout->addWidget( m_eraseButton );
|
m_itemsLayout->addWidget( m_eraseButton );
|
||||||
@ -284,7 +249,7 @@ ChoicePage::setupChoices()
|
|||||||
{
|
{
|
||||||
if ( checked ) // An action was picked.
|
if ( checked ) // An action was picked.
|
||||||
{
|
{
|
||||||
m_choice = static_cast< InstallChoice >( id );
|
m_choice = static_cast< Choice >( id );
|
||||||
updateNextEnabled();
|
updateNextEnabled();
|
||||||
|
|
||||||
emit actionChosen();
|
emit actionChosen();
|
||||||
@ -314,12 +279,6 @@ ChoicePage::setupChoices()
|
|||||||
applyActionChoice( currentChoice() );
|
applyActionChoice( currentChoice() );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
|
||||||
updateSwapChoicesTr( m_eraseSwapChoices );
|
|
||||||
updateSwapChoicesTr( m_alongsideSwapChoices );
|
|
||||||
updateSwapChoicesTr( m_replaceSwapChoices );
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,7 +373,7 @@ ChoicePage::continueApplyDeviceChoice()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||||
{
|
{
|
||||||
m_beforePartitionBarsView->selectionModel()->
|
m_beforePartitionBarsView->selectionModel()->
|
||||||
disconnect( SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ) );
|
disconnect( SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ) );
|
||||||
@ -424,17 +383,6 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
|||||||
switch ( choice )
|
switch ( choice )
|
||||||
{
|
{
|
||||||
case Erase:
|
case Erase:
|
||||||
{
|
|
||||||
auto gs = Calamares::JobQueue::instance()->globalStorage();
|
|
||||||
|
|
||||||
PartitionActions::Choices::AutoPartitionOptions options {
|
|
||||||
gs->value( "defaultFileSystemType" ).toString(),
|
|
||||||
m_encryptWidget->passphrase(),
|
|
||||||
gs->value( "efiSystemPartition" ).toString(),
|
|
||||||
CalamaresUtils::GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() ),
|
|
||||||
static_cast<PartitionActions::Choices::SwapChoice>( m_eraseSwapChoices->currentData().toInt() )
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
{
|
{
|
||||||
ScanningDialog::run( QtConcurrent::run( [ = ]
|
ScanningDialog::run( QtConcurrent::run( [ = ]
|
||||||
@ -444,17 +392,21 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
|||||||
} ),
|
} ),
|
||||||
[ = ]
|
[ = ]
|
||||||
{
|
{
|
||||||
PartitionActions::doAutopartition( m_core, selectedDevice(), options );
|
PartitionActions::doAutopartition( m_core,
|
||||||
|
selectedDevice(),
|
||||||
|
m_encryptWidget->passphrase() );
|
||||||
emit deviceChosen();
|
emit deviceChosen();
|
||||||
},
|
},
|
||||||
this );
|
this );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartitionActions::doAutopartition( m_core, selectedDevice(), options );
|
PartitionActions::doAutopartition( m_core,
|
||||||
|
selectedDevice(),
|
||||||
|
m_encryptWidget->passphrase() );
|
||||||
emit deviceChosen();
|
emit deviceChosen();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Replace:
|
case Replace:
|
||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
@ -532,7 +484,6 @@ ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current,
|
|||||||
->value( "requiredStorageGB" )
|
->value( "requiredStorageGB" )
|
||||||
.toDouble();
|
.toDouble();
|
||||||
|
|
||||||
// TODO: make this consistent
|
|
||||||
qint64 requiredStorageB = qRound64( requiredStorageGB + 0.1 + 2.0 ) * 1024 * 1024 * 1024;
|
qint64 requiredStorageB = qRound64( requiredStorageGB + 0.1 + 2.0 ) * 1024 * 1024 * 1024;
|
||||||
|
|
||||||
m_afterPartitionSplitterWidget->setSplitPartition(
|
m_afterPartitionSplitterWidget->setSplitPartition(
|
||||||
@ -681,8 +632,7 @@ ChoicePage::doAlongsideApply()
|
|||||||
candidate->roles(),
|
candidate->roles(),
|
||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
newLastSector + 2, // *
|
newLastSector + 2, // *
|
||||||
oldLastSector,
|
oldLastSector
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -694,8 +644,7 @@ ChoicePage::doAlongsideApply()
|
|||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
newLastSector + 2, // *
|
newLastSector + 2, // *
|
||||||
oldLastSector,
|
oldLastSector,
|
||||||
luksPassphrase,
|
luksPassphrase
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||||
@ -783,9 +732,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
selectedPartition->firstSector(),
|
selectedPartition->firstSector(),
|
||||||
selectedPartition->lastSector(),
|
selectedPartition->lastSector(),
|
||||||
m_encryptWidget->passphrase(),
|
m_encryptWidget->passphrase() );
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -795,9 +742,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
newRoles,
|
newRoles,
|
||||||
FileSystem::typeForName( m_defaultFsType ),
|
FileSystem::typeForName( m_defaultFsType ),
|
||||||
selectedPartition->firstSector(),
|
selectedPartition->firstSector(),
|
||||||
selectedPartition->lastSector(),
|
selectedPartition->lastSector() );
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||||
@ -823,19 +768,14 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
if ( homePartitionPath->isEmpty() )
|
if ( homePartitionPath->isEmpty() )
|
||||||
doReuseHomePartition = false;
|
doReuseHomePartition = false;
|
||||||
|
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
PartitionActions::doReplacePartition( m_core,
|
||||||
|
|
||||||
PartitionActions::doReplacePartition(
|
|
||||||
m_core,
|
|
||||||
selectedDevice(),
|
selectedDevice(),
|
||||||
selectedPartition,
|
selectedPartition,
|
||||||
{
|
m_encryptWidget->passphrase() );
|
||||||
gs->value( "defaultFileSystemType" ).toString(),
|
|
||||||
m_encryptWidget->passphrase()
|
|
||||||
} );
|
|
||||||
Partition* homePartition = KPMHelpers::findPartitionByPath( { selectedDevice() },
|
Partition* homePartition = KPMHelpers::findPartitionByPath( { selectedDevice() },
|
||||||
*homePartitionPath );
|
*homePartitionPath );
|
||||||
|
|
||||||
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
if ( homePartition && doReuseHomePartition )
|
if ( homePartition && doReuseHomePartition )
|
||||||
{
|
{
|
||||||
PartitionInfo::setMountPoint( homePartition, "/home" );
|
PartitionInfo::setMountPoint( homePartition, "/home" );
|
||||||
@ -948,7 +888,7 @@ ChoicePage::updateDeviceStatePreview()
|
|||||||
* @param choice the chosen partitioning action.
|
* @param choice the chosen partitioning action.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
|
||||||
{
|
{
|
||||||
Device* currentDevice = selectedDevice();
|
Device* currentDevice = selectedDevice();
|
||||||
Q_ASSERT( currentDevice );
|
Q_ASSERT( currentDevice );
|
||||||
@ -1218,13 +1158,6 @@ force_uncheck(QButtonGroup* grp, PrettyRadioButton* button)
|
|||||||
grp->setExclusive( true );
|
grp->setExclusive( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QDebug&
|
|
||||||
operator <<( QDebug& s, PartitionIterator& it )
|
|
||||||
{
|
|
||||||
s << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) );
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ChoicePage::setupActions happens every time a new Device* is selected in the
|
* @brief ChoicePage::setupActions happens every time a new Device* is selected in the
|
||||||
* device picker. Sets up the text and visibility of the partitioning actions based
|
* device picker. Sets up the text and visibility of the partitioning actions based
|
||||||
@ -1238,9 +1171,6 @@ ChoicePage::setupActions()
|
|||||||
OsproberEntryList osproberEntriesForCurrentDevice =
|
OsproberEntryList osproberEntriesForCurrentDevice =
|
||||||
getOsproberEntriesForDevice( currentDevice );
|
getOsproberEntriesForDevice( currentDevice );
|
||||||
|
|
||||||
cDebug() << "Setting up actions for" << currentDevice->deviceNode()
|
|
||||||
<< "with" << osproberEntriesForCurrentDevice.count() << "entries.";
|
|
||||||
|
|
||||||
if ( currentDevice->partitionTable() )
|
if ( currentDevice->partitionTable() )
|
||||||
m_deviceInfoWidget->setPartitionTableType( currentDevice->partitionTable()->type() );
|
m_deviceInfoWidget->setPartitionTableType( currentDevice->partitionTable()->type() );
|
||||||
else
|
else
|
||||||
@ -1252,36 +1182,17 @@ ChoicePage::setupActions()
|
|||||||
bool atLeastOneCanBeResized = false;
|
bool atLeastOneCanBeResized = false;
|
||||||
bool atLeastOneCanBeReplaced = false;
|
bool atLeastOneCanBeReplaced = false;
|
||||||
bool atLeastOneIsMounted = false; // Suppress 'erase' if so
|
bool atLeastOneIsMounted = false; // Suppress 'erase' if so
|
||||||
bool isInactiveRAID = false;
|
|
||||||
|
|
||||||
#ifdef WITH_KPMCOREGT33
|
|
||||||
if ( currentDevice->type() == Device::Type::SoftwareRAID_Device &&
|
|
||||||
static_cast< SoftwareRAID* >(currentDevice)->status() == SoftwareRAID::Status::Inactive )
|
|
||||||
{
|
|
||||||
cDebug() << ".. part of an inactive RAID device";
|
|
||||||
isInactiveRAID = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for ( auto it = PartitionIterator::begin( currentDevice );
|
for ( auto it = PartitionIterator::begin( currentDevice );
|
||||||
it != PartitionIterator::end( currentDevice ); ++it )
|
it != PartitionIterator::end( currentDevice ); ++it )
|
||||||
{
|
{
|
||||||
if ( PartUtils::canBeResized( *it ) )
|
if ( PartUtils::canBeResized( *it ) )
|
||||||
{
|
|
||||||
cDebug() << ".. contains resizable" << it;
|
|
||||||
atLeastOneCanBeResized = true;
|
atLeastOneCanBeResized = true;
|
||||||
}
|
|
||||||
if ( PartUtils::canBeReplaced( *it ) )
|
if ( PartUtils::canBeReplaced( *it ) )
|
||||||
{
|
|
||||||
cDebug() << ".. contains replacable" << it;
|
|
||||||
atLeastOneCanBeReplaced = true;
|
atLeastOneCanBeReplaced = true;
|
||||||
}
|
|
||||||
if ( (*it)->isMounted() )
|
if ( (*it)->isMounted() )
|
||||||
{
|
|
||||||
cDebug() << ".. contains mounted" << it;
|
|
||||||
atLeastOneIsMounted = true;
|
atLeastOneIsMounted = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( osproberEntriesForCurrentDevice.count() == 0 )
|
if ( osproberEntriesForCurrentDevice.count() == 0 )
|
||||||
{
|
{
|
||||||
@ -1394,15 +1305,10 @@ ChoicePage::setupActions()
|
|||||||
else
|
else
|
||||||
force_uncheck( m_grp, m_alongsideButton );
|
force_uncheck( m_grp, m_alongsideButton );
|
||||||
|
|
||||||
if ( !atLeastOneIsMounted && !isInactiveRAID )
|
if ( !atLeastOneIsMounted )
|
||||||
m_eraseButton->show(); // None mounted
|
m_eraseButton->show(); // None mounted
|
||||||
else
|
else
|
||||||
{
|
|
||||||
cDebug() << "Erase button suppressed"
|
|
||||||
<< "mount?" << atLeastOneIsMounted
|
|
||||||
<< "raid?" << isInactiveRAID;
|
|
||||||
force_uncheck( m_grp, m_eraseButton );
|
force_uncheck( m_grp, m_eraseButton );
|
||||||
}
|
|
||||||
|
|
||||||
bool isEfi = PartUtils::isEfiSystem();
|
bool isEfi = PartUtils::isEfiSystem();
|
||||||
bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();
|
bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();
|
||||||
@ -1437,7 +1343,7 @@ ChoicePage::isNextEnabled() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChoicePage::InstallChoice
|
ChoicePage::Choice
|
||||||
ChoicePage::currentChoice() const
|
ChoicePage::currentChoice() const
|
||||||
{
|
{
|
||||||
return m_choice;
|
return m_choice;
|
||||||
@ -1485,55 +1391,3 @@ ChoicePage::updateNextEnabled()
|
|||||||
emit nextStatusChanged( enabled );
|
emit nextStatusChanged( enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ChoicePage::updateSwapChoicesTr(QComboBox* box)
|
|
||||||
{
|
|
||||||
if ( !box )
|
|
||||||
return;
|
|
||||||
|
|
||||||
static_assert(SwapChoice::NoSwap == 0, "Enum values out-of-sync");
|
|
||||||
for ( int index = 0; index < box->count(); ++index )
|
|
||||||
{
|
|
||||||
bool ok = false;
|
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
switch ( value = box->itemData( index ).toInt( &ok ) )
|
|
||||||
{
|
|
||||||
// case 0:
|
|
||||||
case SwapChoice::NoSwap:
|
|
||||||
// toInt() returns 0 on failure, so check for ok
|
|
||||||
if ( ok ) // It was explicitly set to 0
|
|
||||||
box->setItemText( index, tr( "No Swap" ) );
|
|
||||||
else
|
|
||||||
cWarning() << "Box item" << index << box->itemText( index ) << "has non-integer role.";
|
|
||||||
break;
|
|
||||||
case SwapChoice::ReuseSwap:
|
|
||||||
box->setItemText( index, tr( "Reuse Swap" ) );
|
|
||||||
break;
|
|
||||||
case SwapChoice::SmallSwap:
|
|
||||||
box->setItemText( index, tr( "Swap (no Hibernate)" ) );
|
|
||||||
break;
|
|
||||||
case SwapChoice::FullSwap:
|
|
||||||
box->setItemText( index, tr( "Swap (with Hibernate)" ) );
|
|
||||||
break;
|
|
||||||
case SwapChoice::SwapFile:
|
|
||||||
box->setItemText( index, tr( "Swap to file" ) );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cWarning() << "Box item" << index << box->itemText( index ) << "has role" << value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ChoicePage::lastSelectedDeviceIndex()
|
|
||||||
{
|
|
||||||
return m_lastSelectedDeviceIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ChoicePage::setLastSelectedDeviceIndex( int index )
|
|
||||||
{
|
|
||||||
m_lastSelectedDeviceIndex = index;
|
|
||||||
m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex );
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2019, Collabora Ltd
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -54,7 +53,7 @@ class ChoicePage : public QWidget, private Ui::ChoicePage
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum InstallChoice
|
enum Choice
|
||||||
{
|
{
|
||||||
NoChoice,
|
NoChoice,
|
||||||
Alongside,
|
Alongside,
|
||||||
@ -85,7 +84,7 @@ public:
|
|||||||
* currently selected partitioning mode (with a PrettyRadioButton).
|
* currently selected partitioning mode (with a PrettyRadioButton).
|
||||||
* @return the enum Choice value.
|
* @return the enum Choice value.
|
||||||
*/
|
*/
|
||||||
InstallChoice currentChoice() const;
|
Choice currentChoice() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief onLeave runs when control passes from this page to another one.
|
* @brief onLeave runs when control passes from this page to another one.
|
||||||
@ -96,10 +95,7 @@ public:
|
|||||||
* @brief applyActionChoice reacts to a choice of partitioning mode.
|
* @brief applyActionChoice reacts to a choice of partitioning mode.
|
||||||
* @param choice the partitioning action choice.
|
* @param choice the partitioning action choice.
|
||||||
*/
|
*/
|
||||||
void applyActionChoice( ChoicePage::InstallChoice choice );
|
void applyActionChoice( ChoicePage::Choice choice );
|
||||||
|
|
||||||
int lastSelectedDeviceIndex();
|
|
||||||
void setLastSelectedDeviceIndex( int index );
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void nextStatusChanged( bool );
|
void nextStatusChanged( bool );
|
||||||
@ -125,21 +121,18 @@ private:
|
|||||||
void continueApplyDeviceChoice(); // .. called after scan
|
void continueApplyDeviceChoice(); // .. called after scan
|
||||||
|
|
||||||
void updateDeviceStatePreview();
|
void updateDeviceStatePreview();
|
||||||
void updateActionChoicePreview( ChoicePage::InstallChoice choice );
|
void updateActionChoicePreview( ChoicePage::Choice choice );
|
||||||
void setupActions();
|
void setupActions();
|
||||||
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
|
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
|
||||||
void doAlongsideApply();
|
void doAlongsideApply();
|
||||||
void setupEfiSystemPartitionSelector();
|
void setupEfiSystemPartitionSelector();
|
||||||
|
|
||||||
// Translations support
|
|
||||||
void updateSwapChoicesTr( QComboBox* box );
|
|
||||||
|
|
||||||
bool m_nextEnabled;
|
bool m_nextEnabled;
|
||||||
PartitionCoreModule* m_core;
|
PartitionCoreModule* m_core;
|
||||||
|
|
||||||
QMutex m_previewsMutex;
|
QMutex m_previewsMutex;
|
||||||
|
|
||||||
InstallChoice m_choice;
|
Choice m_choice;
|
||||||
|
|
||||||
bool m_isEfi;
|
bool m_isEfi;
|
||||||
QComboBox* m_drivesCombo;
|
QComboBox* m_drivesCombo;
|
||||||
@ -149,9 +142,6 @@ private:
|
|||||||
PrettyRadioButton* m_eraseButton;
|
PrettyRadioButton* m_eraseButton;
|
||||||
PrettyRadioButton* m_replaceButton;
|
PrettyRadioButton* m_replaceButton;
|
||||||
PrettyRadioButton* m_somethingElseButton;
|
PrettyRadioButton* m_somethingElseButton;
|
||||||
QComboBox* m_eraseSwapChoices;
|
|
||||||
QComboBox* m_replaceSwapChoices;
|
|
||||||
QComboBox* m_alongsideSwapChoices;
|
|
||||||
|
|
||||||
DeviceInfoWidget* m_deviceInfoWidget;
|
DeviceInfoWidget* m_deviceInfoWidget;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||||||
m_ui->encryptWidget->setText( tr( "En&crypt" ) );
|
m_ui->encryptWidget->setText( tr( "En&crypt" ) );
|
||||||
m_ui->encryptWidget->hide();
|
m_ui->encryptWidget->hide();
|
||||||
|
|
||||||
if (m_device->type() != Device::Type::LVM_Device) {
|
if (m_device->type() == Device::Type::Disk_Device) {
|
||||||
m_ui->lvNameLabel->hide();
|
m_ui->lvNameLabel->hide();
|
||||||
m_ui->lvNameLineEdit->hide();
|
m_ui->lvNameLineEdit->hide();
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2018, Andrius Štikonas <andrius@stikonas.eu>
|
* Copyright 2018, Andrius Štikonas <andrius@stikonas.eu>
|
||||||
* Copyright 2018, Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
|
||||||
* Copyright 2019, Collabora Ltd
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -49,9 +47,6 @@
|
|||||||
// KPMcore
|
// KPMcore
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
#ifdef WITH_KPMCOREGT33
|
|
||||||
#include <kpmcore/core/softwareraid.h>
|
|
||||||
#endif
|
|
||||||
#include <kpmcore/ops/deactivatevolumegroupoperation.h>
|
#include <kpmcore/ops/deactivatevolumegroupoperation.h>
|
||||||
#include <kpmcore/ops/removevolumegroupoperation.h>
|
#include <kpmcore/ops/removevolumegroupoperation.h>
|
||||||
|
|
||||||
@ -151,7 +146,6 @@ PartitionPage::updateButtons()
|
|||||||
bool isInVG = m_core->isInVG( partition );
|
bool isInVG = m_core->isInVG( partition );
|
||||||
|
|
||||||
create = isFree;
|
create = isFree;
|
||||||
|
|
||||||
// Keep it simple for now: do not support editing extended partitions as
|
// Keep it simple for now: do not support editing extended partitions as
|
||||||
// it does not work with our current edit implementation which is
|
// it does not work with our current edit implementation which is
|
||||||
// actually remove + add. This would not work with extended partitions
|
// actually remove + add. This would not work with extended partitions
|
||||||
@ -166,20 +160,8 @@ PartitionPage::updateButtons()
|
|||||||
if ( m_ui->deviceComboBox->currentIndex() >= 0 )
|
if ( m_ui->deviceComboBox->currentIndex() >= 0 )
|
||||||
{
|
{
|
||||||
QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
|
QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
|
||||||
auto device = m_core->deviceModel()->deviceForIndex( deviceIndex );
|
if ( m_core->deviceModel()->deviceForIndex( deviceIndex )->type() != Device::Type::LVM_Device )
|
||||||
if ( device->type() != Device::Type::LVM_Device )
|
|
||||||
{
|
|
||||||
createTable = true;
|
createTable = true;
|
||||||
|
|
||||||
#ifdef WITH_KPMCOREGT33
|
|
||||||
if ( device->type() == Device::Type::SoftwareRAID_Device &&
|
|
||||||
static_cast< SoftwareRAID* >(device)->status() == SoftwareRAID::Status::Inactive )
|
|
||||||
{
|
|
||||||
createTable = false;
|
|
||||||
create = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentDeviceIsVG = true;
|
currentDeviceIsVG = true;
|
||||||
@ -610,15 +592,3 @@ PartitionPage::getCurrentUsedMountpoints()
|
|||||||
|
|
||||||
return mountPoints;
|
return mountPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
PartitionPage::selectedDeviceIndex()
|
|
||||||
{
|
|
||||||
return m_ui->deviceComboBox->currentIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PartitionPage::selectDeviceByIndex ( int index )
|
|
||||||
{
|
|
||||||
m_ui->deviceComboBox->setCurrentIndex( index );
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2019, Collabora Ltd
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -47,9 +46,6 @@ public:
|
|||||||
|
|
||||||
void onRevertClicked();
|
void onRevertClicked();
|
||||||
|
|
||||||
int selectedDeviceIndex();
|
|
||||||
void selectDeviceByIndex( int index );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer< Ui_PartitionPage > m_ui;
|
QScopedPointer< Ui_PartitionPage > m_ui;
|
||||||
PartitionCoreModule* m_core;
|
PartitionCoreModule* m_core;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2019, Collabora Ltd
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -22,7 +21,6 @@
|
|||||||
#include "gui/PartitionViewStep.h"
|
#include "gui/PartitionViewStep.h"
|
||||||
|
|
||||||
#include "core/DeviceModel.h"
|
#include "core/DeviceModel.h"
|
||||||
#include "core/PartitionActions.h"
|
|
||||||
#include "core/PartitionCoreModule.h"
|
#include "core/PartitionCoreModule.h"
|
||||||
#include "core/PartitionModel.h"
|
#include "core/PartitionModel.h"
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
@ -140,7 +138,7 @@ PartitionViewStep::createSummaryWidget() const
|
|||||||
widget->setLayout( mainLayout );
|
widget->setLayout( mainLayout );
|
||||||
mainLayout->setMargin( 0 );
|
mainLayout->setMargin( 0 );
|
||||||
|
|
||||||
ChoicePage::InstallChoice choice = m_choicePage->currentChoice();
|
ChoicePage::Choice choice = m_choicePage->currentChoice();
|
||||||
|
|
||||||
QFormLayout* formLayout = new QFormLayout( widget );
|
QFormLayout* formLayout = new QFormLayout( widget );
|
||||||
const int MARGIN = CalamaresUtils::defaultFontHeight() / 2;
|
const int MARGIN = CalamaresUtils::defaultFontHeight() / 2;
|
||||||
@ -287,7 +285,6 @@ PartitionViewStep::next()
|
|||||||
if ( m_choicePage->currentChoice() == ChoicePage::Manual )
|
if ( m_choicePage->currentChoice() == ChoicePage::Manual )
|
||||||
{
|
{
|
||||||
m_widget->setCurrentWidget( m_manualPartitionPage );
|
m_widget->setCurrentWidget( m_manualPartitionPage );
|
||||||
m_manualPartitionPage->selectDeviceByIndex( m_choicePage->lastSelectedDeviceIndex() );
|
|
||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
m_manualPartitionPage->onRevertClicked();
|
m_manualPartitionPage->onRevertClicked();
|
||||||
}
|
}
|
||||||
@ -317,10 +314,7 @@ void
|
|||||||
PartitionViewStep::back()
|
PartitionViewStep::back()
|
||||||
{
|
{
|
||||||
if ( m_widget->currentWidget() != m_choicePage )
|
if ( m_widget->currentWidget() != m_choicePage )
|
||||||
{
|
|
||||||
m_widget->setCurrentWidget( m_choicePage );
|
m_widget->setCurrentWidget( m_choicePage );
|
||||||
m_choicePage->setLastSelectedDeviceIndex( m_manualPartitionPage->selectedDeviceIndex() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -476,161 +470,92 @@ PartitionViewStep::onLeave()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static PartitionActions::Choices::SwapChoice
|
|
||||||
nameToChoice( QString name, bool& ok )
|
|
||||||
{
|
|
||||||
ok = false;
|
|
||||||
name = name.toLower();
|
|
||||||
|
|
||||||
using namespace PartitionActions::Choices;
|
|
||||||
|
|
||||||
// Each return here first sets ok to true, returns enum value
|
|
||||||
if ( name == QStringLiteral( "none" ) )
|
|
||||||
return( ok=true, SwapChoice::NoSwap );
|
|
||||||
else if ( name == QStringLiteral( "small" ) )
|
|
||||||
return( ok=true, SwapChoice::SmallSwap);
|
|
||||||
else if ( name == QStringLiteral( "suspend" ) )
|
|
||||||
return( ok=true, SwapChoice::FullSwap );
|
|
||||||
else if ( name == QStringLiteral( "reuse" ) )
|
|
||||||
return( ok=true, SwapChoice::ReuseSwap );
|
|
||||||
else if ( name == QStringLiteral( "file" ) )
|
|
||||||
return( ok=true, SwapChoice::SwapFile );
|
|
||||||
|
|
||||||
ok = false;
|
|
||||||
return SwapChoice::NoSwap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief translate @p defaultFS into a recognized name
|
|
||||||
*
|
|
||||||
* Makes several attempts to translate the string into a
|
|
||||||
* name that KPMCore will recognize.
|
|
||||||
*/
|
|
||||||
static QString
|
|
||||||
findFS( QString defaultFS )
|
|
||||||
{
|
|
||||||
QStringList fsLanguage { QLatin1Literal( "C" ) }; // Required language list to turn off localization
|
|
||||||
if ( defaultFS.isEmpty() )
|
|
||||||
defaultFS = QStringLiteral( "ext4" );
|
|
||||||
if ( FileSystem::typeForName( defaultFS, fsLanguage ) != FileSystem::Unknown )
|
|
||||||
{
|
|
||||||
cDebug() << "Partition-module setting *defaultFileSystemType*" << defaultFS;
|
|
||||||
return defaultFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// First pass: try the default language instead of C locale
|
|
||||||
auto fsType = FileSystem::typeForName( defaultFS );
|
|
||||||
if ( fsType != FileSystem::Unknown )
|
|
||||||
{
|
|
||||||
defaultFS = FileSystem::nameForType( fsType, fsLanguage );
|
|
||||||
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << defaultFS;
|
|
||||||
return defaultFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Second pass: try case-insensitive, both unlocalized and localized
|
|
||||||
const auto fstypes = FileSystem::types();
|
|
||||||
for ( FileSystem::Type t : fstypes )
|
|
||||||
{
|
|
||||||
if ( ( 0 == QString::compare( defaultFS, FileSystem::nameForType( t, fsLanguage ), Qt::CaseInsensitive ) ) ||
|
|
||||||
( 0 == QString::compare( defaultFS, FileSystem::nameForType( t ), Qt::CaseInsensitive ) ) )
|
|
||||||
{
|
|
||||||
defaultFS = FileSystem::nameForType( fsType, fsLanguage );
|
|
||||||
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << defaultFS;
|
|
||||||
return defaultFS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << defaultFS << ") using ext4.";
|
|
||||||
defaultFS = QStringLiteral( "ext4" );
|
|
||||||
#ifdef DEBUG_FILESYSTEMS
|
|
||||||
// This bit is for distro's debugging their settings, and shows
|
|
||||||
// all the strings that KPMCore is matching against for FS type.
|
|
||||||
{
|
|
||||||
Logger::CLog d( Logger::LOGDEBUG );
|
|
||||||
using TR = Logger::DebugRow< int, QString >;
|
|
||||||
const auto fstypes = FileSystem::types();
|
|
||||||
d << "Available types (" << fstypes.count() << ')';
|
|
||||||
for ( FileSystem::Type t : fstypes )
|
|
||||||
d << TR( static_cast<int>( t ), FileSystem::nameForType( t, fsLanguage ) );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return defaultFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
// Copy the efiSystemPartition setting to the global storage. It is needed not only in
|
// Copy the efiSystemPartition setting to the global storage. It is needed not only in
|
||||||
// the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
|
// the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
QString efiSP = CalamaresUtils::getString( configurationMap, "efiSystemPartition" );
|
if ( configurationMap.contains( "efiSystemPartition" ) &&
|
||||||
if ( efiSP.isEmpty() )
|
configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
|
||||||
efiSP = QStringLiteral( "/boot/efi" );
|
!configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
|
||||||
gs->insert( "efiSystemPartition", efiSP );
|
|
||||||
|
|
||||||
// SWAP SETTINGS
|
|
||||||
//
|
|
||||||
// This is a bit convoluted because there's legacy settings to handle as well
|
|
||||||
// as the new-style list of choices, with mapping back-and-forth.
|
|
||||||
if ( configurationMap.contains( "userSwapChoices" ) &&
|
|
||||||
( configurationMap.contains( "ensureSuspendToDisk" ) || configurationMap.contains( "neverCreateSwap" ) ) )
|
|
||||||
cError() << "Partition-module configuration mixes old- and new-style swap settings.";
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "ensureSuspendToDisk" ) )
|
|
||||||
cWarning() << "Partition-module setting *ensureSuspendToDisk* is deprecated.";
|
|
||||||
bool ensureSuspendToDisk = CalamaresUtils::getBool( configurationMap, "ensureSuspendToDisk", true );
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "neverCreateSwap" ) )
|
|
||||||
cWarning() << "Partition-module setting *neverCreateSwap* is deprecated.";
|
|
||||||
bool neverCreateSwap = CalamaresUtils::getBool( configurationMap, "neverCreateSwap", false );
|
|
||||||
|
|
||||||
QSet< PartitionActions::Choices::SwapChoice > choices; // Available swap choices
|
|
||||||
if ( configurationMap.contains( "userSwapChoices" ) )
|
|
||||||
{
|
{
|
||||||
// We've already warned about overlapping settings with the
|
gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
|
||||||
// legacy *ensureSuspendToDisk* and *neverCreateSwap*.
|
|
||||||
QStringList l = configurationMap[ "userSwapChoices" ].toStringList();
|
|
||||||
|
|
||||||
for ( const auto& item : l )
|
|
||||||
{
|
|
||||||
bool ok = false;
|
|
||||||
auto v = nameToChoice( item, ok );
|
|
||||||
if ( ok )
|
|
||||||
choices.insert( v );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( choices.isEmpty() )
|
|
||||||
{
|
|
||||||
cWarning() << "Partition-module configuration for *userSwapChoices* is empty:" << l;
|
|
||||||
choices.insert( PartitionActions::Choices::SwapChoice::FullSwap );
|
|
||||||
}
|
|
||||||
|
|
||||||
// suspend if it's one of the possible choices; suppress swap only if it's
|
|
||||||
// the **only** choice available.
|
|
||||||
ensureSuspendToDisk = choices.contains( PartitionActions::Choices::SwapChoice::FullSwap );
|
|
||||||
neverCreateSwap = ( choices.count() == 1 ) && choices.contains( PartitionActions::Choices::SwapChoice::NoSwap );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Convert the legacy settings into a single setting for now.
|
gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
|
||||||
if ( neverCreateSwap )
|
|
||||||
choices.insert( PartitionActions::Choices::SwapChoice::NoSwap );
|
|
||||||
else if ( ensureSuspendToDisk )
|
|
||||||
choices.insert( PartitionActions::Choices::SwapChoice::FullSwap );
|
|
||||||
else
|
|
||||||
choices.insert( PartitionActions::Choices::SwapChoice::SmallSwap );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// These gs settings seem to be unused (in upstream Calamares) outside of
|
if ( configurationMap.contains( "ensureSuspendToDisk" ) &&
|
||||||
// the partition module itself.
|
configurationMap.value( "ensureSuspendToDisk" ).type() == QVariant::Bool )
|
||||||
gs->insert( "ensureSuspendToDisk", ensureSuspendToDisk );
|
{
|
||||||
gs->insert( "neverCreateSwap", neverCreateSwap );
|
gs->insert( "ensureSuspendToDisk", configurationMap.value( "ensureSuspendToDisk" ).toBool() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gs->insert( "ensureSuspendToDisk", true );
|
||||||
|
}
|
||||||
|
|
||||||
// OTHER SETTINGS
|
if ( configurationMap.contains( "neverCreateSwap" ) &&
|
||||||
//
|
configurationMap.value( "neverCreateSwap" ).type() == QVariant::Bool )
|
||||||
gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) );
|
{
|
||||||
gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
|
gs->insert( "neverCreateSwap", configurationMap.value( "neverCreateSwap" ).toBool() );
|
||||||
gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
|
}
|
||||||
gs->insert( "defaultFileSystemType", findFS( CalamaresUtils::getString( configurationMap, "defaultFileSystemType" ) ) );
|
else
|
||||||
|
{
|
||||||
|
gs->insert( "neverCreateSwap", false );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "drawNestedPartitions" ) &&
|
||||||
|
configurationMap.value( "drawNestedPartitions" ).type() == QVariant::Bool )
|
||||||
|
{
|
||||||
|
gs->insert( "drawNestedPartitions",
|
||||||
|
configurationMap.value( "drawNestedPartitions", false ).toBool() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gs->insert( "drawNestedPartitions", false );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "alwaysShowPartitionLabels" ) &&
|
||||||
|
configurationMap.value( "alwaysShowPartitionLabels" ).type() == QVariant::Bool )
|
||||||
|
{
|
||||||
|
gs->insert( "alwaysShowPartitionLabels",
|
||||||
|
configurationMap.value( "alwaysShowPartitionLabels", true ).toBool() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gs->insert( "alwaysShowPartitionLabels", true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "defaultFileSystemType" ) &&
|
||||||
|
configurationMap.value( "defaultFileSystemType" ).type() == QVariant::String &&
|
||||||
|
!configurationMap.value( "defaultFileSystemType" ).toString().isEmpty() )
|
||||||
|
{
|
||||||
|
QString typeString = configurationMap.value( "defaultFileSystemType" ).toString();
|
||||||
|
gs->insert( "defaultFileSystemType", typeString );
|
||||||
|
if ( FileSystem::typeForName( typeString ) == FileSystem::Unknown )
|
||||||
|
{
|
||||||
|
cWarning() << "bad default filesystem configuration for partition module. Reverting to ext4 as default.";
|
||||||
|
gs->insert( "defaultFileSystemType", "ext4" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gs->insert( "defaultFileSystemType", QStringLiteral( "ext4" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "enableLuksAutomatedPartitioning" ) &&
|
||||||
|
configurationMap.value( "enableLuksAutomatedPartitioning" ).type() == QVariant::Bool )
|
||||||
|
{
|
||||||
|
gs->insert( "enableLuksAutomatedPartitioning",
|
||||||
|
configurationMap.value( "enableLuksAutomatedPartitioning" ).toBool() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gs->insert( "enableLuksAutomatedPartitioning", true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Now that we have the config, we load the PartitionCoreModule in the background
|
// Now that we have the config, we load the PartitionCoreModule in the background
|
||||||
@ -638,7 +563,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
// and remove the spinner.
|
// and remove the spinner.
|
||||||
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
||||||
connect( watcher, &QFutureWatcher< void >::finished,
|
connect( watcher, &QFutureWatcher< void >::finished,
|
||||||
this, [ this, watcher, choices ]
|
this, [ this, watcher ]
|
||||||
{
|
{
|
||||||
continueLoading();
|
continueLoading();
|
||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
|
@ -21,34 +21,29 @@
|
|||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "widgets/ClickableLabel.h"
|
#include "widgets/ClickableLabel.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QBoxLayout>
|
||||||
|
|
||||||
|
|
||||||
PrettyRadioButton::PrettyRadioButton( QWidget* parent )
|
PrettyRadioButton::PrettyRadioButton( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_label( new ClickableLabel )
|
|
||||||
, m_radio( new QRadioButton )
|
|
||||||
, m_mainLayout( new QGridLayout )
|
|
||||||
, m_optionsLayout( nullptr )
|
|
||||||
{
|
{
|
||||||
setLayout( m_mainLayout );
|
QHBoxLayout* mainLayout = new QHBoxLayout;
|
||||||
|
setLayout( mainLayout );
|
||||||
|
|
||||||
|
m_radio = new QRadioButton;
|
||||||
|
m_label = new ClickableLabel;
|
||||||
|
|
||||||
|
connect( m_label, &ClickableLabel::clicked,
|
||||||
|
m_radio, &QRadioButton::click );
|
||||||
m_label->setBuddy( m_radio );
|
m_label->setBuddy( m_radio );
|
||||||
|
|
||||||
m_label->setWordWrap( true );
|
m_label->setWordWrap( true );
|
||||||
m_label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
m_label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
|
||||||
m_mainLayout->addWidget( m_radio, 0, 0 );
|
mainLayout->addWidget( m_radio );
|
||||||
m_mainLayout->addWidget( m_label, 0, 1 );
|
mainLayout->addWidget( m_label );
|
||||||
m_mainLayout->setContentsMargins( 0, 0, 0, 0 );
|
mainLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
connect( m_label, &ClickableLabel::clicked,
|
|
||||||
m_radio, &QRadioButton::click );
|
|
||||||
connect( m_radio, &QRadioButton::toggled,
|
|
||||||
this, &PrettyRadioButton::toggleOptions );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,32 +80,3 @@ PrettyRadioButton::buttonWidget() const
|
|||||||
{
|
{
|
||||||
return m_radio;
|
return m_radio;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
PrettyRadioButton::addOptionsComboBox( QComboBox* box )
|
|
||||||
{
|
|
||||||
if ( !box )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( !m_optionsLayout )
|
|
||||||
{
|
|
||||||
QWidget* w = new QWidget;
|
|
||||||
m_optionsLayout = new QHBoxLayout;
|
|
||||||
m_optionsLayout->setAlignment( Qt::AlignmentFlag::AlignLeft );
|
|
||||||
m_optionsLayout->addStretch( 1 );
|
|
||||||
|
|
||||||
w->setLayout( m_optionsLayout );
|
|
||||||
m_mainLayout->addWidget( w, 1, 1 );
|
|
||||||
|
|
||||||
toggleOptions( m_radio->isChecked() );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_optionsLayout->insertWidget( m_optionsLayout->count()-1, box );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PrettyRadioButton::toggleOptions( bool toggle )
|
|
||||||
{
|
|
||||||
if ( m_optionsLayout )
|
|
||||||
m_optionsLayout->parentWidget()->setVisible( toggle );
|
|
||||||
}
|
|
||||||
|
@ -22,17 +22,7 @@
|
|||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
|
|
||||||
class ClickableLabel;
|
class ClickableLabel;
|
||||||
class QComboBox;
|
|
||||||
class QGridLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
|
|
||||||
/** @brief A radio button with fancy label next to it.
|
|
||||||
*
|
|
||||||
* The radio button itself can be retrieved with buttonWidget(),
|
|
||||||
* and the whole behaves a lot like a label. Extra options can be
|
|
||||||
* added to the display (options are hidden when the button is
|
|
||||||
* not selected) with addOptionsComboBox().
|
|
||||||
*/
|
|
||||||
class PrettyRadioButton : public QWidget
|
class PrettyRadioButton : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -50,18 +40,9 @@ public:
|
|||||||
|
|
||||||
virtual QRadioButton* buttonWidget() const;
|
virtual QRadioButton* buttonWidget() const;
|
||||||
|
|
||||||
/** @brief Add an options drop-down to this button. */
|
|
||||||
void addOptionsComboBox( QComboBox* );
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
/// Options are hidden when the radio button is off
|
|
||||||
void toggleOptions( bool checked );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ClickableLabel* m_label;
|
ClickableLabel* m_label;
|
||||||
QRadioButton* m_radio;
|
QRadioButton* m_radio;
|
||||||
QGridLayout* m_mainLayout;
|
|
||||||
QHBoxLayout* m_optionsLayout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRETTYRADIOBUTTON_H
|
#endif // PRETTYRADIOBUTTON_H
|
||||||
|
@ -85,8 +85,6 @@ ReplaceWidget::reset()
|
|||||||
void
|
void
|
||||||
ReplaceWidget::applyChanges()
|
ReplaceWidget::applyChanges()
|
||||||
{
|
{
|
||||||
auto gs = Calamares::JobQueue::instance()->globalStorage();
|
|
||||||
|
|
||||||
PartitionModel* model = qobject_cast< PartitionModel* >( m_ui->partitionTreeView->model() );
|
PartitionModel* model = qobject_cast< PartitionModel* >( m_ui->partitionTreeView->model() );
|
||||||
if ( model )
|
if ( model )
|
||||||
{
|
{
|
||||||
@ -95,9 +93,7 @@ ReplaceWidget::applyChanges()
|
|||||||
{
|
{
|
||||||
Device* dev = model->device();
|
Device* dev = model->device();
|
||||||
|
|
||||||
PartitionActions::doReplacePartition(
|
PartitionActions::doReplacePartition( m_core, dev, partition );
|
||||||
m_core, dev, partition,
|
|
||||||
{ gs->value( "defaultFileSystemType" ).toString(), QString() } );
|
|
||||||
|
|
||||||
if ( m_isEfi )
|
if ( m_isEfi )
|
||||||
{
|
{
|
||||||
@ -106,13 +102,17 @@ ReplaceWidget::applyChanges()
|
|||||||
{
|
{
|
||||||
PartitionInfo::setMountPoint(
|
PartitionInfo::setMountPoint(
|
||||||
efiSystemPartitions.first(),
|
efiSystemPartitions.first(),
|
||||||
gs->value( "efiSystemPartition" ).toString() );
|
Calamares::JobQueue::instance()->
|
||||||
|
globalStorage()->
|
||||||
|
value( "efiSystemPartition" ).toString() );
|
||||||
}
|
}
|
||||||
else if ( efiSystemPartitions.count() > 1 )
|
else if ( efiSystemPartitions.count() > 1 )
|
||||||
{
|
{
|
||||||
PartitionInfo::setMountPoint(
|
PartitionInfo::setMountPoint(
|
||||||
efiSystemPartitions.at( m_ui->bootComboBox->currentIndex() ),
|
efiSystemPartitions.at( m_ui->bootComboBox->currentIndex() ),
|
||||||
gs->value( "efiSystemPartition" ).toString() );
|
Calamares::JobQueue::instance()->
|
||||||
|
globalStorage()->
|
||||||
|
value( "efiSystemPartition" ).toString() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include "jobs/CreatePartitionTableJob.h"
|
#include "jobs/CreatePartitionTableJob.h"
|
||||||
|
|
||||||
#include "core/PartitionIterator.h"
|
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
@ -67,14 +65,6 @@ CreatePartitionTableJob::prettyStatusMessage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline QDebug&
|
|
||||||
operator <<( QDebug& s, PartitionIterator& it )
|
|
||||||
{
|
|
||||||
s << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) );
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Calamares::JobResult
|
Calamares::JobResult
|
||||||
CreatePartitionTableJob::exec()
|
CreatePartitionTableJob::exec()
|
||||||
{
|
{
|
||||||
@ -83,13 +73,7 @@ CreatePartitionTableJob::exec()
|
|||||||
|
|
||||||
PartitionTable* table = m_device->partitionTable();
|
PartitionTable* table = m_device->partitionTable();
|
||||||
cDebug() << "Creating new partition table of type" << table->typeName()
|
cDebug() << "Creating new partition table of type" << table->typeName()
|
||||||
<< ", uncommitted yet:";
|
<< ", uncommitted yet:\n" << table;
|
||||||
|
|
||||||
if ( Logger::logLevelEnabled( Logger::LOGDEBUG ) )
|
|
||||||
{
|
|
||||||
for ( auto it = PartitionIterator::begin( table );
|
|
||||||
it != PartitionIterator::end( table ); ++it )
|
|
||||||
cDebug() << *it;
|
|
||||||
|
|
||||||
QProcess lsblk;
|
QProcess lsblk;
|
||||||
lsblk.setProgram( "lsblk" );
|
lsblk.setProgram( "lsblk" );
|
||||||
@ -104,7 +88,6 @@ CreatePartitionTableJob::exec()
|
|||||||
mount.start();
|
mount.start();
|
||||||
mount.waitForFinished();
|
mount.waitForFinished();
|
||||||
cDebug() << "mount:\n" << mount.readAllStandardOutput();
|
cDebug() << "mount:\n" << mount.readAllStandardOutput();
|
||||||
}
|
|
||||||
|
|
||||||
CreatePartitionTableOperation op(*m_device, table);
|
CreatePartitionTableOperation op(*m_device, table);
|
||||||
op.setStatus(Operation::StatusRunning);
|
op.setStatus(Operation::StatusRunning);
|
||||||
|
@ -56,12 +56,9 @@ findPartitionUuids( QList < Device* > devices )
|
|||||||
QString path = p->partitionPath();
|
QString path = p->partitionPath();
|
||||||
QString uuid = p->fileSystem().readUUID( p->partitionPath() );
|
QString uuid = p->fileSystem().readUUID( p->partitionPath() );
|
||||||
hash.insert( path, uuid );
|
hash.insert( path, uuid );
|
||||||
cDebug() << ".. added path=" << path << "UUID=" << uuid;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cDebug() << hash;
|
||||||
if ( hash.isEmpty() )
|
|
||||||
cDebug() << ".. no UUIDs found.";
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,16 +90,10 @@ mapForPartition( Partition* partition, const QString& uuid )
|
|||||||
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
|
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
|
||||||
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
|
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
|
||||||
map[ "uuid" ] = uuid;
|
map[ "uuid" ] = uuid;
|
||||||
|
cDebug() << partition->partitionPath()
|
||||||
// Debugging for inside the loop in createPartitionList(),
|
<< "mtpoint:" << PartitionInfo::mountPoint( partition )
|
||||||
// so indent a bit
|
<< "fs:" << map[ "fs" ] << '(' << map[ "fsName" ] << ')'
|
||||||
Logger::CLog deb = cDebug();
|
<< uuid;
|
||||||
using TR = Logger::DebugRow<const char *const, const QString&>;
|
|
||||||
deb << " .. mapping for" << partition->partitionPath() << partition->deviceNode()
|
|
||||||
<< TR( "mtpoint:", PartitionInfo::mountPoint( partition ) )
|
|
||||||
<< TR( "fs:", map[ "fs" ].toString() )
|
|
||||||
<< TR( "fsname", map[ "fsName" ].toString() )
|
|
||||||
<< TR( "uuid", uuid );
|
|
||||||
|
|
||||||
if ( partition->roles().has( PartitionRole::Luks ) )
|
if ( partition->roles().has( PartitionRole::Luks ) )
|
||||||
{
|
{
|
||||||
@ -113,7 +104,7 @@ mapForPartition( Partition* partition, const QString& uuid )
|
|||||||
map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
|
map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
|
||||||
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
|
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
|
||||||
map[ "luksPassphrase" ] = luksFs->passphrase();
|
map[ "luksPassphrase" ] = luksFs->passphrase();
|
||||||
deb << TR( "luksMapperName:", map[ "luksMapperName" ].toString() );
|
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,11 +215,9 @@ FillGlobalStorageJob::createPartitionList() const
|
|||||||
cDebug() << "Writing to GlobalStorage[\"partitions\"]";
|
cDebug() << "Writing to GlobalStorage[\"partitions\"]";
|
||||||
for ( auto device : m_devices )
|
for ( auto device : m_devices )
|
||||||
{
|
{
|
||||||
cDebug() << ".. partitions on" << device->deviceNode();
|
|
||||||
for ( auto it = PartitionIterator::begin( device );
|
for ( auto it = PartitionIterator::begin( device );
|
||||||
it != PartitionIterator::end( device ); ++it )
|
it != PartitionIterator::end( device ); ++it )
|
||||||
{
|
{
|
||||||
// Debug-logging is done when creating the map
|
|
||||||
lst << mapForPartition( *it, hash.value( ( *it )->partitionPath() ) );
|
lst << mapForPartition( *it, hash.value( ( *it )->partitionPath() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,10 +132,6 @@ SetPartFlagsJob::prettyStatusMessage() const
|
|||||||
Calamares::JobResult
|
Calamares::JobResult
|
||||||
SetPartFlagsJob::exec()
|
SetPartFlagsJob::exec()
|
||||||
{
|
{
|
||||||
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 );
|
SetPartFlagsOperation op( *m_device, *partition(), m_flags );
|
||||||
op.setStatus( Operation::StatusRunning );
|
op.setStatus( Operation::StatusRunning );
|
||||||
|
@ -3,37 +3,22 @@
|
|||||||
# etc.) use just /boot.
|
# etc.) use just /boot.
|
||||||
efiSystemPartition: "/boot/efi"
|
efiSystemPartition: "/boot/efi"
|
||||||
|
|
||||||
# In autogenerated partitioning, allow the user to select a swap size?
|
# Make sure an autogenerated swap partition is big enough for hibernation in
|
||||||
# If there is exactly one choice, no UI is presented, and the user
|
# automated partitioning modes. Swap can be disabled through *neverCreateSwap*.
|
||||||
# cannot make a choice -- this setting is used. If there is more than
|
|
||||||
# one choice, a UI is presented.
|
|
||||||
#
|
#
|
||||||
# Legacy settings *neverCreateSwap* and *ensureSuspendToDisk* correspond
|
# When *ensureSuspendToDisk* is true, swap is never smaller than physical
|
||||||
# to values of *userSwapChoices* as follows:
|
# memory, follows the guideline 2 * memory until swap reaches 8GiB.
|
||||||
# - *neverCreateSwap* is true, means [none]
|
# When *ensureSuspendToDisk* is false, swap size scales up with memory
|
||||||
# - *neverCreateSwap* is false, *ensureSuspendToDisk* is false, [small]
|
# size until 8GiB, then at roughly half of memory size.
|
||||||
# - *neverCreateSwap* is false, *ensureSuspendToDisk* is true, [suspend]
|
|
||||||
#
|
#
|
||||||
# Autogenerated swap sizes are as follows:
|
#
|
||||||
# - *suspend*: Swap is always at least total memory size,
|
# Default is true.
|
||||||
# and up to 4GiB RAM follows the rule-of-thumb 2 * memory;
|
ensureSuspendToDisk: true
|
||||||
# from 4GiB to 8 GiB it stays steady at 8GiB, and over 8 GiB memory
|
|
||||||
# swap is the size of main memory.
|
|
||||||
# - *small*: Follows the rules above, but Swap is at
|
|
||||||
# most 8GiB, and no more than 10% of available disk.
|
|
||||||
# In both cases, a fudge factor (usually 10% extra) is applied so that there
|
|
||||||
# is some space for administrative overhead (e.g. 8 GiB swap will allocate
|
|
||||||
# 8.8GiB on disk in the end).
|
|
||||||
userSwapChoices:
|
|
||||||
- none # Create no swap, use no swap
|
|
||||||
# - reuse # Re-use existing swap, but don't create any
|
|
||||||
- small # Up to 4GB
|
|
||||||
- suspend # At least main memory size
|
|
||||||
# - file # To swap file instead of partition (unsupported right now)
|
|
||||||
|
|
||||||
# LEGACY SETTINGS (these will generate a warning)
|
# Never create swap partitions in automated partitioning modes.
|
||||||
# ensureSuspendToDisk: true
|
# If this is true, ensureSuspendToDisk is ignored.
|
||||||
# neverCreateSwap: false
|
# Default is false.
|
||||||
|
neverCreateSwap: false
|
||||||
|
|
||||||
# Correctly draw nested (e.g. logical) partitions as such.
|
# Correctly draw nested (e.g. logical) partitions as such.
|
||||||
drawNestedPartitions: false
|
drawNestedPartitions: false
|
||||||
@ -53,8 +38,6 @@ alwaysShowPartitionLabels: true
|
|||||||
#
|
#
|
||||||
# Suggested values: ext2, ext3, ext4, reiser, xfs, jfs, btrfs
|
# Suggested values: ext2, ext3, ext4, reiser, xfs, jfs, btrfs
|
||||||
# If nothing is specified, Calamares defaults to "ext4".
|
# If nothing is specified, Calamares defaults to "ext4".
|
||||||
#
|
|
||||||
# Names are case-sensitive and defined by KPMCore.
|
|
||||||
defaultFileSystemType: "ext4"
|
defaultFileSystemType: "ext4"
|
||||||
|
|
||||||
# Show/hide LUKS related functionality in automated partitioning modes.
|
# Show/hide LUKS related functionality in automated partitioning modes.
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
find_package( Qt5 COMPONENTS Gui REQUIRED )
|
find_package( Qt5 COMPONENTS Gui Test REQUIRED )
|
||||||
|
|
||||||
|
include( ECMAddTests )
|
||||||
|
|
||||||
set( PartitionModule_SOURCE_DIR .. )
|
set( PartitionModule_SOURCE_DIR .. )
|
||||||
|
|
||||||
@ -21,7 +23,6 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if( ECM_FOUND AND BUILD_TESTING )
|
|
||||||
ecm_add_test( ${partitionjobtests_SRCS}
|
ecm_add_test( ${partitionjobtests_SRCS}
|
||||||
TEST_NAME partitionjobtests
|
TEST_NAME partitionjobtests
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
@ -32,4 +33,3 @@ if( ECM_FOUND AND BUILD_TESTING )
|
|||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE )
|
set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE )
|
||||||
endif()
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2018, Philip Müller <philm@manjaro.org>
|
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -359,15 +358,7 @@ PartitionJobTests::testResizePartition()
|
|||||||
|
|
||||||
Partition* freePartition = firstFreePartition( m_device->partitionTable() );
|
Partition* freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
Partition* partition = KPMHelpers::createNewPartition(
|
Partition* partition = KPMHelpers::createNewPartition( freePartition->parent(), *m_device, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, oldFirst, oldLast );
|
||||||
freePartition->parent(),
|
|
||||||
*m_device,
|
|
||||||
PartitionRole( PartitionRole::Primary ),
|
|
||||||
FileSystem::Ext4,
|
|
||||||
oldFirst,
|
|
||||||
oldLast,
|
|
||||||
PartitionTable::FlagNone
|
|
||||||
);
|
|
||||||
CreatePartitionJob* job = new CreatePartitionJob( m_device.data(), partition );
|
CreatePartitionJob* job = new CreatePartitionJob( m_device.data(), partition );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user