Merge branch 'demmm-master'

FIXES #1354
FIXES #1339

Might be a bit annoying, so there's a TODO to detect yes-i-already-have-
GPT-on-this-BIOS-system.
This commit is contained in:
Adriaan de Groot 2020-03-24 22:35:19 +01:00
commit ec800e4219
2 changed files with 141 additions and 82 deletions

View File

@ -6,6 +6,7 @@ website will have to do for older versions.
# 3.2.21 (unreleased) # # 3.2.21 (unreleased) #
This release contains contributions from (alphabetically by first name): This release contains contributions from (alphabetically by first name):
- Anke Boersma
- Camilo Higuita - Camilo Higuita
- Gabriel Craciunescu - Gabriel Craciunescu
- Gaël PORTAY - Gaël PORTAY

View File

@ -2,8 +2,9 @@
* *
* 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-2019, Adriaan de Groot <groot@kde.org> * Copyright 2018-2019, 2020, Adriaan de Groot <groot@kde.org>
* Copyright 2019, Collabora Ltd <arnaud.ferraris@collabora.com> * Copyright 2019, Collabora Ltd <arnaud.ferraris@collabora.com>
* Copyright 2020, Anke Boersma <demm@kaosx.us
* *
* 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,23 +23,22 @@
#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/PartitionModel.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "core/OsproberEntry.h" #include "core/OsproberEntry.h"
#include "core/PartUtils.h" #include "core/PartUtils.h"
#include "core/PartitionActions.h"
#include "core/PartitionCoreModule.h"
#include "core/PartitionModel.h"
#include "gui/ChoicePage.h" #include "gui/ChoicePage.h"
#include "gui/PartitionPage.h"
#include "gui/PartitionBarsView.h" #include "gui/PartitionBarsView.h"
#include "gui/PartitionLabelsView.h" #include "gui/PartitionLabelsView.h"
#include "gui/PartitionPage.h"
#include "Branding.h" #include "Branding.h"
#include "CalamaresVersion.h" #include "CalamaresVersion.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "Job.h" #include "Job.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NamedEnum.h" #include "utils/NamedEnum.h"
@ -51,17 +51,16 @@
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
#include <kpmcore/fs/filesystem.h> #include <kpmcore/fs/filesystem.h>
// Qt
#include <QApplication> #include <QApplication>
#include <QDir> #include <QDir>
#include <QFormLayout> #include <QFormLayout>
#include <QFutureWatcher>
#include <QLabel> #include <QLabel>
#include <QMessageBox> #include <QMessageBox>
#include <QProcess> #include <QProcess>
#include <QStackedWidget> #include <QStackedWidget>
#include <QTimer> #include <QTimer>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include <QFutureWatcher>
PartitionViewStep::PartitionViewStep( QObject* parent ) PartitionViewStep::PartitionViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
@ -77,7 +76,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_widget->addWidget( m_waitingWidget ); m_widget->addWidget( m_waitingWidget );
CALAMARES_RETRANSLATE( m_waitingWidget->setText( tr( "Gathering system information..." ) ); ) CALAMARES_RETRANSLATE( m_waitingWidget->setText( tr( "Gathering system information..." ) ); )
m_core = new PartitionCoreModule( this ); // Unusable before init is complete! m_core = new PartitionCoreModule( this ); // Unusable before init is complete!
// We're not done loading, but we need the configuration map first. // We're not done loading, but we need the configuration map first.
} }
@ -108,19 +107,21 @@ PartitionViewStep::continueLoading()
m_waitingWidget->deleteLater(); m_waitingWidget->deleteLater();
m_waitingWidget = nullptr; m_waitingWidget = nullptr;
connect( m_core, &PartitionCoreModule::hasRootMountPointChanged, connect( m_core, &PartitionCoreModule::hasRootMountPointChanged, this, &PartitionViewStep::nextStatusChanged );
this, &PartitionViewStep::nextStatusChanged ); connect( m_choicePage, &ChoicePage::nextStatusChanged, this, &PartitionViewStep::nextStatusChanged );
connect( m_choicePage, &ChoicePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
} }
PartitionViewStep::~PartitionViewStep() PartitionViewStep::~PartitionViewStep()
{ {
if ( m_choicePage && m_choicePage->parent() == nullptr ) if ( m_choicePage && m_choicePage->parent() == nullptr )
{
m_choicePage->deleteLater(); m_choicePage->deleteLater();
}
if ( m_manualPartitionPage && m_manualPartitionPage->parent() == nullptr ) if ( m_manualPartitionPage && m_manualPartitionPage->parent() == nullptr )
{
m_manualPartitionPage->deleteLater(); m_manualPartitionPage->deleteLater();
}
} }
@ -154,7 +155,7 @@ PartitionViewStep::createSummaryWidget() const
mainLayout->addLayout( formLayout ); mainLayout->addLayout( formLayout );
QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo(); QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
if ( list.length() > 1 ) // There are changes on more than one disk if ( list.length() > 1 ) // There are changes on more than one disk
{ {
//NOTE: all of this should only happen when Manual partitioning is active. //NOTE: all of this should only happen when Manual partitioning is active.
// Any other choice should result in a list.length() == 1. // Any other choice should result in a list.length() == 1.
@ -165,15 +166,15 @@ PartitionViewStep::createSummaryWidget() const
{ {
case ChoicePage::Alongside: case ChoicePage::Alongside:
modeText = tr( "Install %1 <strong>alongside</strong> another operating system." ) modeText = tr( "Install %1 <strong>alongside</strong> another operating system." )
.arg( *Calamares::Branding::ShortVersionedName ); .arg( *Calamares::Branding::ShortVersionedName );
break; break;
case ChoicePage::Erase: case ChoicePage::Erase:
modeText = tr( "<strong>Erase</strong> disk and install %1." ) modeText
.arg( *Calamares::Branding::ShortVersionedName ); = tr( "<strong>Erase</strong> disk and install %1." ).arg( *Calamares::Branding::ShortVersionedName );
break; break;
case ChoicePage::Replace: case ChoicePage::Replace:
modeText = tr( "<strong>Replace</strong> a partition with %1." ) modeText
.arg( *Calamares::Branding::ShortVersionedName ); = tr( "<strong>Replace</strong> a partition with %1." ).arg( *Calamares::Branding::ShortVersionedName );
break; break;
case ChoicePage::NoChoice: case ChoicePage::NoChoice:
case ChoicePage::Manual: case ChoicePage::Manual:
@ -184,42 +185,42 @@ PartitionViewStep::createSummaryWidget() const
for ( const auto& info : list ) for ( const auto& info : list )
{ {
QLabel* diskInfoLabel = new QLabel; QLabel* diskInfoLabel = new QLabel;
if ( list.length() == 1 ) // this is the only disk preview if ( list.length() == 1 ) // this is the only disk preview
{ {
QString modeText; QString modeText;
switch ( choice ) switch ( choice )
{ {
case ChoicePage::Alongside: case ChoicePage::Alongside:
modeText = tr( "Install %1 <strong>alongside</strong> another operating system on disk <strong>%2</strong> (%3)." ) modeText = tr( "Install %1 <strong>alongside</strong> another operating system on disk "
.arg( *Calamares::Branding::ShortVersionedName ) "<strong>%2</strong> (%3)." )
.arg( info.deviceNode ) .arg( *Calamares::Branding::ShortVersionedName )
.arg( info.deviceName ); .arg( info.deviceNode )
.arg( info.deviceName );
break; break;
case ChoicePage::Erase: case ChoicePage::Erase:
modeText = tr( "<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." ) modeText = tr( "<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." )
.arg( *Calamares::Branding::ShortVersionedName ) .arg( *Calamares::Branding::ShortVersionedName )
.arg( info.deviceNode ) .arg( info.deviceNode )
.arg( info.deviceName ); .arg( info.deviceName );
break; break;
case ChoicePage::Replace: case ChoicePage::Replace:
modeText = tr( "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." ) modeText = tr( "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." )
.arg( *Calamares::Branding::ShortVersionedName ) .arg( *Calamares::Branding::ShortVersionedName )
.arg( info.deviceNode ) .arg( info.deviceNode )
.arg( info.deviceName ); .arg( info.deviceName );
break; break;
case ChoicePage::NoChoice: case ChoicePage::NoChoice:
case ChoicePage::Manual: case ChoicePage::Manual:
modeText = tr( "<strong>Manual</strong> partitioning on disk <strong>%1</strong> (%2)." ) modeText = tr( "<strong>Manual</strong> partitioning on disk <strong>%1</strong> (%2)." )
.arg( info.deviceNode ) .arg( info.deviceNode )
.arg( info.deviceName ); .arg( info.deviceName );
} }
diskInfoLabel->setText( modeText ); diskInfoLabel->setText( modeText );
} }
else // multiple disk previews! else // multiple disk previews!
{ {
diskInfoLabel->setText( tr( "Disk <strong>%1</strong> (%2)" ) diskInfoLabel->setText(
.arg( info.deviceNode ) tr( "Disk <strong>%1</strong> (%2)" ).arg( info.deviceNode ).arg( info.deviceName ) );
.arg( info.deviceName ) );
} }
formLayout->addRow( diskInfoLabel ); formLayout->addRow( diskInfoLabel );
@ -227,10 +228,10 @@ PartitionViewStep::createSummaryWidget() const
PartitionLabelsView* previewLabels; PartitionLabelsView* previewLabels;
QVBoxLayout* field; QVBoxLayout* field;
PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()-> PartitionBarsView::NestedPartitionsMode mode
value( "drawNestedPartitions" ).toBool() ? = Calamares::JobQueue::instance()->globalStorage()->value( "drawNestedPartitions" ).toBool()
PartitionBarsView::DrawNestedPartitions : ? PartitionBarsView::DrawNestedPartitions
PartitionBarsView::NoNestedPartitions; : PartitionBarsView::NoNestedPartitions;
preview = new PartitionBarsView; preview = new PartitionBarsView;
preview->setNestedPartitionsMode( mode ); preview->setNestedPartitionsMode( mode );
previewLabels = new PartitionLabelsView; previewLabels = new PartitionLabelsView;
@ -268,7 +269,9 @@ PartitionViewStep::createSummaryWidget() const
foreach ( const Calamares::job_ptr& job, jobs() ) foreach ( const Calamares::job_ptr& job, jobs() )
{ {
if ( !job->prettyDescription().isEmpty() ) if ( !job->prettyDescription().isEmpty() )
{
jobsLines.append( job->prettyDescription() ); jobsLines.append( job->prettyDescription() );
}
} }
if ( !jobsLines.isEmpty() ) if ( !jobsLines.isEmpty() )
{ {
@ -301,7 +304,9 @@ PartitionViewStep::next()
m_widget->setCurrentWidget( m_manualPartitionPage ); m_widget->setCurrentWidget( m_manualPartitionPage );
m_manualPartitionPage->selectDeviceByIndex( m_choicePage->lastSelectedDeviceIndex() ); m_manualPartitionPage->selectDeviceByIndex( m_choicePage->lastSelectedDeviceIndex() );
if ( m_core->isDirty() ) if ( m_core->isDirty() )
{
m_manualPartitionPage->onRevertClicked(); m_manualPartitionPage->onRevertClicked();
}
} }
cDebug() << "Choice applied: " << m_choicePage->currentChoice(); cDebug() << "Choice applied: " << m_choicePage->currentChoice();
} }
@ -329,10 +334,14 @@ bool
PartitionViewStep::isNextEnabled() const PartitionViewStep::isNextEnabled() const
{ {
if ( m_choicePage && m_widget->currentWidget() == m_choicePage ) if ( m_choicePage && m_widget->currentWidget() == m_choicePage )
{
return m_choicePage->isNextEnabled(); return m_choicePage->isNextEnabled();
}
if ( m_manualPartitionPage && m_widget->currentWidget() == m_manualPartitionPage ) if ( m_manualPartitionPage && m_widget->currentWidget() == m_manualPartitionPage )
{
return m_core->hasRootMountPoint(); return m_core->hasRootMountPoint();
}
return false; return false;
} }
@ -349,7 +358,9 @@ bool
PartitionViewStep::isAtBeginning() const PartitionViewStep::isAtBeginning() const
{ {
if ( m_widget->currentWidget() != m_choicePage ) if ( m_widget->currentWidget() != m_choicePage )
{
return false; return false;
}
return true; return true;
} }
@ -359,10 +370,11 @@ PartitionViewStep::isAtEnd() const
{ {
if ( m_widget->currentWidget() == m_choicePage ) if ( m_widget->currentWidget() == m_choicePage )
{ {
if ( m_choicePage->currentChoice() == ChoicePage::Erase || if ( m_choicePage->currentChoice() == ChoicePage::Erase || m_choicePage->currentChoice() == ChoicePage::Replace
m_choicePage->currentChoice() == ChoicePage::Replace || || m_choicePage->currentChoice() == ChoicePage::Alongside )
m_choicePage->currentChoice() == ChoicePage::Alongside ) {
return true; return true;
}
return false; return false;
} }
return true; return true;
@ -381,11 +393,10 @@ PartitionViewStep::onActivate()
} }
// if we're coming back to PVS from the next VS // if we're coming back to PVS from the next VS
if ( m_widget->currentWidget() == m_choicePage && if ( m_widget->currentWidget() == m_choicePage && m_choicePage->currentChoice() == ChoicePage::Alongside )
m_choicePage->currentChoice() == ChoicePage::Alongside )
{ {
m_choicePage->applyActionChoice( ChoicePage::Alongside ); m_choicePage->applyActionChoice( ChoicePage::Alongside );
// m_choicePage->reset(); // m_choicePage->reset();
//FIXME: ReplaceWidget should be reset maybe? //FIXME: ReplaceWidget should be reset maybe?
} }
} }
@ -404,8 +415,8 @@ PartitionViewStep::onLeave()
{ {
if ( PartUtils::isEfiSystem() ) if ( PartUtils::isEfiSystem() )
{ {
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()-> QString espMountPoint
value( "efiSystemPartition" ).toString(); = Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
Partition* esp = m_core->findPartitionByMountPoint( espMountPoint ); Partition* esp = m_core->findPartitionByMountPoint( espMountPoint );
QString message; QString message;
@ -421,8 +432,8 @@ PartitionViewStep::onLeave()
"<strong>%2</strong>.<br/><br/>" "<strong>%2</strong>.<br/><br/>"
"You can continue without setting up an EFI system " "You can continue without setting up an EFI system "
"partition but your system may fail to start." ) "partition but your system may fail to start." )
.arg( *Calamares::Branding::ShortProductName ) .arg( *Calamares::Branding::ShortProductName )
.arg( espMountPoint ); .arg( espMountPoint );
} }
else if ( esp && !PartUtils::isEfiBootable( esp ) ) else if ( esp && !PartUtils::isEfiBootable( esp ) )
{ {
@ -436,18 +447,39 @@ PartitionViewStep::onLeave()
"<br/><br/>" "<br/><br/>"
"You can continue without setting the flag but your " "You can continue without setting the flag but your "
"system may fail to start." ) "system may fail to start." )
.arg( *Calamares::Branding::ShortProductName ) .arg( *Calamares::Branding::ShortProductName )
.arg( espMountPoint ); .arg( espMountPoint );
} }
if ( !message.isEmpty() ) if ( !message.isEmpty() )
{ {
cWarning() << message; cWarning() << message;
QMessageBox::warning( m_manualPartitionPage, QMessageBox::warning( m_manualPartitionPage, message, description );
message,
description );
} }
} }
else
{
cDebug() << "device: BIOS";
// TODO: this *always* warns, which might be annoying, so it'd be
// best to find a way to detect that bios_grub partition.
QString message = tr( "Option to use GPT on BIOS" );
QString description = tr( "A GPT partition table is the best option for all "
"systems. This installer supports such a setup for "
"BIOS systems too."
"<br/><br/>"
"To configure a GPT partition table on BIOS, "
"(if not done so already) go back "
"and set the partion table to GPT, next create a 8 MB "
"unformatted partition with the "
"<strong>bios_grub</strong> flag enabled.<br/><br/>"
"An unformatted 8 MB partition is necessary "
"to start %1 on a BIOS system with GPT." )
.arg( *Calamares::Branding::ShortProductName );
QMessageBox::information( m_manualPartitionPage, message, description );
}
Partition* root_p = m_core->findPartitionByMountPoint( "/" ); Partition* root_p = m_core->findPartitionByMountPoint( "/" );
Partition* boot_p = m_core->findPartitionByMountPoint( "/boot" ); Partition* boot_p = m_core->findPartitionByMountPoint( "/boot" );
@ -459,8 +491,7 @@ PartitionViewStep::onLeave()
// If the root partition is encrypted, and there's a separate boot // If the root partition is encrypted, and there's a separate boot
// partition which is not encrypted // partition which is not encrypted
if ( root_p->fileSystem().type() == FileSystem::Luks && if ( root_p->fileSystem().type() == FileSystem::Luks && boot_p->fileSystem().type() != FileSystem::Luks )
boot_p->fileSystem().type() != FileSystem::Luks )
{ {
message = tr( "Boot partition not encrypted" ); message = tr( "Boot partition not encrypted" );
description = tr( "A separate boot partition was set up together with " description = tr( "A separate boot partition was set up together with "
@ -476,9 +507,7 @@ PartitionViewStep::onLeave()
"recreate it, selecting <strong>Encrypt</strong> " "recreate it, selecting <strong>Encrypt</strong> "
"in the partition creation window." ); "in the partition creation window." );
QMessageBox::warning( m_manualPartitionPage, QMessageBox::warning( m_manualPartitionPage, message, description );
message,
description );
} }
} }
} }
@ -493,7 +522,9 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QString efiSP = CalamaresUtils::getString( configurationMap, "efiSystemPartition" ); QString efiSP = CalamaresUtils::getString( configurationMap, "efiSystemPartition" );
if ( efiSP.isEmpty() ) if ( efiSP.isEmpty() )
{
efiSP = QStringLiteral( "/boot/efi" ); efiSP = QStringLiteral( "/boot/efi" );
}
gs->insert( "efiSystemPartition", efiSP ); gs->insert( "efiSystemPartition", efiSP );
// Set up firmwareType global storage entry. This is used, e.g. by the bootloader module. // Set up firmwareType global storage entry. This is used, e.g. by the bootloader module.
@ -511,16 +542,22 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
// //
// This is a bit convoluted because there's legacy settings to handle as well // 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. // as the new-style list of choices, with mapping back-and-forth.
if ( configurationMap.contains( "userSwapChoices" ) && if ( configurationMap.contains( "userSwapChoices" )
( configurationMap.contains( "ensureSuspendToDisk" ) || configurationMap.contains( "neverCreateSwap" ) ) ) && ( configurationMap.contains( "ensureSuspendToDisk" ) || configurationMap.contains( "neverCreateSwap" ) ) )
{
cError() << "Partition-module configuration mixes old- and new-style swap settings."; cError() << "Partition-module configuration mixes old- and new-style swap settings.";
}
if ( configurationMap.contains( "ensureSuspendToDisk" ) ) if ( configurationMap.contains( "ensureSuspendToDisk" ) )
{
cWarning() << "Partition-module setting *ensureSuspendToDisk* is deprecated."; cWarning() << "Partition-module setting *ensureSuspendToDisk* is deprecated.";
}
bool ensureSuspendToDisk = CalamaresUtils::getBool( configurationMap, "ensureSuspendToDisk", true ); bool ensureSuspendToDisk = CalamaresUtils::getBool( configurationMap, "ensureSuspendToDisk", true );
if ( configurationMap.contains( "neverCreateSwap" ) ) if ( configurationMap.contains( "neverCreateSwap" ) )
{
cWarning() << "Partition-module setting *neverCreateSwap* is deprecated."; cWarning() << "Partition-module setting *neverCreateSwap* is deprecated.";
}
bool neverCreateSwap = CalamaresUtils::getBool( configurationMap, "neverCreateSwap", false ); bool neverCreateSwap = CalamaresUtils::getBool( configurationMap, "neverCreateSwap", false );
QSet< PartitionActions::Choices::SwapChoice > choices; // Available swap choices QSet< PartitionActions::Choices::SwapChoice > choices; // Available swap choices
@ -535,7 +572,9 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
bool ok = false; bool ok = false;
auto v = PartitionActions::Choices::nameToChoice( item, ok ); auto v = PartitionActions::Choices::nameToChoice( item, ok );
if ( ok ) if ( ok )
{
choices.insert( v ); choices.insert( v );
}
} }
if ( choices.isEmpty() ) if ( choices.isEmpty() )
@ -553,19 +592,28 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
// Convert the legacy settings into a single setting for now. // Convert the legacy settings into a single setting for now.
if ( neverCreateSwap ) if ( neverCreateSwap )
{
choices.insert( PartitionActions::Choices::SwapChoice::NoSwap ); choices.insert( PartitionActions::Choices::SwapChoice::NoSwap );
}
else if ( ensureSuspendToDisk ) else if ( ensureSuspendToDisk )
{
choices.insert( PartitionActions::Choices::SwapChoice::FullSwap ); choices.insert( PartitionActions::Choices::SwapChoice::FullSwap );
}
else else
{
choices.insert( PartitionActions::Choices::SwapChoice::SmallSwap ); choices.insert( PartitionActions::Choices::SwapChoice::SmallSwap );
}
} }
// Not all are supported right now // FIXME // Not all are supported right now // FIXME
static const char unsupportedSetting[] = "Partition-module does not support *userSwapChoices* setting"; static const char unsupportedSetting[] = "Partition-module does not support *userSwapChoices* setting";
#define COMPLAIN_UNSUPPORTED(x) \ #define COMPLAIN_UNSUPPORTED( x ) \
if ( choices.contains( x ) ) \ if ( choices.contains( x ) ) \
{ cWarning() << unsupportedSetting << PartitionActions::Choices::choiceToName( x ); choices.remove( x ); } { \
cWarning() << unsupportedSetting << PartitionActions::Choices::choiceToName( x ); \
choices.remove( x ); \
}
COMPLAIN_UNSUPPORTED( PartitionActions::Choices::SwapChoice::SwapFile ) COMPLAIN_UNSUPPORTED( PartitionActions::Choices::SwapChoice::SwapFile )
COMPLAIN_UNSUPPORTED( PartitionActions::Choices::SwapChoice::ReuseSwap ) COMPLAIN_UNSUPPORTED( PartitionActions::Choices::SwapChoice::ReuseSwap )
@ -584,23 +632,35 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
// OTHER SETTINGS // OTHER SETTINGS
// //
gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) ); gs->insert( "drawNestedPartitions", CalamaresUtils::getBool( configurationMap, "drawNestedPartitions", false ) );
gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) ); gs->insert( "alwaysShowPartitionLabels",
gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) ); CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
gs->insert( "allowManualPartitioning", CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) ); gs->insert( "enableLuksAutomatedPartitioning",
CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
gs->insert( "allowManualPartitioning",
CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
// The defaultFileSystemType setting needs a bit more processing, // The defaultFileSystemType setting needs a bit more processing,
// as we want to cover various cases (such as different cases) // as we want to cover various cases (such as different cases)
QString fsName = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" ); QString fsName = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" );
FileSystem::Type fsType; FileSystem::Type fsType;
if ( fsName.isEmpty() ) if ( fsName.isEmpty() )
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4"; {
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4";
}
QString fsRealName = PartUtils::findFS( fsName, &fsType ); QString fsRealName = PartUtils::findFS( fsName, &fsType );
if ( fsRealName == fsName ) if ( fsRealName == fsName )
{
cDebug() << "Partition-module setting *defaultFileSystemType*" << fsRealName; cDebug() << "Partition-module setting *defaultFileSystemType*" << fsRealName;
}
else if ( fsType != FileSystem::Unknown ) else if ( fsType != FileSystem::Unknown )
{
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << fsRealName; cWarning() << "Partition-module setting *defaultFileSystemType* changed" << fsRealName;
}
else else
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName << ") using" << fsRealName << "instead."; {
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName << ") using" << fsRealName
<< "instead.";
}
gs->insert( "defaultFileSystemType", fsRealName ); gs->insert( "defaultFileSystemType", fsRealName );
@ -608,21 +668,18 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
// because it could take a while. Then when it's done, we can set up the widgets // because it could take a while. Then when it's done, we can set up the widgets
// and remove the spinner. // and remove the spinner.
m_future = new QFutureWatcher< void >(); m_future = new QFutureWatcher< void >();
connect( m_future, &QFutureWatcher< void >::finished, connect( m_future, &QFutureWatcher< void >::finished, this, [this] {
this, [ this ]
{
continueLoading(); continueLoading();
this->m_future->deleteLater(); this->m_future->deleteLater();
this->m_future = nullptr; this->m_future = nullptr;
} ); } );
QFuture< void > future = QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
m_future->setFuture( future ); m_future->setFuture( future );
if ( configurationMap.contains( "partitionLayout" ) ) if ( configurationMap.contains( "partitionLayout" ) )
{ {
m_core->initLayout( configurationMap.values( "partitionLayout" ).at(0).toList() ); m_core->initLayout( configurationMap.values( "partitionLayout" ).at( 0 ).toList() );
} }
else else
{ {
@ -641,19 +698,20 @@ Calamares::RequirementsList
PartitionViewStep::checkRequirements() PartitionViewStep::checkRequirements()
{ {
if ( m_future ) if ( m_future )
{
m_future->waitForFinished(); m_future->waitForFinished();
}
Calamares::RequirementsList l; Calamares::RequirementsList l;
l.append( l.append( {
{
QLatin1String( "partitions" ), QLatin1String( "partitions" ),
[]{ return tr( "has at least one disk device available." ); }, [] { return tr( "has at least one disk device available." ); },
[]{ return tr( "There are no partitions to install on." ); }, [] { return tr( "There are no partitions to install on." ); },
m_core->deviceModel()->rowCount() > 0, // satisfied m_core->deviceModel()->rowCount() > 0, // satisfied
#ifdef DEBUG_PARTITION_UNSAFE #ifdef DEBUG_PARTITION_UNSAFE
false // optional false // optional
#else #else
true // required true // required
#endif #endif
} ); } );
@ -661,4 +719,4 @@ PartitionViewStep::checkRequirements()
} }
CALAMARES_PLUGIN_FACTORY_DEFINITION( PartitionViewStepFactory, registerPlugin<PartitionViewStep>(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( PartitionViewStepFactory, registerPlugin< PartitionViewStep >(); )