CI: apply style tool across the entire codebase

This commit is contained in:
Adriaan de Groot 2023-10-17 22:24:46 +02:00
parent e1747af296
commit 63b0589382
84 changed files with 232 additions and 106 deletions

View File

@ -20,10 +20,10 @@
#include "ViewManager.h" #include "ViewManager.h"
#include "locale/TranslationsModel.h" #include "locale/TranslationsModel.h"
#include "modulesystem/ModuleManager.h" #include "modulesystem/ModuleManager.h"
#include "utils/Gui.h"
#include "utils/System.h"
#include "utils/Dirs.h" #include "utils/Dirs.h"
#include "utils/Gui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#ifdef WITH_QML #ifdef WITH_QML
#include "utils/Qml.h" #include "utils/Qml.h"
#endif #endif
@ -121,10 +121,12 @@ brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename )
brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename ); brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename );
} }
if ( Calamares::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
{
for ( auto s : Calamares::extraDataDirs() ) for ( auto s : Calamares::extraDataDirs() )
{ {
brandingPaths << ( s + brandingFilename ); brandingPaths << ( s + brandingFilename );
} }
}
brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename ); brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename );
brandingPaths << Calamares::appDataDir().absoluteFilePath( brandingFilename ); brandingPaths << Calamares::appDataDir().absoluteFilePath( brandingFilename );
} }

View File

@ -169,7 +169,8 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
debugWindowBtn->setIcon( Calamares::defaultPixmap( debugWindowBtn->setIcon( Calamares::defaultPixmap(
Calamares::Bugs, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); Calamares::Bugs, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
CALAMARES_RETRANSLATE_FOR( CALAMARES_RETRANSLATE_FOR(
debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug", "@button" ) ); debugWindowBtn,
debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug", "@button" ) );
debugWindowBtn->setToolTip( debugWindowBtn->setToolTip(
QCoreApplication::translate( "calamares-sidebar", "Show debug information", "@tooltip" ) ); ); QCoreApplication::translate( "calamares-sidebar", "Show debug information", "@tooltip" ) ); );
extraButtons->addWidget( debugWindowBtn ); extraButtons->addWidget( debugWindowBtn );
@ -197,8 +198,8 @@ getWidgetNavigation( Calamares::DebugWindowManager*,
// Create buttons and sets an initial icon; the icons may change // Create buttons and sets an initial icon; the icons may change
{ {
auto* back auto* back = new QPushButton(
= new QPushButton( getButtonIcon( QStringLiteral( "go-previous" ) ), getButtonIcon( QStringLiteral( "go-previous" ) ),
QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Back", "@button" ), QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Back", "@button" ),
navigation ); navigation );
back->setObjectName( "view-button-back" ); back->setObjectName( "view-button-back" );
@ -213,8 +214,8 @@ getWidgetNavigation( Calamares::DebugWindowManager*,
bottomLayout->addWidget( back ); bottomLayout->addWidget( back );
} }
{ {
auto* next auto* next = new QPushButton(
= new QPushButton( getButtonIcon( QStringLiteral( "go-next" ) ), getButtonIcon( QStringLiteral( "go-next" ) ),
QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Next", "@button" ), QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Next", "@button" ),
navigation ); navigation );
next->setObjectName( "view-button-next" ); next->setObjectName( "view-button-next" );
@ -230,8 +231,8 @@ getWidgetNavigation( Calamares::DebugWindowManager*,
} }
bottomLayout->addSpacing( 12 ); bottomLayout->addSpacing( 12 );
{ {
auto* quit auto* quit = new QPushButton(
= new QPushButton( getButtonIcon( QStringLiteral( "dialog-cancel" ) ), getButtonIcon( QStringLiteral( "dialog-cancel" ) ),
QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Cancel", "@button" ), QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Cancel", "@button" ),
navigation ); navigation );
quit->setObjectName( "view-button-cancel" ); quit->setObjectName( "view-button-cancel" );

View File

@ -10,8 +10,8 @@
#include "ProcessJob.h" #include "ProcessJob.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
@ -51,10 +51,13 @@ ProcessJob::exec()
using Calamares::System; using Calamares::System;
if ( m_runInChroot ) if ( m_runInChroot )
{
return Calamares::System::instance() return Calamares::System::instance()
->targetEnvCommand( { m_command }, m_workingPath, QString(), m_timeoutSec ) ->targetEnvCommand( { m_command }, m_workingPath, QString(), m_timeoutSec )
.explainProcess( m_command, m_timeoutSec ); .explainProcess( m_command, m_timeoutSec );
}
else else
{
return System::runCommand( System::RunLocation::RunInHost, return System::runCommand( System::RunLocation::RunInHost,
{ "/bin/sh", "-c", m_command }, { "/bin/sh", "-c", m_command },
m_workingPath, m_workingPath,
@ -62,5 +65,6 @@ ProcessJob::exec()
m_timeoutSec ) m_timeoutSec )
.explainProcess( m_command, m_timeoutSec ); .explainProcess( m_command, m_timeoutSec );
} }
}
} // namespace Calamares } // namespace Calamares

View File

@ -15,11 +15,11 @@
#include "PythonHelper.h" #include "PythonHelper.h"
#include "locale/Global.h" #include "locale/Global.h"
#include "partition/Mount.h" #include "partition/Mount.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/RAII.h" #include "utils/RAII.h"
#include "utils/Runner.h" #include "utils/Runner.h"
#include "utils/String.h" #include "utils/String.h"
#include "utils/System.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
#include <QCoreApplication> #include <QCoreApplication>

View File

@ -384,10 +384,12 @@ settingsFileCandidates( bool assumeBuilddir )
settingsPaths << QDir::current().absoluteFilePath( settings ); settingsPaths << QDir::current().absoluteFilePath( settings );
} }
if ( Calamares::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
{
for ( auto s : Calamares::extraConfigDirs() ) for ( auto s : Calamares::extraConfigDirs() )
{ {
settingsPaths << ( s + settings ); settingsPaths << ( s + settings );
} }
}
settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat
settingsPaths << Calamares::appDataDir().absoluteFilePath( settings ); settingsPaths << Calamares::appDataDir().absoluteFilePath( settings );
} }

View File

@ -78,10 +78,12 @@ TranslationsModel::locale( int row ) const
if ( ( row < 0 ) || ( row >= m_locales.count() ) ) if ( ( row < 0 ) || ( row >= m_locales.count() ) )
{ {
for ( const auto& l : m_locales ) for ( const auto& l : m_locales )
{
if ( l->isEnglish() ) if ( l->isEnglish() )
{ {
return *l; return *l;
} }
}
return *m_locales[ 0 ]; return *m_locales[ 0 ];
} }
return *m_locales[ row ]; return *m_locales[ row ];

View File

@ -74,10 +74,12 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
} }
if ( Calamares::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
{
for ( auto s : Calamares::extraConfigDirs() ) for ( auto s : Calamares::extraConfigDirs() )
{ {
paths << ( s + QString( "modules/%1" ).arg( configFileName ) ); paths << ( s + QString( "modules/%1" ).arg( configFileName ) );
} }
}
paths << QString( "/etc/calamares/modules/%1" ).arg( configFileName ); paths << QString( "/etc/calamares/modules/%1" ).arg( configFileName );
paths << Calamares::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) ); paths << Calamares::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) );

View File

