Adopt upstream changes on webview and partition

- [webview] fix crash on loading webview page with QtWebengine
- [partition] Bump KPMcore dependency to 3.0.2
- [partition] Make sure to disable the root password if setRootPassword is false
- [partition] Force the correct flags for EFI system partition
- [partition] Always write bootloader path
- [partition] Do not write bootloader install path if the system is EFI
This commit is contained in:
Philip 2017-01-23 15:23:22 +01:00
parent 82243914de
commit a57b08c200
13 changed files with 72 additions and 38 deletions

View File

@ -10,7 +10,7 @@ find_package( KF5 REQUIRED CoreAddons )
# These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service # These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service ) find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
find_package( KPMcore 3.0.0 REQUIRED ) find_package( KPMcore 3.0.2 REQUIRED )
add_subdirectory( tests ) add_subdirectory( tests )

View File

@ -51,8 +51,9 @@ canBeReplaced( Partition* candidate )
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024; qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
cDebug() << "Required storage B:" << requiredStorageB cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB cDebug() << "Storage capacity B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length();
if ( ok && if ( ok &&
availableStorageB > requiredStorageB ) availableStorageB > requiredStorageB )
@ -102,7 +103,9 @@ canBeResized( Partition* candidate )
cDebug() << "Required storage B:" << requiredStorageB cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 ); << QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length()
<< " sectorsUsed:" << candidate->sectorsUsed() << " fsType:" << candidate->fileSystem().name();
if ( ok && if ( ok &&
availableStorageB > requiredStorageB ) availableStorageB > requiredStorageB )

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, Teo Mrnjavac <teo@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
@ -148,7 +148,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
->globalStorage() ->globalStorage()
->value( "efiSystemPartition" ) ->value( "efiSystemPartition" )
.toString() ); .toString() );
core->createPartition( dev, efiPartition ); core->createPartition( dev, efiPartition, PartitionTable::FlagEsp | PartitionTable::FlagBoot );
firstFreeSector = lastSector + 1; firstFreeSector = lastSector + 1;
} }
else else

View File

@ -441,6 +441,7 @@ 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 ) );
@ -596,6 +597,7 @@ PartitionCoreModule::findPartitionByMountPoint( const QString& mountPoint ) cons
void void
PartitionCoreModule::setBootLoaderInstallPath( const QString& path ) PartitionCoreModule::setBootLoaderInstallPath( const QString& path )
{ {
cDebug() << "PCM::setBootLoaderInstallPath" << path;
m_bootLoaderInstallPath = path; m_bootLoaderInstallPath = path;
} }

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, Teo Mrnjavac <teo@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
@ -565,8 +565,20 @@ ChoicePage::onLeave()
} }
else // installPath is then passed to the bootloader module for MBR setup else // installPath is then passed to the bootloader module for MBR setup
{ {
if ( m_bootloaderComboBox.isNull() ) if ( !m_isEfi )
m_core->setBootLoaderInstallPath( selectedDevice()->deviceNode() ); {
if ( m_bootloaderComboBox.isNull() )
{
m_core->setBootLoaderInstallPath( selectedDevice()->deviceNode() );
}
else
{
QVariant var = m_bootloaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole );
if ( !var.isValid() )
return;
m_core->setBootLoaderInstallPath( var.toString() );
}
}
} }
} }

View File

@ -263,12 +263,15 @@ CreatePartitionDialog::checkMountPointSelection()
{ {
const QString& selection = m_ui->mountPointComboBox->currentText(); const QString& selection = m_ui->mountPointComboBox->currentText();
if (m_usedMountPoints.contains(selection)) { if ( m_usedMountPoints.contains( selection ) )
m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one."); {
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
} else { m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
}
else
{
m_ui->labelMountPoint->setText( QString() ); m_ui->labelMountPoint->setText( QString() );
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( true );
} }
} }

View File

@ -167,11 +167,6 @@
</item> </item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QLabel" name="labelMountPoint"> <widget class="QLabel" name="labelMountPoint">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -67,7 +67,8 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox ); m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) ); m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) );
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &EditExistingPartitionDialog::checkMountPointSelection ); connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged,
this, &EditExistingPartitionDialog::checkMountPointSelection );
replacePartResizerWidget(); replacePartResizerWidget();
@ -300,11 +301,14 @@ EditExistingPartitionDialog::checkMountPointSelection()
{ {
const QString& selection = m_ui->mountPointComboBox->currentText(); const QString& selection = m_ui->mountPointComboBox->currentText();
if (m_usedMountPoints.contains(selection)) { if ( m_usedMountPoints.contains( selection ) )
m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one."); {
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
} else { m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
}
else
{
m_ui->labelMountPoint->setText( QString() ); m_ui->labelMountPoint->setText( QString() );
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( true );
} }
} }

View File

