Refactor check for EFI system.
The TODO stands, to delegate this to KPMCore.
This commit is contained in:
parent
e6e1324353
commit
3b15884f83
@ -151,7 +151,7 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FstabEntryList
|
static FstabEntryList
|
||||||
lookForFstabEntries( const QString& partitionPath )
|
lookForFstabEntries( const QString& partitionPath )
|
||||||
{
|
{
|
||||||
FstabEntryList fstabEntries;
|
FstabEntryList fstabEntries;
|
||||||
@ -195,7 +195,7 @@ lookForFstabEntries( const QString& partitionPath )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
static QString
|
||||||
findPartitionPathForMountPoint( const FstabEntryList& fstab,
|
findPartitionPathForMountPoint( const FstabEntryList& fstab,
|
||||||
const QString& mountPoint )
|
const QString& mountPoint )
|
||||||
{
|
{
|
||||||
@ -328,4 +328,10 @@ runOsprober( PartitionCoreModule* core )
|
|||||||
return osproberEntries;
|
return osproberEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
isEfiSystem()
|
||||||
|
{
|
||||||
|
return QDir( "/sys/firmware/efi/efivars" ).exists();
|
||||||
|
}
|
||||||
|
|
||||||
} // nmamespace PartUtils
|
} // nmamespace PartUtils
|
||||||
|
@ -62,6 +62,11 @@ bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
|||||||
*/
|
*/
|
||||||
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Is this system EFI-enabled? Decides based on /sys/firmware/efi
|
||||||
|
*/
|
||||||
|
bool isEfiSystem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PARTUTILS_H
|
#endif // PARTUTILS_H
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "core/PartitionInfo.h"
|
#include "core/PartitionInfo.h"
|
||||||
#include "core/PartitionCoreModule.h"
|
#include "core/PartitionCoreModule.h"
|
||||||
|
#include "core/PartUtils.h"
|
||||||
|
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
@ -118,9 +119,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
{
|
{
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
|
|
||||||
bool isEfi = false;
|
bool isEfi = PartUtils::isEfiSystem();
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
|
||||||
isEfi = true;
|
|
||||||
|
|
||||||
QString defaultFsType = gs->value( "defaultFileSystemType" ).toString();
|
QString defaultFsType = gs->value( "defaultFileSystemType" ).toString();
|
||||||
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
||||||
|
@ -167,7 +167,7 @@ PartitionCoreModule::doInit()
|
|||||||
|
|
||||||
//FIXME: this should be removed in favor of
|
//FIXME: this should be removed in favor of
|
||||||
// proper KPM support for EFI
|
// proper KPM support for EFI
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
if ( PartUtils::isEfiSystem() )
|
||||||
scanForEfiSystemPartitions();
|
scanForEfiSystemPartitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ PartitionCoreModule::refresh()
|
|||||||
|
|
||||||
//FIXME: this should be removed in favor of
|
//FIXME: this should be removed in favor of
|
||||||
// proper KPM support for EFI
|
// proper KPM support for EFI
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
if ( PartUtils::isEfiSystem() )
|
||||||
scanForEfiSystemPartitions();
|
scanForEfiSystemPartitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "BootInfoWidget.h"
|
#include "BootInfoWidget.h"
|
||||||
|
#include "core/PartUtils.h"
|
||||||
|
|
||||||
#include <utils/CalamaresUtilsGui.h>
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -64,12 +65,8 @@ BootInfoWidget::BootInfoWidget( QWidget* parent )
|
|||||||
"may also show up as BIOS if started in compatibility "
|
"may also show up as BIOS if started in compatibility "
|
||||||
"mode." ) );
|
"mode." ) );
|
||||||
|
|
||||||
bool isEfi = false;
|
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
|
||||||
isEfi = true;
|
|
||||||
|
|
||||||
QString bootToolTip;
|
QString bootToolTip;
|
||||||
if ( isEfi )
|
if ( PartUtils::isEfiSystem() )
|
||||||
{
|
{
|
||||||
m_bootLabel->setText( "EFI " );
|
m_bootLabel->setText( "EFI " );
|
||||||
bootToolTip = tr( "This system was started with an <strong>EFI</strong> "
|
bootToolTip = tr( "This system was started with an <strong>EFI</strong> "
|
||||||
|
@ -146,7 +146,7 @@ void
|
|||||||
ChoicePage::init( PartitionCoreModule* core )
|
ChoicePage::init( PartitionCoreModule* core )
|
||||||
{
|
{
|
||||||
m_core = core;
|
m_core = core;
|
||||||
m_isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
m_isEfi = PartUtils::isEfiSystem();
|
||||||
|
|
||||||
setupChoices();
|
setupChoices();
|
||||||
|
|
||||||
@ -1311,7 +1311,7 @@ ChoicePage::setupActions()
|
|||||||
m_grp->setExclusive( true );
|
m_grp->setExclusive( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
bool isEfi = PartUtils::isEfiSystem();
|
||||||
bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();
|
bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();
|
||||||
|
|
||||||
if ( isEfi && !efiSystemPartitionFound )
|
if ( isEfi && !efiSystemPartitionFound )
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "core/ColorUtils.h"
|
#include "core/ColorUtils.h"
|
||||||
#include "core/PartitionInfo.h"
|
#include "core/PartitionInfo.h"
|
||||||
|
#include "core/PartUtils.h"
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "gui/PartitionSizeController.h"
|
#include "gui/PartitionSizeController.h"
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||||||
m_ui->encryptWidget->hide();
|
m_ui->encryptWidget->hide();
|
||||||
|
|
||||||
QStringList mountPoints = { "/", "/boot", "/home", "/opt", "/usr", "/var" };
|
QStringList mountPoints = { "/", "/boot", "/home", "/opt", "/usr", "/var" };
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
if ( PartUtils::isEfiSystem() )
|
||||||
mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
|
mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
|
||||||
mountPoints.removeDuplicates();
|
mountPoints.removeDuplicates();
|
||||||
mountPoints.sort();
|
mountPoints.sort();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <core/ColorUtils.h>
|
#include <core/ColorUtils.h>
|
||||||
#include <core/PartitionCoreModule.h>
|
#include <core/PartitionCoreModule.h>
|
||||||
#include <core/PartitionInfo.h>
|
#include <core/PartitionInfo.h>
|
||||||
|
#include "core/PartUtils.h"
|
||||||
#include <core/KPMHelpers.h>
|
#include <core/KPMHelpers.h>
|
||||||
#include <gui/PartitionSizeController.h>
|
#include <gui/PartitionSizeController.h>
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
|||||||
m_ui->setupUi( this );
|
m_ui->setupUi( this );
|
||||||
|
|
||||||
QStringList mountPoints = { "/", "/boot", "/home", "/opt", "/usr", "/var" };
|
QStringList mountPoints = { "/", "/boot", "/home", "/opt", "/usr", "/var" };
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
if ( PartUtils::isEfiSystem() )
|
||||||
mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
|
mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
|
||||||
mountPoints.removeDuplicates();
|
mountPoints.removeDuplicates();
|
||||||
mountPoints.sort();
|
mountPoints.sort();
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "core/PartitionCoreModule.h"
|
#include "core/PartitionCoreModule.h"
|
||||||
#include "core/PartitionInfo.h"
|
#include "core/PartitionInfo.h"
|
||||||
#include "core/PartitionModel.h"
|
#include "core/PartitionModel.h"
|
||||||
|
#include "core/PartUtils.h"
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "gui/CreatePartitionDialog.h"
|
#include "gui/CreatePartitionDialog.h"
|
||||||
#include "gui/EditExistingPartitionDialog.h"
|
#include "gui/EditExistingPartitionDialog.h"
|
||||||
@ -59,7 +60,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
|||||||
, m_core( core )
|
, m_core( core )
|
||||||
, m_isEfi( false )
|
, m_isEfi( false )
|
||||||
{
|
{
|
||||||
m_isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
m_isEfi = PartUtils::isEfiSystem();
|
||||||
|
|
||||||
m_ui->setupUi( this );
|
m_ui->setupUi( this );
|
||||||
m_ui->partitionLabelsView->setVisible(
|
m_ui->partitionLabelsView->setVisible(
|
||||||
|
@ -386,7 +386,7 @@ PartitionViewStep::onLeave()
|
|||||||
|
|
||||||
if ( m_widget->currentWidget() == m_manualPartitionPage )
|
if ( m_widget->currentWidget() == m_manualPartitionPage )
|
||||||
{
|
{
|
||||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
if ( PartUtils::isEfiSystem() )
|
||||||
{
|
{
|
||||||
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->
|
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->
|
||||||
value( "efiSystemPartition").toString();
|
value( "efiSystemPartition").toString();
|
||||||
|
Loading…
Reference in New Issue
Block a user