@ -12,9 +12,9 @@
#include "Mount.h" #include "Mount.h"
#include "partition/Sync.h" #include "partition/Sync.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/String.h" #include "utils/String.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
#include <QTemporaryDir> #include <QTemporaryDir>

View File

@ -58,11 +58,15 @@ Partition*
findPartitionByCurrentMountPoint( const QList< Device* >& devices, const QString& mountPoint ) findPartitionByCurrentMountPoint( const QList< Device* >& devices, const QString& mountPoint )
{ {
for ( auto device : devices ) for ( auto device : devices )
{
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() == mountPoint ) if ( ( *it )->mountPoint() == mountPoint )
{ {
return *it; return *it;
} }
}
}
return nullptr; return nullptr;
} }

View File

@ -10,8 +10,8 @@
#include "Sync.h" #include "Sync.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
void void
Calamares::Partition::sync() Calamares::Partition::sync()

View File

@ -94,7 +94,7 @@ namespace Python __attribute__( ( visibility( "hidden" ) ) )
}; };
} // namespace ) } // namespace Python
} // namespace Calamares } // namespace Calamares
#endif #endif

View File

@ -33,6 +33,6 @@ namespace Python __attribute__( ( visibility( "hidden" ) ) )
return QString::fromUtf8( pybind11::str( o ).cast< std::string >().c_str() ); return QString::fromUtf8( pybind11::str( o ).cast< std::string >().c_str() );
} }
} // namespace ) } // namespace Python
} // namespace Calamares } // namespace Calamares
#endif #endif

View File

@ -14,9 +14,9 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "compat/Variant.h" #include "compat/Variant.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/StringExpander.h" #include "utils/StringExpander.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include <QCoreApplication> #include <QCoreApplication>

View File

