Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip 2017-08-28 21:23:12 +01:00
commit 79ae0c5130
16 changed files with 90 additions and 53 deletions

View File

@ -15,10 +15,10 @@ welcomeExpandingLogo: true
strings:
productName: Generic GNU/Linux
shortProductName: Generic
version: 1.0 LTS
shortVersion: 1.0
versionedName: Generic GNU/Linux 1.0 LTS "Rusty Trombone"
shortVersionedName: Generic 1.0
version: 2017.8 LTS
shortVersion: 2017.8
versionedName: Generic GNU/Linux 2017.8 LTS "Soapy Sousaphone"
shortVersionedName: Generic 2017.8
bootloaderEntryName: Generic
productUrl: http://calamares.io/
supportUrl: http://calamares.io/bugs/

View File

@ -195,8 +195,14 @@ System::targetEnvOutput( const QStringList& args,
return -1;
}
cLog() << "Finished. Exit code:" << process.exitCode();
return process.exitCode();
auto r = process.exitCode();
cLog() << "Finished. Exit code:" << r;
if ( r != 0 )
{
cLog() << "Target cmd" << args;
cLog() << "Target out" << output;
}
return r;
}

View File

@ -52,13 +52,14 @@ hasRootPartition( Device* device )
return false;
}
/* Unused */
static bool
isMounted( Device* device )
hasMountedPartitions( Device* device )
{
cDebug() << "Checking for mounted partitions in" << device->deviceNode();
for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it )
{
if ( ! ( *it )->mountPoint().isEmpty() )
if ( ! ( *it )->isMounted() )
{
cDebug() << " .." << ( *it )->partitionPath() << "is mounted on" << ( *it )->mountPoint();
return true;
@ -128,8 +129,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
}
else if ( writableOnly && (
hasRootPartition( *it ) ||
isIso9660( *it ) ||
isMounted( *it ) )
isIso9660( *it ) )
)
{
cDebug() << " .. Removing" << it;

View File

@ -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

View File

@ -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

View File

@ -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 )

View File

@ -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();
}

View File

@ -18,8 +18,10 @@
#include "BootInfoWidget.h"
#include "core/PartUtils.h"
#include <utils/CalamaresUtilsGui.h>
#include "utils/CalamaresUtilsGui.h"
#include "utils/Retranslator.h"
#include <QDir>
#include <QLabel>
@ -58,18 +60,20 @@ BootInfoWidget::BootInfoWidget( QWidget* parent )
m_bootIcon->setPalette( palette );
m_bootLabel->setPalette( palette );
CALAMARES_RETRANSLATE( retranslateUi(); )
}
void
BootInfoWidget::retranslateUi()
{
m_bootIcon->setToolTip( tr( "The <strong>boot environment</strong> of this system.<br><br>"
"Older x86 systems only support <strong>BIOS</strong>.<br>"
"Modern systems usually use <strong>EFI</strong>, but "
"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> "

View File

@ -30,6 +30,9 @@ class BootInfoWidget : public QWidget
public:
explicit BootInfoWidget( QWidget* parent = nullptr );
public slots:
void retranslateUi();
private:
QLabel* m_bootIcon;
QLabel* m_bootLabel;

View File

@ -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();
@ -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 )

View File

@ -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,7 +67,7 @@ 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();

View File

@ -19,9 +19,11 @@
#include "DeviceInfoWidget.h"
#include <utils/CalamaresUtilsGui.h>
#include <JobQueue.h>
#include <GlobalStorage.h>
#include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h"
#include "utils/Retranslator.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
#include <QDir>
#include <QLabel>
@ -44,7 +46,8 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent )
m_ptIcon->setMargin( 0 );
m_ptIcon->setFixedSize( iconSize );
m_ptIcon->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionTable,
m_ptIcon->setPixmap(
CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionTable,
CalamaresUtils::Original,
iconSize ) );
@ -60,28 +63,24 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent )
m_ptIcon->setPalette( palette );
m_ptLabel->setPalette( palette );
m_ptIcon->setToolTip( tr( "The type of <strong>partition table</strong> on the "
"selected storage device.<br><br>"
"The only way to change the partition table type is to "
"erase and recreate the partition table from scratch, "
"which destroys all data on the storage device.<br>"
"This installer will keep the current partition table "
"unless you explicitly choose otherwise.<br>"
"If unsure, on modern systems GPT is preferred." ) );
bool isEfi = false;
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
isEfi = true;
CALAMARES_RETRANSLATE( retranslateUi(); )
}
void
DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type )
{
QString typeString = PartitionTable::tableTypeToName( type ).toUpper();
m_tableType = type;
retranslateUi();
}
void
DeviceInfoWidget::retranslateUi()
{
QString typeString = PartitionTable::tableTypeToName( m_tableType ).toUpper();
// fix up if the name shouldn't be uppercase:
switch ( type )
switch ( m_tableType )
{
case PartitionTable::msdos:
case PartitionTable::msdos_sectorbased:
@ -108,7 +107,7 @@ DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type )
"table." )
.arg( typeString );
switch ( type )
switch ( m_tableType )
{
case PartitionTable::loop:
toolTipString = tr( "This is a <strong>loop</strong> "
@ -146,5 +145,13 @@ DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type )
m_ptLabel->setText( typeString );
m_ptLabel->setToolTip( toolTipString );
}
m_ptIcon->setToolTip( tr( "The type of <strong>partition table</strong> on the "
"selected storage device.<br><br>"
"The only way to change the partition table type is to "
"erase and recreate the partition table from scratch, "
"which destroys all data on the storage device.<br>"
"This installer will keep the current partition table "
"unless you explicitly choose otherwise.<br>"
"If unsure, on modern systems GPT is preferred." ) );
}

View File

@ -34,9 +34,13 @@ public:
void setPartitionTableType( PartitionTable::TableType type );
public slots:
void retranslateUi();
private:
QLabel* m_ptIcon;
QLabel* m_ptLabel;
PartitionTable::TableType m_tableType;
};
#endif // DEVICEINFOWIDGET_H

View File

@ -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();

View File

@ -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(

View File

@ -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();