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: strings:
productName: Generic GNU/Linux productName: Generic GNU/Linux
shortProductName: Generic shortProductName: Generic
version: 1.0 LTS version: 2017.8 LTS
shortVersion: 1.0 shortVersion: 2017.8
versionedName: Generic GNU/Linux 1.0 LTS "Rusty Trombone" versionedName: Generic GNU/Linux 2017.8 LTS "Soapy Sousaphone"
shortVersionedName: Generic 1.0 shortVersionedName: Generic 2017.8
bootloaderEntryName: Generic bootloaderEntryName: Generic
productUrl: http://calamares.io/ productUrl: http://calamares.io/
supportUrl: http://calamares.io/bugs/ supportUrl: http://calamares.io/bugs/

View File

@ -195,8 +195,14 @@ System::targetEnvOutput( const QStringList& args,
return -1; return -1;
} }
cLog() << "Finished. Exit code:" << process.exitCode(); auto r = process.exitCode();
return 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; return false;
} }
/* Unused */
static bool static bool
isMounted( Device* device ) hasMountedPartitions( Device* device )
{ {
cDebug() << "Checking for mounted partitions in" << device->deviceNode(); cDebug() << "Checking for mounted partitions in" << device->deviceNode();
for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it ) 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(); cDebug() << " .." << ( *it )->partitionPath() << "is mounted on" << ( *it )->mountPoint();
return true; return true;
@ -128,8 +129,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
} }
else if ( writableOnly && ( else if ( writableOnly && (
hasRootPartition( *it ) || hasRootPartition( *it ) ||
isIso9660( *it ) || isIso9660( *it ) )
isMounted( *it ) )
) )
{ {
cDebug() << " .. Removing" << it; cDebug() << " .. Removing" << it;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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();
@ -680,7 +680,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
m_core->revertDevice( selectedDevice() ); 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 // with the same first and last sector
Partition* selectedPartition = Partition* selectedPartition =
static_cast< Partition* >( current.data( PartitionModel::PartitionPtrRole ) static_cast< Partition* >( current.data( PartitionModel::PartitionPtrRole )
@ -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 )

View File

@ -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,12 +67,12 @@ 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();
m_ui->mountPointComboBox->addItems( mountPoints ); m_ui->mountPointComboBox->addItems( mountPoints );
if ( device->partitionTable()->type() == PartitionTable::msdos || if ( device->partitionTable()->type() == PartitionTable::msdos ||
device->partitionTable()->type() == PartitionTable::msdos_sectorbased ) device->partitionTable()->type() == PartitionTable::msdos_sectorbased )
initMbrPartitionTypeUi(); initMbrPartitionTypeUi();

View File

@ -19,9 +19,11 @@
#include "DeviceInfoWidget.h" #include "DeviceInfoWidget.h"
#include <utils/CalamaresUtilsGui.h> #include "utils/CalamaresUtilsGui.h"
#include <JobQueue.h> #include "utils/Logger.h"
#include <GlobalStorage.h> #include "utils/Retranslator.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
#include <QDir> #include <QDir>
#include <QLabel> #include <QLabel>
@ -44,9 +46,10 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent )
m_ptIcon->setMargin( 0 ); m_ptIcon->setMargin( 0 );
m_ptIcon->setFixedSize( iconSize ); m_ptIcon->setFixedSize( iconSize );
m_ptIcon->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionTable, m_ptIcon->setPixmap(
CalamaresUtils::Original, CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionTable,
iconSize ) ); CalamaresUtils::Original,
iconSize ) );
QFontMetrics fm = QFontMetrics( QFont() ); QFontMetrics fm = QFontMetrics( QFont() );
m_ptLabel->setMinimumWidth( fm.boundingRect( "Amiga" ).width() + CalamaresUtils::defaultFontHeight() / 2 ); m_ptLabel->setMinimumWidth( fm.boundingRect( "Amiga" ).width() + CalamaresUtils::defaultFontHeight() / 2 );
@ -60,28 +63,24 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent )
m_ptIcon->setPalette( palette ); m_ptIcon->setPalette( palette );
m_ptLabel->setPalette( palette ); m_ptLabel->setPalette( palette );
m_ptIcon->setToolTip( tr( "The type of <strong>partition table</strong> on the " CALAMARES_RETRANSLATE( retranslateUi(); )
"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;
} }
void void
DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type ) 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: // fix up if the name shouldn't be uppercase:
switch ( type ) switch ( m_tableType )
{ {
case PartitionTable::msdos: case PartitionTable::msdos:
case PartitionTable::msdos_sectorbased: case PartitionTable::msdos_sectorbased:
@ -108,7 +107,7 @@ DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type )
"table." ) "table." )
.arg( typeString ); .arg( typeString );
switch ( type ) switch ( m_tableType )
{ {
case PartitionTable::loop: case PartitionTable::loop:
toolTipString = tr( "This is a <strong>loop</strong> " toolTipString = tr( "This is a <strong>loop</strong> "
@ -146,5 +145,13 @@ DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type )
m_ptLabel->setText( typeString ); m_ptLabel->setText( typeString );
m_ptLabel->setToolTip( toolTipString ); 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 ); void setPartitionTableType( PartitionTable::TableType type );
public slots:
void retranslateUi();
private: private:
QLabel* m_ptIcon; QLabel* m_ptIcon;
QLabel* m_ptLabel; QLabel* m_ptLabel;
PartitionTable::TableType m_tableType;
}; };
#endif // DEVICEINFOWIDGET_H #endif // DEVICEINFOWIDGET_H

View File

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

View File

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

View File

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