@ -249,6 +249,7 @@ operator<<( QDebug& s, const RedactedCommand& l )
if ( l.list.contains( "usermod" ) ) if ( l.list.contains( "usermod" ) )
{ {
for ( const auto& item : l.list ) for ( const auto& item : l.list )
{
if ( item.startsWith( "$6$" ) ) if ( item.startsWith( "$6$" ) )
{ {
s << "<password>"; s << "<password>";
@ -258,6 +259,7 @@ operator<<( QDebug& s, const RedactedCommand& l )
s << item; s << item;
} }
} }
}
else else
{ {
s << l.list; s << l.list;

View File

@ -164,11 +164,13 @@ struct NamedEnumTable
ok = false; ok = false;
for ( const auto& p : table ) for ( const auto& p : table )
{
if ( 0 == QString::compare( s, p.first, Qt::CaseInsensitive ) ) if ( 0 == QString::compare( s, p.first, Qt::CaseInsensitive ) )
{ {
ok = true; ok = true;
return p.second; return p.second;
} }
}
// ok is still false // ok is still false
return table.begin()->second; return table.begin()->second;
@ -207,11 +209,13 @@ struct NamedEnumTable
ok = false; ok = false;
for ( const auto& p : table ) for ( const auto& p : table )
{
if ( s == p.second ) if ( s == p.second )
{ {
ok = true; ok = true;
return p.first; return p.first;
} }
}
// ok is still false // ok is still false
return string_t(); return string_t();

View File

@ -65,6 +65,7 @@ public:
: NamedSuffix() : NamedSuffix()
{ {
for ( const auto& suffix : table.table ) for ( const auto& suffix : table.table )
{
if ( s.endsWith( suffix.first ) ) if ( s.endsWith( suffix.first ) )
{ {
m_value = s.left( s.length() - suffix.first.length() ).toLongLong(); m_value = s.left( s.length() - suffix.first.length() ).toLongLong();
@ -72,6 +73,7 @@ public:
break; break;
} }
} }
}
/** @brief Construct value from string. /** @brief Construct value from string.
* *

View File

@ -7,8 +7,8 @@
#include "Permissions.h" #include "Permissions.h"
#include "System.h"
#include "Logger.h" #include "Logger.h"
#include "System.h"
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>

View File

@ -104,7 +104,9 @@ protected:
{ \ { \
pluginRegistrations; \ pluginRegistrations; \
} \ } \
name::~name() {} name::~name() \
{ \
}
Q_DECLARE_INTERFACE( CalamaresPluginFactory, CalamaresPluginFactory_iid ) Q_DECLARE_INTERFACE( CalamaresPluginFactory, CalamaresPluginFactory_iid )

View File

@ -262,6 +262,7 @@ System::getCpuDescription() const
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
QFile file( "/proc/cpuinfo" ); QFile file( "/proc/cpuinfo" );
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
while ( !file.atEnd() ) while ( !file.atEnd() )
{ {
QByteArray line = file.readLine(); QByteArray line = file.readLine();
@ -271,6 +272,7 @@ System::getCpuDescription() const
break; break;
} }
} }
}
#elif defined( Q_OS_FREEBSD ) #elif defined( Q_OS_FREEBSD )
// This would use sysctl "hw.model", which has a string value // This would use sysctl "hw.model", which has a string value
#endif #endif
@ -303,29 +305,37 @@ ProcessResult::explainProcess( int ec, const QString& command, const QString& ou
? QCoreApplication::translate( "ProcessResult", "\nThere was no output from the command." ) ? QCoreApplication::translate( "ProcessResult", "\nThere was no output from the command." )
: ( QCoreApplication::translate( "ProcessResult", "\nOutput:\n" ) + output ); : ( QCoreApplication::translate( "ProcessResult", "\nOutput:\n" ) + output );
if ( ec == static_cast< int >( ProcessResult::Code::Crashed ) ) //Crash! if ( ec == static_cast< int >( ProcessResult::Code::Crashed ) )
{ //Crash!
return JobResult::error( return JobResult::error(
QCoreApplication::translate( "ProcessResult", "External command crashed." ), QCoreApplication::translate( "ProcessResult", "External command crashed." ),
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> crashed." ).arg( command ) QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> crashed." ).arg( command )
+ outputMessage ); + outputMessage );
}
if ( ec == static_cast< int >( ProcessResult::Code::FailedToStart ) ) if ( ec == static_cast< int >( ProcessResult::Code::FailedToStart ) )
{
return JobResult::error( return JobResult::error(
QCoreApplication::translate( "ProcessResult", "External command failed to start." ), QCoreApplication::translate( "ProcessResult", "External command failed to start." ),
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> failed to start." ).arg( command ) ); QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> failed to start." ).arg( command ) );
}
if ( ec == static_cast< int >( ProcessResult::Code::NoWorkingDirectory ) ) if ( ec == static_cast< int >( ProcessResult::Code::NoWorkingDirectory ) )
{
return JobResult::error( return JobResult::error(
QCoreApplication::translate( "ProcessResult", "Internal error when starting command." ), QCoreApplication::translate( "ProcessResult", "Internal error when starting command." ),
QCoreApplication::translate( "ProcessResult", "Bad parameters for process job call." ) ); QCoreApplication::translate( "ProcessResult", "Bad parameters for process job call." ) );
}
if ( ec == static_cast< int >( ProcessResult::Code::TimedOut ) ) if ( ec == static_cast< int >( ProcessResult::Code::TimedOut ) )
{
return JobResult::error( return JobResult::error(
QCoreApplication::translate( "ProcessResult", "External command failed to finish." ), QCoreApplication::translate( "ProcessResult", "External command failed to finish." ),
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> failed to finish in %2 seconds." ) QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> failed to finish in %2 seconds." )
.arg( command ) .arg( command )
.arg( timeout.count() ) .arg( timeout.count() )
+ outputMessage ); + outputMessage );
}
//Any other exit code //Any other exit code
return JobResult::error( return JobResult::error(

View File

@ -9,9 +9,9 @@
* *
*/ */
#include "System.h"
#include "Entropy.h" #include "Entropy.h"
#include "Logger.h" #include "Logger.h"
#include "System.h"
#include "UMask.h" #include "UMask.h"
#include "Yaml.h" #include "Yaml.h"

View File

@ -9,7 +9,6 @@
* *
*/ */
#include "System.h"
#include "CommandList.h" #include "CommandList.h"
#include "Entropy.h" #include "Entropy.h"
#include "Logger.h" #include "Logger.h"
@ -17,6 +16,7 @@
#include "Runner.h" #include "Runner.h"
#include "String.h" #include "String.h"
#include "StringExpander.h" #include "StringExpander.h"
#include "System.h"
#include "Traits.h" #include "Traits.h"
#include "UMask.h" #include "UMask.h"
#include "Variant.h" #include "Variant.h"
@ -183,7 +183,9 @@ findConf( const QDir& d )
QString path = d.absolutePath(); QString path = d.absolutePath();
path.append( d.separator() ); path.append( d.separator() );
for ( const auto& confname : d.entryList( { "*.conf" } ) ) for ( const auto& confname : d.entryList( { "*.conf" } ) )
{
mine.append( path + confname ); mine.append( path + confname );
}
for ( const auto& subdirname : d.entryList( QDir::AllDirs | QDir::NoDotAndDotDot ) ) for ( const auto& subdirname : d.entryList( QDir::AllDirs | QDir::NoDotAndDotDot ) )
{ {
QDir subdir( d ); QDir subdir( d );

View File

@ -229,9 +229,11 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devi
m_componentName = QString::fromStdString( doc[ "componentName" ].as< std::string >() ); m_componentName = QString::fromStdString( doc[ "componentName" ].as< std::string >() );
if ( m_componentName != componentDir.dirName() ) if ( m_componentName != componentDir.dirName() )
{
bail( m_descriptorPath, bail( m_descriptorPath,
"The branding component name should match the name of the " "The branding component name should match the name of the "
"component directory." ); "component directory." );
}
initSimpleSettings( doc ); initSimpleSettings( doc );
initSlideshowSettings( doc ); initSlideshowSettings( doc );
@ -630,9 +632,11 @@ Branding::initSlideshowSettings( const ::YAML::Node& doc )
QString slideshowPath = QString::fromStdString( slideshow.as< std::string >() ); QString slideshowPath = QString::fromStdString( slideshow.as< std::string >() );
QFileInfo slideshowFi( componentDir.absoluteFilePath( slideshowPath ) ); QFileInfo slideshowFi( componentDir.absoluteFilePath( slideshowPath ) );
if ( !slideshowFi.exists() || !slideshowFi.fileName().toLower().endsWith( ".qml" ) ) if ( !slideshowFi.exists() || !slideshowFi.fileName().toLower().endsWith( ".qml" ) )
{
bail( m_descriptorPath, bail( m_descriptorPath,
QString( "Slideshow file %1 does not exist or is not a valid QML file." ) QString( "Slideshow file %1 does not exist or is not a valid QML file." )
.arg( slideshowFi.absoluteFilePath() ) ); .arg( slideshowFi.absoluteFilePath() ) );
}
m_slideshowPath = slideshowFi.absoluteFilePath(); m_slideshowPath = slideshowFi.absoluteFilePath();
// API choice is relevant for QML slideshow // API choice is relevant for QML slideshow

View File

@ -420,11 +420,13 @@ ModuleManager::checkModuleDependencies( const Module& m )
{ {
bool requirementFound = false; bool requirementFound = false;
for ( const Module* v : m_loadedModulesByInstanceKey ) for ( const Module* v : m_loadedModulesByInstanceKey )
{
if ( required == v->name() ) if ( required == v->name() )
{ {
requirementFound = true; requirementFound = true;
break; break;
} }
}
if ( !requirementFound ) if ( !requirementFound )
{ {
cError() << "Module" << m.name() << "requires" << required << "before it in sequence."; cError() << "Module" << m.name() << "requires" << required << "before it in sequence.";

View File

@ -57,10 +57,12 @@ qmlDirCandidates( bool assumeBuilddir )
qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir
} }
if ( Calamares::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
{
for ( auto s : Calamares::extraDataDirs() ) for ( auto s : Calamares::extraDataDirs() )
{ {
qmlDirs << ( s + QML ); qmlDirs << ( s + QML );
} }
}
qmlDirs << Calamares::appDataDir().absoluteFilePath( QML ); qmlDirs << Calamares::appDataDir().absoluteFilePath( QML );
} }

View File

@ -14,9 +14,9 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/CommandList.h" #include "utils/CommandList.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
#include <QtTest/QtTest> #include <QtTest/QtTest>

View File

@ -19,8 +19,8 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "compat/Variant.h" #include "compat/Variant.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
DummyCppJob::DummyCppJob( QObject* parent ) DummyCppJob::DummyCppJob( QObject* parent )
: Calamares::CppJob( parent ) : Calamares::CppJob( parent )

View File

@ -157,9 +157,11 @@ Calamares::JobResult
ResizeFSJob::exec() ResizeFSJob::exec()
{ {
if ( !isValid() ) if ( !isValid() )
{
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "Invalid configuration" ), tr( "Invalid configuration" ),
tr( "The file-system resize job has an invalid configuration and will not run." ) ); tr( "The file-system resize job has an invalid configuration and will not run." ) );
}
if ( !m_kpmcore ) if ( !m_kpmcore )
{ {
@ -172,11 +174,13 @@ ResizeFSJob::exec()
// Now get the partition and FS we want to work on // Now get the partition and FS we want to work on
PartitionMatch m = findPartition(); PartitionMatch m = findPartition();
if ( !m.first || !m.second ) if ( !m.first || !m.second )
{
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "Resize Failed" ), tr( "Resize Failed" ),
!m_fsname.isEmpty() !m_fsname.isEmpty()
? tr( "The filesystem %1 could not be found in this system, and cannot be resized." ).arg( m_fsname ) ? tr( "The filesystem %1 could not be found in this system, and cannot be resized." ).arg( m_fsname )
: tr( "The device %1 could not be found in this system, and cannot be resized." ).arg( m_devicename ) ); : tr( "The device %1 could not be found in this system, and cannot be resized." ).arg( m_devicename ) );
}
m.second->fileSystem().init(); // Initialize support for specific FS m.second->fileSystem().init(); // Initialize support for specific FS
if ( !ResizeOperation::canGrow( m.second ) ) if ( !ResizeOperation::canGrow( m.second ) )
@ -193,18 +197,22 @@ ResizeFSJob::exec()
<< ')' << "to -" << new_end; << ')' << "to -" << new_end;
if ( new_end < 0 ) if ( new_end < 0 )
{
return Calamares::JobResult::error( tr( "Resize Failed" ), return Calamares::JobResult::error( tr( "Resize Failed" ),
!m_fsname.isEmpty() !m_fsname.isEmpty()
? tr( "The filesystem %1 cannot be resized." ).arg( m_fsname ) ? tr( "The filesystem %1 cannot be resized." ).arg( m_fsname )
: tr( "The device %1 cannot be resized." ).arg( m_devicename ) ); : tr( "The device %1 cannot be resized." ).arg( m_devicename ) );
}
if ( new_end == 0 ) if ( new_end == 0 )
{ {
cWarning() << "Resize operation on" << m_fsname << m_devicename << "skipped as not-useful."; cWarning() << "Resize operation on" << m_fsname << m_devicename << "skipped as not-useful.";
if ( m_required ) if ( m_required )
{
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "Resize Failed" ), tr( "Resize Failed" ),
!m_fsname.isEmpty() ? tr( "The filesystem %1 must be resized, but cannot." ).arg( m_fsname ) !m_fsname.isEmpty() ? tr( "The filesystem %1 must be resized, but cannot." ).arg( m_fsname )
: tr( "The device %1 must be resized, but cannot" ).arg( m_fsname ) ); : tr( "The device %1 must be resized, but cannot" ).arg( m_fsname ) );
}
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }

View File

@ -11,8 +11,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Units.h" #include "utils/Units.h"
#include <QDir> #include <QDir>

View File

@ -10,8 +10,8 @@
#include "InitcpioJob.h" #include "InitcpioJob.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/UMask.h" #include "utils/UMask.h"
#include "utils/Variant.h" #include "utils/Variant.h"

View File

@ -9,8 +9,8 @@
#include "InitramfsJob.h" #include "InitramfsJob.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/UMask.h" #include "utils/UMask.h"
#include "utils/Variant.h" #include "utils/Variant.h"

View File

@ -13,8 +13,8 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "Settings.h" #include "Settings.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
#include <QtTest/QtTest> #include <QtTest/QtTest>

View File

@ -19,9 +19,9 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/String.h" #include "utils/String.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@ -37,7 +37,7 @@ removeEmpty(QStringList&& list)
list.removeAll( QString() ); list.removeAll( QString() );
return list; return list;
} }
} } // namespace
SetKeyboardLayoutJob::SetKeyboardLayoutJob( const QString& model, SetKeyboardLayoutJob::SetKeyboardLayoutJob( const QString& model,
const QString& layout, const QString& layout,
@ -290,8 +290,8 @@ SetKeyboardLayoutJob::writeX11Data( const QString& keyboardConfPath ) const
file.close(); file.close();
cDebug() << Logger::SubEntry << "Written XkbLayout" << layouts.join(",") << "; XkbModel" << m_model << "; XkbVariant" cDebug() << Logger::SubEntry << "Written XkbLayout" << layouts.join( "," ) << "; XkbModel" << m_model
<< variants.join(",") << "to X.org file" << keyboardConfPath << stream.status(); << "; XkbVariant" << variants.join( "," ) << "to X.org file" << keyboardConfPath << stream.status();
return ( stream.status() == QTextStream::Ok ); return ( stream.status() == QTextStream::Ok );
} }
@ -327,8 +327,9 @@ SetKeyboardLayoutJob::writeDefaultKeyboardData( const QString& defaultKeyboardPa
file.close(); file.close();
cDebug() << Logger::SubEntry << "Written XKBMODEL" << m_model << "; XKBLAYOUT" << layouts.join(",") << "; XKBVARIANT" cDebug() << Logger::SubEntry << "Written XKBMODEL" << m_model << "; XKBLAYOUT" << layouts.join( "," )
<< variants.join(",") << "to /etc/default/keyboard file" << defaultKeyboardPath << stream.status(); << "; XKBVARIANT" << variants.join( "," ) << "to /etc/default/keyboard file" << defaultKeyboardPath
<< stream.status();
return ( stream.status() == QTextStream::Ok ); return ( stream.status() == QTextStream::Ok );
} }