@ -161,11 +161,6 @@
</item> </item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QLabel" name="labelMountPoint"> <widget class="QLabel" name="labelMountPoint">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -57,7 +57,10 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
, m_ui( new Ui_PartitionPage ) , m_ui( new Ui_PartitionPage )
, m_lastSelectedBootLoaderIndex(-1) , m_lastSelectedBootLoaderIndex(-1)
, m_core( core ) , m_core( core )
, m_isEfi( false )
{ {
m_isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
m_ui->setupUi( this ); m_ui->setupUi( this );
m_ui->partitionLabelsView->setVisible( m_ui->partitionLabelsView->setVisible(
Calamares::JobQueue::instance()->globalStorage()-> Calamares::JobQueue::instance()->globalStorage()->
@ -100,7 +103,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
connect( m_ui->editButton, &QAbstractButton::clicked, this, &PartitionPage::onEditClicked ); connect( m_ui->editButton, &QAbstractButton::clicked, this, &PartitionPage::onEditClicked );
connect( m_ui->deleteButton, &QAbstractButton::clicked, this, &PartitionPage::onDeleteClicked ); connect( m_ui->deleteButton, &QAbstractButton::clicked, this, &PartitionPage::onDeleteClicked );
if ( QDir( "/sys/firmware/efi/efivars" ).exists() ) { if ( m_isEfi ) {
m_ui->bootLoaderComboBox->hide(); m_ui->bootLoaderComboBox->hide();
m_ui->label_3->hide(); m_ui->label_3->hide();
} }
@ -177,7 +180,10 @@ PartitionPage::onCreateClicked()
Partition* partition = model->partitionForIndex( index ); Partition* partition = model->partitionForIndex( index );
Q_ASSERT( partition ); Q_ASSERT( partition );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( model->device(), partition->parent(), getCurrentUsedMountpoints(), this ); QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( model->device(),
partition->parent(),
getCurrentUsedMountpoints(),
this );
dlg->initFromFreeSpace( partition ); dlg->initFromFreeSpace( partition );
if ( dlg->exec() == QDialog::Accepted ) if ( dlg->exec() == QDialog::Accepted )
{ {
@ -269,7 +275,10 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
QStringList mountPoints = getCurrentUsedMountpoints(); QStringList mountPoints = getCurrentUsedMountpoints();
mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); mountPoints.removeOne( PartitionInfo::mountPoint( partition ) );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( device, partition->parent(), mountPoints, this ); QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( device,
partition->parent(),
mountPoints,
this );
dlg->initFromPartitionToCreate( partition ); dlg->initFromPartitionToCreate( partition );
if ( dlg->exec() == QDialog::Accepted ) if ( dlg->exec() == QDialog::Accepted )
{ {
@ -295,9 +304,13 @@ PartitionPage::editExistingPartition( Device* device, Partition* partition )
void void
PartitionPage::updateBootLoaderInstallPath() PartitionPage::updateBootLoaderInstallPath()
{ {
if ( m_isEfi || !m_ui->bootLoaderComboBox->isVisible() )
return;
QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole ); QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole );
if ( !var.isValid() ) if ( !var.isValid() )
return; return;
qDebug() << "PartitionPage::updateBootLoaderInstallPath" << var.toString();
m_core->setBootLoaderInstallPath( var.toString() ); m_core->setBootLoaderInstallPath( var.toString() );
} }
@ -386,19 +399,19 @@ PartitionPage::updateBootLoaderIndex()
QStringList QStringList
PartitionPage::getCurrentUsedMountpoints() PartitionPage::getCurrentUsedMountpoints()
{ {
QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); QModelIndex index = m_core->deviceModel()->index(
m_ui->deviceComboBox->currentIndex(), 0 );
if ( !index.isValid() ) if ( !index.isValid() )
return QStringList(); return QStringList();
Device* device = m_core->deviceModel()->deviceForIndex( index ); Device* device = m_core->deviceModel()->deviceForIndex( index );
QStringList mountPoints; QStringList mountPoints;
for (Partition* partition : device->partitionTable()->children()) { for ( Partition* partition : device->partitionTable()->children() )
{
const QString& mountPoint = PartitionInfo::mountPoint( partition ); const QString& mountPoint = PartitionInfo::mountPoint( partition );
if ( !mountPoint.isEmpty() )
if (!mountPoint.isEmpty()) {
mountPoints << mountPoint; mountPoints << mountPoint;
}
} }
return mountPoints; return mountPoints;

View File

@ -66,6 +66,7 @@ private:
QMutex m_revertMutex; QMutex m_revertMutex;
int m_lastSelectedBootLoaderIndex; int m_lastSelectedBootLoaderIndex;
bool m_isEfi;
}; };
#endif // PARTITIONPAGE_H #endif // PARTITIONPAGE_H

View File

@ -198,10 +198,12 @@ FillGlobalStorageJob::exec()
QVariant var = createBootLoaderMap(); QVariant var = createBootLoaderMap();
if ( !var.isValid() ) if ( !var.isValid() )
cDebug() << "Failed to find path for boot loader"; cDebug() << "Failed to find path for boot loader";
cDebug() << "FillGlobalStorageJob writing bootLoader path:" << var;
storage->insert( "bootLoader", var ); storage->insert( "bootLoader", var );
} }
else else
{ {
cDebug() << "FillGlobalStorageJob writing empty bootLoader value";
storage->insert( "bootLoader", QVariant() ); storage->insert( "bootLoader", QVariant() );
} }
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();

View File

@ -25,6 +25,7 @@
#include <QWebView> #include <QWebView>
#else #else
#include <QWebEngineView> #include <QWebEngineView>
#include <QtWebEngine>
#endif #endif
CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); )
@ -33,6 +34,9 @@ WebViewStep::WebViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
{ {
emit nextStatusChanged( true ); emit nextStatusChanged( true );
#ifdef WEBVIEW_WITH_WEBENGINE
QtWebEngine::initialize();
#endif
m_view = new C_QWEBVIEW(); m_view = new C_QWEBVIEW();
#ifdef WEBVIEW_WITH_WEBKIT #ifdef WEBVIEW_WITH_WEBKIT
m_view->settings()->setFontFamily( QWebSettings::StandardFont, m_view->settings()->setFontFamily( QWebSettings::StandardFont,