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 )
|
||||
{
|
||||
FstabEntryList fstabEntries;
|
||||
@ -195,7 +195,7 @@ lookForFstabEntries( const QString& partitionPath )
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
static QString
|
||||
findPartitionPathForMountPoint( const FstabEntryList& fstab,
|
||||
const QString& mountPoint )
|
||||
{
|
||||
@ -328,4 +328,10 @@ runOsprober( PartitionCoreModule* core )
|
||||
return osproberEntries;
|
||||
}
|
||||
|
||||
bool
|
||||
isEfiSystem()
|
||||
{
|
||||
return QDir( "/sys/firmware/efi/efivars" ).exists();
|
||||
}
|
||||
|
||||
} // nmamespace PartUtils
|
||||
|
@ -62,6 +62,11 @@ bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
||||
*/
|
||||
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
||||
|
||||
/**
|
||||
* @brief Is this system EFI-enabled? Decides based on /sys/firmware/efi
|
||||
*/
|
||||
bool isEfiSystem();
|
||||
|
||||
}
|
||||
|
||||
#endif // PARTUTILS_H
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "core/PartitionCoreModule.h"
|
||||
#include "core/PartUtils.h"
|
||||
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "JobQueue.h"
|
||||
@ -118,9 +119,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
||||
{
|
||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
|
||||
bool isEfi = false;
|
||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||
isEfi = true;
|
||||
bool isEfi = PartUtils::isEfiSystem();
|
||||
|
||||
QString defaultFsType = gs->value( "defaultFileSystemType" ).toString();
|
||||
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
||||
|
@ -167,7 +167,7 @@ PartitionCoreModule::doInit()
|
||||
|
||||
//FIXME: this should be removed in favor of
|
||||
// proper KPM support for EFI
|
||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||
if ( PartUtils::isEfiSystem() )
|
||||
scanForEfiSystemPartitions();
|
||||
}
|
||||
|
||||
@ -461,7 +461,7 @@ PartitionCoreModule::refresh()
|
||||
|
||||
//FIXME: this should be removed in favor of
|
||||
// proper KPM support for EFI
|
||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||
if ( PartUtils::isEfiSystem() )
|
||||
scanForEfiSystemPartitions();
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,9 @@
|
||||
|
||||
|
||||
#include "BootInfoWidget.h"
|
||||
#include "core/PartUtils.h"
|
||||
|
||||
#include <utils/CalamaresUtilsGui.h>
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QLabel>
|
||||
@ -64,12 +65,8 @@ BootInfoWidget::BootInfoWidget( QWidget* parent )
|
||||
"may also show up as BIOS if started in compatibility "
|
||||
"mode." ) );
|
||||
|
||||
bool isEfi = false;
|
||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||
isEfi = true;
|
||||
|
||||
QString bootToolTip;
|
||||
if ( isEfi )
|
||||
if ( PartUtils::isEfiSystem() )
|
||||
{
|
||||
m_bootLabel->setText( "EFI " );
|
||||
bootToolTip = tr( "This system was started with an <strong>EFI</strong> "
|
||||
|
@ -146,7 +146,7 @@ void
|
||||
ChoicePage::init( PartitionCoreModule* core )
|
||||
{
|
||||
m_core = core;
|
||||
m_isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
||||
m_isEfi = PartUtils::isEfiSystem();
|
||||
|
||||
setupChoices();
|
||||
|
||||
@ -680,7 +680,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
||||
m_core->revertDevice( selectedDevice() );
|
||||
}
|
||||
|
||||
// if the partition is unallocated(free space), we don't replace it but create new one
|
||||
// if the partition is unallocated(free space), we don't replace it but create new one
|
||||
// with the same first and last sector
|
||||
Partition* selectedPartition =
|
||||
static_cast< Partition* >( current.data( PartitionModel::PartitionPtrRole )
|
||||
@ -1311,7 +1311,7 @@ ChoicePage::setupActions()
|
||||
m_grp->setExclusive( true );
|
||||
}
|
||||
|
||||
bool isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
||||
bool isEfi = PartUtils::isEfiSystem();
|
||||
bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();
|
||||
|
||||
if ( isEfi && !efiSystemPartitionFound )
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "core/ColorUtils.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "core/PartUtils.h"
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "gui/PartitionSizeController.h"
|
||||
|
||||
@ -66,12 +67,12 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
||||
m_ui->encryptWidget->hide();
|
||||
|
||||
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.removeDuplicates();
|
||||
mountPoints.sort();
|
||||
m_ui->mountPointComboBox->addItems( mountPoints );
|
||||
|
||||
|
||||
if ( device->partitionTable()->type() == PartitionTable::msdos ||
|
||||
device->partitionTable()->type() == PartitionTable::msdos_sectorbased )
|
||||
initMbrPartitionTypeUi();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <core/ColorUtils.h>
|
||||
#include <core/PartitionCoreModule.h>
|
||||
#include <core/PartitionInfo.h>
|
||||
#include "core/PartUtils.h"
|
||||
#include <core/KPMHelpers.h>
|
||||
#include <gui/PartitionSizeController.h>
|
||||
|
||||
@ -56,7 +57,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
||||
m_ui->setupUi( this );
|
||||
|
||||
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.removeDuplicates();
|
||||
mountPoints.sort();
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "core/PartitionCoreModule.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "core/PartitionModel.h"
|
||||
#include "core/PartUtils.h"
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "gui/CreatePartitionDialog.h"
|
||||
#include "gui/EditExistingPartitionDialog.h"
|
||||
@ -59,7 +60,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
, m_core( core )
|
||||
, m_isEfi( false )
|
||||
{
|
||||
m_isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
||||
m_isEfi = PartUtils::isEfiSystem();
|
||||
|
||||
m_ui->setupUi( this );
|
||||
m_ui->partitionLabelsView->setVisible(
|
||||
|
@ -386,7 +386,7 @@ PartitionViewStep::onLeave()
|
||||
|
||||
if ( m_widget->currentWidget() == m_manualPartitionPage )
|
||||
{
|
||||
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
|
||||
if ( PartUtils::isEfiSystem() )
|
||||
{
|
||||
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->
|
||||
value( "efiSystemPartition").toString();
|
||||
|
Loading…
Reference in New Issue
Block a user