View File

@ -30,8 +30,7 @@ class Config : public QObject
Q_PROPERTY( Calamares::Locale::ZonesModel* zonesModel READ zonesModel CONSTANT FINAL ) Q_PROPERTY( Calamares::Locale::ZonesModel* zonesModel READ zonesModel CONSTANT FINAL )
Q_PROPERTY( QAbstractItemModel* regionalZonesModel READ regionalZonesModel CONSTANT FINAL ) Q_PROPERTY( QAbstractItemModel* regionalZonesModel READ regionalZonesModel CONSTANT FINAL )
Q_PROPERTY( Q_PROPERTY( Calamares::Locale::TimeZoneData* currentLocation READ currentLocation_c NOTIFY currentLocationChanged )
Calamares::Locale::TimeZoneData* currentLocation READ currentLocation_c NOTIFY currentLocationChanged )
// Status are complete, human-readable, messages // Status are complete, human-readable, messages
Q_PROPERTY( QString currentLocationStatus READ currentLocationStatus NOTIFY currentLanguageStatusChanged ) Q_PROPERTY( QString currentLocationStatus READ currentLocationStatus NOTIFY currentLanguageStatusChanged )

View File

@ -13,8 +13,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "Settings.h" #include "Settings.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@ -56,23 +56,29 @@ SetTimezoneJob::exec()
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QFileInfo zoneFile( gs->value( "rootMountPoint" ).toString() + zoneinfoPath ); QFileInfo zoneFile( gs->value( "rootMountPoint" ).toString() + zoneinfoPath );
if ( !zoneFile.exists() || !zoneFile.isReadable() ) if ( !zoneFile.exists() || !zoneFile.isReadable() )
{
return Calamares::JobResult::error( tr( "Cannot access selected timezone path." ), return Calamares::JobResult::error( tr( "Cannot access selected timezone path." ),
tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) ); tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) );
}
// Make sure /etc/localtime doesn't exist, otherwise symlinking will fail // Make sure /etc/localtime doesn't exist, otherwise symlinking will fail
Calamares::System::instance()->targetEnvCall( { "rm", "-f", localtimeSlink } ); Calamares::System::instance()->targetEnvCall( { "rm", "-f", localtimeSlink } );
int ec = Calamares::System::instance()->targetEnvCall( { "ln", "-s", zoneinfoPath, localtimeSlink } ); int ec = Calamares::System::instance()->targetEnvCall( { "ln", "-s", zoneinfoPath, localtimeSlink } );
if ( ec ) if ( ec )
{
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "Cannot set timezone." ), tr( "Cannot set timezone." ),
tr( "Link creation failed, target: %1; link name: %2" ).arg( zoneinfoPath ).arg( "/etc/localtime" ) ); tr( "Link creation failed, target: %1; link name: %2" ).arg( zoneinfoPath ).arg( "/etc/localtime" ) );
}
QFile timezoneFile( gs->value( "rootMountPoint" ).toString() + "/etc/timezone" ); QFile timezoneFile( gs->value( "rootMountPoint" ).toString() + "/etc/timezone" );
if ( !timezoneFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ) if ( !timezoneFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
{
return Calamares::JobResult::error( tr( "Cannot set timezone," ), return Calamares::JobResult::error( tr( "Cannot set timezone," ),
tr( "Cannot open /etc/timezone for writing" ) ); tr( "Cannot open /etc/timezone for writing" ) );
}
QTextStream out( &timezoneFile ); QTextStream out( &timezoneFile );
out << m_region << '/' << m_zone << "\n"; out << m_region << '/' << m_zone << "\n";

View File

@ -310,7 +310,8 @@ LocaleTests::testLanguageDetection_data()
<< QStringLiteral( "en_US.UTF-8" ); << QStringLiteral( "en_US.UTF-8" );
QTest::newRow( "english (GB)" ) << QStringLiteral( "en" ) << QStringLiteral( "GB" ) QTest::newRow( "english (GB)" ) << QStringLiteral( "en" ) << QStringLiteral( "GB" )
<< QStringLiteral( "en_GB.UTF-8" ); << QStringLiteral( "en_GB.UTF-8" );
QTest::newRow( "english (NL)" ) << QStringLiteral( "en" ) << QStringLiteral( "NL" ) << QStringLiteral( "en_US.UTF-8" ); QTest::newRow( "english (NL)" ) << QStringLiteral( "en" ) << QStringLiteral( "NL" )
<< QStringLiteral( "en_US.UTF-8" );
QTest::newRow( "portuguese (PT)" ) << QStringLiteral( "pt" ) << QStringLiteral( "PT" ) QTest::newRow( "portuguese (PT)" ) << QStringLiteral( "pt" ) << QStringLiteral( "PT" )
<< QStringLiteral( "pt_PT.UTF-8" ); << QStringLiteral( "pt_PT.UTF-8" );

View File

@ -7,10 +7,10 @@
#include "LuksBootKeyFileJob.h" #include "LuksBootKeyFileJob.h"
#include "utils/System.h"
#include "utils/Entropy.h" #include "utils/Entropy.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NamedEnum.h" #include "utils/NamedEnum.h"
#include "utils/System.h"
#include "utils/UMask.h" #include "utils/UMask.h"
#include "utils/Variant.h" #include "utils/Variant.h"

View File

@ -10,11 +10,11 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Permissions.h" #include "utils/Permissions.h"
#include "utils/PluginFactory.h" #include "utils/PluginFactory.h"
#include "utils/String.h" #include "utils/String.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include <QList> #include <QList>

View File

@ -10,8 +10,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QtTest/QtTest> #include <QtTest/QtTest>

View File

@ -13,8 +13,8 @@
#include "MachineIdJob.h" #include "MachineIdJob.h"
#include "Workers.h" #include "Workers.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"

View File

@ -12,8 +12,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>

View File

@ -12,9 +12,9 @@
#include "Workers.h" #include "Workers.h"
#include "utils/System.h"
#include "utils/Entropy.h" #include "utils/Entropy.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QFile> #include <QFile>

View File

@ -241,6 +241,7 @@ void
PackageTreeItem::setChildrenSelected( Qt::CheckState isSelected ) PackageTreeItem::setChildrenSelected( Qt::CheckState isSelected )
{ {
if ( isSelected != Qt::PartiallyChecked ) if ( isSelected != Qt::PartiallyChecked )
{
// Children are never root; don't need to use setSelected on them. // Children are never root; don't need to use setSelected on them.
for ( auto child : m_childItems ) for ( auto child : m_childItems )
{ {
@ -248,6 +249,7 @@ PackageTreeItem::setChildrenSelected( Qt::CheckState isSelected )
child->setChildrenSelected( isSelected ); child->setChildrenSelected( isSelected );
} }
} }
}
void void
PackageTreeItem::removeChild( int row ) PackageTreeItem::removeChild( int row )

View File

@ -11,8 +11,8 @@
#include "DllMacro.h" #include "DllMacro.h"
#include "locale/TranslatableConfiguration.h" #include "locale/TranslatableConfiguration.h"
#include "utils/System.h"
#include "utils/PluginFactory.h" #include "utils/PluginFactory.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "viewpages/QmlViewStep.h" #include "viewpages/QmlViewStep.h"

View File

@ -77,10 +77,12 @@ IDJob::exec()
// Don't bother translating internal errors // Don't bother translating internal errors
if ( rootMount.isEmpty() && Calamares::Settings::instance()->doChroot() ) if ( rootMount.isEmpty() && Calamares::Settings::instance()->doChroot() )
{
return Calamares::JobResult::internalError( "OEM Batch Identifier", return Calamares::JobResult::internalError( "OEM Batch Identifier",
"No rootMountPoint is set, but a chroot is required. " "No rootMountPoint is set, but a chroot is required. "
"Is there a module before oemid that sets up the partitions?", "Is there a module before oemid that sets up the partitions?",
Calamares::JobResult::InvalidConfiguration ); Calamares::JobResult::InvalidConfiguration );
}
return writeId( Calamares::Settings::instance()->doChroot() ? rootMount + targetDir : targetDir, return writeId( Calamares::Settings::instance()->doChroot() ? rootMount + targetDir : targetDir,
targetFile, targetFile,
m_batchIdentifier ); m_batchIdentifier );

View File

@ -16,8 +16,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "locale/TranslatableConfiguration.h" #include "locale/TranslatableConfiguration.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include <QDesktopServices> #include <QDesktopServices>

View File

@ -13,8 +13,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "locale/TranslatableConfiguration.h" #include "locale/TranslatableConfiguration.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
CALAMARES_PLUGIN_FACTORY_DEFINITION( PackageChooserQmlViewStepFactory, registerPlugin< PackageChooserQmlViewStep >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( PackageChooserQmlViewStepFactory, registerPlugin< PackageChooserQmlViewStep >(); )

View File

@ -156,9 +156,11 @@ colorForPartition( Partition* partition )
} }
} }
else else
{
s_partitionColorsCache.insert( partition->fileSystem().uuid(), s_partitionColorsCache.insert( partition->fileSystem().uuid(),
PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ] ); PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ] );
} }
}
return PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ]; return PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ];
} }

View File

@ -11,8 +11,8 @@
#include "DeviceList.h" #include "DeviceList.h"
#include "partition/PartitionIterator.h" #include "partition/PartitionIterator.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <kpmcore/backend/corebackend.h> #include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h> #include <kpmcore/backend/corebackendmanager.h>
@ -34,10 +34,12 @@ static bool
hasRootPartition( Device* device ) hasRootPartition( Device* device )
{ {
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() == "/" ) if ( ( *it )->mountPoint() == "/" )
{ {
return true; return true;
} }
}
return false; return false;
} }

View File

@ -128,8 +128,7 @@ int cryptVersion( Partition* partition );
* *
* @return The LUKS FS type (default @c luks ) * @return The LUKS FS type (default @c luks )
*/ */
FileSystem::Type FileSystem::Type luksGenerationToFSName( Config::LuksGeneration luksGeneration );
luksGenerationToFSName( Config::LuksGeneration luksGeneration );
/** @brief Return a result for an @p operation /** @brief Return a result for an @p operation

View File

@ -20,9 +20,9 @@
#include "partition/Mount.h" #include "partition/Mount.h"
#include "partition/PartitionIterator.h" #include "partition/PartitionIterator.h"
#include "partition/PartitionQuery.h" #include "partition/PartitionQuery.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/RAII.h" #include "utils/RAII.h"
#include "utils/System.h"
#include <kpmcore/backend/corebackend.h> #include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h> #include <kpmcore/backend/corebackendmanager.h>
@ -595,11 +595,15 @@ FstabEntry::fromEtcFstab( const QString& rawLine )
{ {
QString line = rawLine.simplified(); QString line = rawLine.simplified();
if ( line.startsWith( '#' ) ) if ( line.startsWith( '#' ) )
{
return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 }; return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 };
}
QStringList splitLine = line.split( ' ' ); QStringList splitLine = line.split( ' ' );
if ( splitLine.length() != 6 ) if ( splitLine.length() != 6 )
{
return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 }; return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 };
}
return FstabEntry { return FstabEntry {
splitLine.at( 0 ), // path, or UUID, or LABEL, etc. splitLine.at( 0 ), // path, or UUID, or LABEL, etc.

View File

@ -18,9 +18,9 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NamedEnum.h" #include "utils/NamedEnum.h"
#include "utils/System.h"
#include "utils/Units.h" #include "utils/Units.h"
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>

View File

@ -315,6 +315,7 @@ PartitionCoreModule::doInit()
DeviceList bootLoaderDevices; DeviceList bootLoaderDevices;
for ( DeviceList::Iterator it = devices.begin(); it != devices.end(); ++it ) for ( DeviceList::Iterator it = devices.begin(); it != devices.end(); ++it )
{
if ( ( *it )->type() != Device::Type::Disk_Device ) if ( ( *it )->type() != Device::Type::Disk_Device )
{ {
cDebug() << "Ignoring device that is not Disk_Device to bootLoaderDevices list."; cDebug() << "Ignoring device that is not Disk_Device to bootLoaderDevices list.";
@ -324,6 +325,7 @@ PartitionCoreModule::doInit()
{ {
bootLoaderDevices.append( *it ); bootLoaderDevices.append( *it );
} }
}
m_bootLoaderModel->init( bootLoaderDevices ); m_bootLoaderModel->init( bootLoaderDevices );
@ -482,10 +484,12 @@ PartitionCoreModule::deletePartition( Device* device, Partition* partition )
// deleting them, so let's play it safe and keep our own list. // deleting them, so let's play it safe and keep our own list.
QList< Partition* > lst; QList< Partition* > lst;
for ( auto childPartition : partition->children() ) for ( auto childPartition : partition->children() )
{
if ( !isPartitionFreeSpace( childPartition ) ) if ( !isPartitionFreeSpace( childPartition ) )
{ {
lst << childPartition; lst << childPartition;
} }
}
for ( auto childPartition : lst ) for ( auto childPartition : lst )
{ {
@ -781,11 +785,13 @@ PartitionCoreModule::updateIsDirty()
bool oldValue = m_isDirty; bool oldValue = m_isDirty;
m_isDirty = false; m_isDirty = false;
for ( auto info : m_deviceInfos ) for ( auto info : m_deviceInfos )
{
if ( info->isDirty() ) if ( info->isDirty() )
{ {
m_isDirty = true; m_isDirty = true;
break; break;
} }
}
if ( oldValue != m_isDirty ) if ( oldValue != m_isDirty )
{ {
isDirtyChanged( m_isDirty ); isDirtyChanged( m_isDirty );
@ -806,8 +812,7 @@ PartitionCoreModule::scanForEfiSystemPartitions()
devices.append( device ); devices.append( device );
} }
QList< Partition* > efiSystemPartitions QList< Partition* > efiSystemPartitions = Calamares::Partition::findPartitions( devices, PartUtils::isEfiBootable );
= Calamares::Partition::findPartitions( devices, PartUtils::isEfiBootable );
if ( efiSystemPartitions.isEmpty() ) if ( efiSystemPartitions.isEmpty() )
{ {
@ -853,6 +858,7 @@ PartitionCoreModule::scanForLVMPVs()
m_lvmPVs << p.partition().data(); m_lvmPVs << p.partition().data();
for ( LvmDevice* device : vgDevices ) for ( LvmDevice* device : vgDevices )
{
if ( p.vgName() == device->name() ) if ( p.vgName() == device->name() )
{ {
// Adding scanned VG to PV list // Adding scanned VG to PV list
@ -860,6 +866,7 @@ PartitionCoreModule::scanForLVMPVs()
break; break;
} }
} }
}
for ( DeviceInfo* d : m_deviceInfos ) for ( DeviceInfo* d : m_deviceInfos )
{ {
@ -924,11 +931,13 @@ PartitionCoreModule::findPartitionByMountPoint( const QString& mountPoint ) cons
{ {
Device* device = deviceInfo->device.data(); Device* device = deviceInfo->device.data();
for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it ) for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it )
{
if ( PartitionInfo::mountPoint( *it ) == mountPoint ) if ( PartitionInfo::mountPoint( *it ) == mountPoint )
{ {
return *it; return *it;
} }
} }
}
return nullptr; return nullptr;
} }
@ -1144,10 +1153,12 @@ bool
PartitionCoreModule::isVGdeactivated( LvmDevice* device ) PartitionCoreModule::isVGdeactivated( LvmDevice* device )
{ {
for ( DeviceInfo* deviceInfo : m_deviceInfos ) for ( DeviceInfo* deviceInfo : m_deviceInfos )
{
if ( device == deviceInfo->device.data() && !deviceInfo->isAvailable ) if ( device == deviceInfo->device.data() && !deviceInfo->isAvailable )
{ {
return true; return true;
} }
}
return false; return false;
} }

View File

@ -205,8 +205,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
name = isPartitionNew( partition ) ? tr( "New partition" ) : partition->partitionPath(); name = isPartitionNew( partition ) ? tr( "New partition" ) : partition->partitionPath();
} }
} }
QString prettyFileSystem QString prettyFileSystem = Calamares::Partition::prettyNameForFileSystemType( partition->fileSystem().type() );
= Calamares::Partition::prettyNameForFileSystemType( partition->fileSystem().type() );
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize(); qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
QString prettySize = formatByteSize( size ); QString prettySize = formatByteSize( size );
return QVariant( name + " " + prettyFileSystem + " " + prettySize ); return QVariant( name + " " + prettyFileSystem + " " + prettySize );
@ -239,43 +238,53 @@ PartitionModel::data( const QModelIndex& index, int role ) const
// Osprober roles: // Osprober roles:
case OsproberNameRole: case OsproberNameRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
{
if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone
&& !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() ) && !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() )
{ {
return osproberEntry.prettyName; return osproberEntry.prettyName;
} }
}
return QVariant(); return QVariant();
case OsproberPathRole: case OsproberPathRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
{
if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone
&& !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() ) && !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() )
{ {
return osproberEntry.path; return osproberEntry.path;
} }
}
return QVariant(); return QVariant();
case OsproberCanBeResizedRole: case OsproberCanBeResizedRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
{
if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone
&& !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() ) && !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() )
{ {
return osproberEntry.canBeResized; return osproberEntry.canBeResized;
} }
}
return QVariant(); return QVariant();
case OsproberRawLineRole: case OsproberRawLineRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
{
if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone
&& !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() ) && !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() )
{ {
return osproberEntry.line; return osproberEntry.line;
} }
}
return QVariant(); return QVariant();
case OsproberHomePartitionPathRole: case OsproberHomePartitionPathRole:
foreach ( const OsproberEntry& osproberEntry, m_osproberEntries ) foreach ( const OsproberEntry& osproberEntry, m_osproberEntries )
{
if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone if ( partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone
&& !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() ) && !partition->fileSystem().uuid().isEmpty() && osproberEntry.uuid == partition->fileSystem().uuid() )
{ {
return osproberEntry.homePath; return osproberEntry.homePath;
} }
}
return QVariant(); return QVariant();
// end Osprober roles. // end Osprober roles.

View File

@ -206,10 +206,12 @@ createCombo( const QSet< SwapChoice >& s, SwapChoice dflt )
SwapChoice::FullSwap, SwapChoice::FullSwap,
SwapChoice::ReuseSwap, SwapChoice::ReuseSwap,
SwapChoice::SwapFile } ) SwapChoice::SwapFile } )
{
if ( s.contains( c ) ) if ( s.contains( c ) )
{ {
box->addItem( QString(), c ); box->addItem( QString(), c );
} }
}
int dfltIndex = box->findData( dflt ); int dfltIndex = box->findData( dflt );
if ( dfltIndex >= 0 ) if ( dfltIndex >= 0 )
@ -851,10 +853,12 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
// m_reuseHomeCheckBox visible and set its text to something meaningful. // m_reuseHomeCheckBox visible and set its text to something meaningful.
homePartitionPath->clear(); homePartitionPath->clear();
for ( const OsproberEntry& osproberEntry : m_core->osproberEntries() ) for ( const OsproberEntry& osproberEntry : m_core->osproberEntries() )
{
if ( osproberEntry.path == partPath ) if ( osproberEntry.path == partPath )
{ {
*homePartitionPath = osproberEntry.homePath; *homePartitionPath = osproberEntry.homePath;
} }
}
if ( homePartitionPath->isEmpty() ) if ( homePartitionPath->isEmpty() )
{ {
doReuseHomePartition = false; doReuseHomePartition = false;
@ -888,17 +892,23 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
{ {
m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() ); m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() );
if ( !homePartitionPath->isEmpty() ) if ( !homePartitionPath->isEmpty() )
{
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." ) m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
.arg( *homePartitionPath ) .arg( *homePartitionPath )
.arg( Calamares::Branding::instance()->shortProductName() ) ); .arg( Calamares::Branding::instance()->shortProductName() ) );
}
delete homePartitionPath; delete homePartitionPath;
if ( m_isEfi ) if ( m_isEfi )
{
setupEfiSystemPartitionSelector(); setupEfiSystemPartitionSelector();
}
updateNextEnabled(); updateNextEnabled();
if ( !m_bootloaderComboBox.isNull() && m_bootloaderComboBox->currentIndex() < 0 ) if ( !m_bootloaderComboBox.isNull() && m_bootloaderComboBox->currentIndex() < 0 )
{
m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex );
}
}, },
this ); this );
} }

View File

@ -250,7 +250,8 @@ CreatePartitionDialog::getNewlyCreatedPartition()
if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && !luksPassphrase.isEmpty() if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && !luksPassphrase.isEmpty()
&& fsType != FileSystem::Zfs ) && fsType != FileSystem::Zfs )
{ {
partition = KPMHelpers::createNewEncryptedPartition( m_parent, partition = KPMHelpers::createNewEncryptedPartition(
m_parent,
*m_device, *m_device,
m_role, m_role,
fsType, fsType,

View File

@ -223,10 +223,12 @@ PartitionLabelsView::buildTexts( const QModelIndex& index ) const
secondLine = index.sibling( index.row(), PartitionModel::SizeColumn ).data().toString(); secondLine = index.sibling( index.row(), PartitionModel::SizeColumn ).data().toString();
} }
else else
{
//: size[number] filesystem[name] //: size[number] filesystem[name]
secondLine = tr( "%1 %2" ) secondLine = tr( "%1 %2" )
.arg( index.sibling( index.row(), PartitionModel::SizeColumn ).data().toString() ) .arg( index.sibling( index.row(), PartitionModel::SizeColumn ).data().toString() )
.arg( index.sibling( index.row(), PartitionModel::FileSystemColumn ).data().toString() ); .arg( index.sibling( index.row(), PartitionModel::FileSystemColumn ).data().toString() );
}
return { firstLine, secondLine }; return { firstLine, secondLine };
} }

View File

@ -284,10 +284,12 @@ PartitionPage::onNewVolumeGroupClicked()
QVector< const Partition* > availablePVs; QVector< const Partition* > availablePVs;
for ( const Partition* p : m_core->lvmPVs() ) for ( const Partition* p : m_core->lvmPVs() )
{
if ( !m_core->isInVG( p ) ) if ( !m_core->isInVG( p ) )
{ {
availablePVs << p; availablePVs << p;
} }
}
QPointer< CreateVolumeGroupDialog > dlg QPointer< CreateVolumeGroupDialog > dlg
= new CreateVolumeGroupDialog( vgName, selectedPVs, availablePVs, peSize, this ); = new CreateVolumeGroupDialog( vgName, selectedPVs, availablePVs, peSize, this );
@ -342,10 +344,12 @@ PartitionPage::onResizeVolumeGroupClicked()
QVector< const Partition* > selectedPVs; QVector< const Partition* > selectedPVs;
for ( const Partition* p : m_core->lvmPVs() ) for ( const Partition* p : m_core->lvmPVs() )
{
if ( !m_core->isInVG( p ) ) if ( !m_core->isInVG( p ) )
{ {
availablePVs << p; availablePVs << p;
} }
}
QPointer< ResizeVolumeGroupDialog > dlg = new ResizeVolumeGroupDialog( device, availablePVs, selectedPVs, this ); QPointer< ResizeVolumeGroupDialog > dlg = new ResizeVolumeGroupDialog( device, availablePVs, selectedPVs, this );

View File

@ -16,8 +16,8 @@
#include "partition/FileSystem.h" #include "partition/FileSystem.h"
#include "partition/PartitionQuery.h" #include "partition/PartitionQuery.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Units.h" #include "utils/Units.h"
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>

View File

@ -12,8 +12,8 @@
#include "CreatePartitionTableJob.h" #include "CreatePartitionTableJob.h"
#include "partition/PartitionIterator.h" #include "partition/PartitionIterator.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"

View File

@ -11,9 +11,9 @@
#include "FillGlobalStorageJob.h" #include "FillGlobalStorageJob.h"
#include "compat/Variant.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "core/PartitionInfo.h" #include "core/PartitionInfo.h"
#include "compat/Variant.h"
#include "Branding.h" #include "Branding.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"

View File

@ -14,8 +14,8 @@
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "partition/FileSystem.h" #include "partition/FileSystem.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>

View File

@ -104,10 +104,12 @@ static ::Partition*
firstFreePartition( PartitionNode* parent ) firstFreePartition( PartitionNode* parent )
{ {
for ( auto child : parent->children() ) for ( auto child : parent->children() )
{
if ( Calamares::Partition::isPartitionFreeSpace( child ) ) if ( Calamares::Partition::isPartitionFreeSpace( child ) )
{ {
return child; return child;
} }
}
return nullptr; return nullptr;
} }

View File

@ -12,8 +12,8 @@
#include "PlasmaLnfJob.h" #include "PlasmaLnfJob.h"
#include "ThemeInfo.h" #include "ThemeInfo.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#ifdef WITH_KCONFIG #ifdef WITH_KCONFIG
@ -76,6 +76,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
// about the themes from Plasma (e.g. human-readable name and description) // about the themes from Plasma (e.g. human-readable name and description)
// are filled in by update_names() in PlasmaLnfPage. // are filled in by update_names() in PlasmaLnfPage.
for ( const auto& i : themeList ) for ( const auto& i : themeList )
{
if ( i.type() == QVariant::Map ) if ( i.type() == QVariant::Map )
{ {
auto iv = i.toMap(); auto iv = i.toMap();
@ -85,6 +86,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
listedThemes.insert( i.toString(), QString() ); listedThemes.insert( i.toString(), QString() );
} }
}
if ( listedThemes.count() == 1 ) if ( listedThemes.count() == 1 )
{ {

View File

@ -11,8 +11,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#ifdef WITH_KCONFIG #ifdef WITH_KCONFIG
#include <KConfigGroup> #include <KConfigGroup>

View File

@ -76,15 +76,19 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
CALAMARES_RETRANSLATE( { CALAMARES_RETRANSLATE( {
ui->retranslateUi( this ); ui->retranslateUi( this );
if ( Calamares::Settings::instance()->isSetupMode() ) if ( Calamares::Settings::instance()->isSetupMode() )
{
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. " ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. "
"You can also skip this step and configure the look-and-feel " "You can also skip this step and configure the look-and-feel "
"once the system is set up. Clicking on a look-and-feel " "once the system is set up. Clicking on a look-and-feel "
"selection will give you a live preview of that look-and-feel." ) ); "selection will give you a live preview of that look-and-feel." ) );
}
else else
{
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. " ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. "
"You can also skip this step and configure the look-and-feel " "You can also skip this step and configure the look-and-feel "
"once the system is installed. Clicking on a look-and-feel " "once the system is installed. Clicking on a look-and-feel "
"selection will give you a live preview of that look-and-feel." ) ); "selection will give you a live preview of that look-and-feel." ) );
}
} ); } );
auto* view = new QListView( this ); auto* view = new QListView( this );

View File

@ -10,8 +10,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "compat/Variant.h" #include "compat/Variant.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Units.h" #include "utils/Units.h"
#include "utils/Variant.h" #include "utils/Variant.h"

View File

@ -13,10 +13,10 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "compat/Variant.h" #include "compat/Variant.h"
#include "utils/System.h"
#include "utils/CommandList.h" #include "utils/CommandList.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/StringExpander.h" #include "utils/StringExpander.h"
#include "utils/System.h"
#include "utils/Units.h" #include "utils/Units.h"
#include <QFile> #include <QFile>

View File

@ -10,9 +10,9 @@
#include "Item.h" #include "Item.h"
#include "Settings.h" #include "Settings.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NamedEnum.h" #include "utils/NamedEnum.h"
#include "utils/System.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
#include <QtTest/QtTest> #include <QtTest/QtTest>

View File

@ -13,8 +13,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include <QFile> #include <QFile>

View File

@ -14,8 +14,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "network/Manager.h" #include "network/Manager.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <KMacroExpander> #include <KMacroExpander>

View File

@ -16,8 +16,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include <QDesktopServices> #include <QDesktopServices>

View File

@ -11,8 +11,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>

View File

@ -15,8 +15,8 @@
#include "UmountJob.h" #include "UmountJob.h"
#include "partition/Mount.h" #include "partition/Mount.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"

View File

@ -11,9 +11,9 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Permissions.h" #include "utils/Permissions.h"
#include "utils/System.h"
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>

View File

@ -14,9 +14,9 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Permissions.h" #include "utils/Permissions.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>

View File

@ -13,8 +13,8 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QDBusConnection> #include <QDBusConnection>
#include <QDBusInterface> #include <QDBusInterface>

View File

@ -12,9 +12,9 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Entropy.h" #include "utils/Entropy.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include <QDir> #include <QDir>
@ -74,15 +74,19 @@ SetPasswordJob::exec()
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QDir destDir( gs->value( "rootMountPoint" ).toString() ); QDir destDir( gs->value( "rootMountPoint" ).toString() );
if ( !destDir.exists() ) if ( !destDir.exists() )
{
return Calamares::JobResult::error( tr( "Bad destination system path." ), return Calamares::JobResult::error( tr( "Bad destination system path." ),
tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) ); tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) );
}
if ( m_userName == "root" && m_newPassword.isEmpty() ) //special case for disabling root account if ( m_userName == "root" && m_newPassword.isEmpty() ) //special case for disabling root account
{ {
int ec = Calamares::System::instance()->targetEnvCall( { "usermod", "-p", "!", m_userName } ); int ec = Calamares::System::instance()->targetEnvCall( { "usermod", "-p", "!", m_userName } );
if ( ec ) if ( ec )
{
return Calamares::JobResult::error( tr( "Cannot disable root account." ), return Calamares::JobResult::error( tr( "Cannot disable root account." ),
tr( "usermod terminated with error code %1." ).arg( ec ) ); tr( "usermod terminated with error code %1." ).arg( ec ) );
}
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
@ -90,8 +94,10 @@ SetPasswordJob::exec()
int ec = Calamares::System::instance()->targetEnvCall( { "usermod", "-p", encrypted, m_userName } ); int ec = Calamares::System::instance()->targetEnvCall( { "usermod", "-p", encrypted, m_userName } );
if ( ec ) if ( ec )
{
return Calamares::JobResult::error( tr( "Cannot set password for user %1." ).arg( m_userName ), return Calamares::JobResult::error( tr( "Cannot set password for user %1." ).arg( m_userName ),
tr( "usermod terminated with error code %1." ).arg( ec ) ); tr( "usermod terminated with error code %1." ).arg( ec ) );
}
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }

View File

@ -16,8 +16,8 @@ extern bool setSystemdHostname( const QString& );
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
#include <QTemporaryDir> #include <QTemporaryDir>

View File

@ -12,8 +12,8 @@
#include "Branding.h" #include "Branding.h"
#include "Settings.h" #include "Settings.h"
#include "network/Manager.h" #include "network/Manager.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Yaml.h" #include "utils/Yaml.h"
#include <QtTest/QtTest> #include <QtTest/QtTest>

View File

@ -29,7 +29,7 @@ namespace GeoIP
{ {
class Handler; class Handler;
} // namespace GeoIP } // namespace GeoIP
} // namespace CalamaresUtils } // namespace Calamares
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
{ {

View File

@ -23,9 +23,9 @@
#include "modulesystem/Requirement.h" #include "modulesystem/Requirement.h"
#include "network/Manager.h" #include "network/Manager.h"
#include "utils/Gui.h" #include "utils/Gui.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "utils/System.h"
#include "utils/Units.h" #include "utils/Units.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "widgets/WaitingWidget.h" #include "widgets/WaitingWidget.h"
@ -367,10 +367,12 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
// Help out with consistency, but don't fix // Help out with consistency, but don't fix
for ( const auto& r : m_entriesToRequire ) for ( const auto& r : m_entriesToRequire )
{
if ( !m_entriesToCheck.contains( r ) ) if ( !m_entriesToCheck.contains( r ) )
{ {
cWarning() << "GeneralRequirements requires" << r << "but does not check it."; cWarning() << "GeneralRequirements requires" << r << "but does not check it.";
} }
}
if ( configurationMap.contains( "requiredStorage" ) if ( configurationMap.contains( "requiredStorage" )
&& ( Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::DoubleVariantType && ( Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::DoubleVariantType

View File

@ -27,7 +27,7 @@ namespace GeoIP
{ {
class Handler; class Handler;
} // namespace GeoIP } // namespace GeoIP
} // namespace CalamaresUtils } // namespace Calamares
// TODO: refactor and move what makes sense to base class // TODO: refactor and move what makes sense to base class

View File

@ -9,8 +9,8 @@
#include "ZfsJob.h" #include "ZfsJob.h"
#include "utils/System.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"