Merge branch 'calamares' into non-ascii
This commit is contained in:
commit
5a56188a51
16
CHANGES-3.3
16
CHANGES-3.3
@ -10,11 +10,23 @@ the history of the 3.2 series (2018-05 - 2022-08).
|
||||
# 3.3.7 (unreleased)
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Nobody, yet
|
||||
- Adriaan de Groot
|
||||
- Eugene San
|
||||
- Evan James
|
||||
- Vincent Penvern
|
||||
- Vladislav Nepogodin
|
||||
|
||||
## Core ##
|
||||
- Updated clang-formatting
|
||||
- Some C++20 future-proofing (thanks Vladislav)
|
||||
|
||||
## Modules ##
|
||||
- *fstab* module does not add an encryption keyfile if it does
|
||||
not exist. (thanks Eugene)
|
||||
- *partition* module did not filter out invalid fstab entries;
|
||||
they were not written, either, so no net change.
|
||||
- *partition* module now has a configurable default check-state
|
||||
for the encryption checkbox. (thanks Vincent)
|
||||
|
||||
|
||||
# 3.3.6 (2024-04-16)
|
||||
@ -22,7 +34,7 @@ This release contains contributions from (alphabetically by first name):
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Adriaan de Groot
|
||||
- Anke Boersma
|
||||
- Eugene Sam
|
||||
- Eugene San
|
||||
- Evan James
|
||||
- Harald Sitter
|
||||
- Mike Stemle
|
||||
|
@ -22,15 +22,6 @@ static const char s_footer[]
|
||||
"and the <a href=\"https://app.transifex.com/calamares/calamares/\">Calamares "
|
||||
"translators team</a>." );
|
||||
|
||||
#if 0
|
||||
// Blue Systems sponsored until June 2022
|
||||
static const char s_sponsor[] = QT_TRANSLATE_NOOP( "AboutData",
|
||||
"<a href=\"https://calamares.io/\">Calamares</a> "
|
||||
"development is sponsored by <br/>"
|
||||
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
||||
"Liberating Software." );
|
||||
#endif
|
||||
|
||||
struct Maintainer
|
||||
{
|
||||
unsigned int start;
|
||||
@ -57,14 +48,12 @@ static constexpr const Maintainer maintainers[] = {
|
||||
static QString
|
||||
aboutMaintainers()
|
||||
{
|
||||
return std::accumulate( std::cbegin( maintainers ),
|
||||
std::cend( maintainers ),
|
||||
QString(),
|
||||
[]( QString& s, const Maintainer& m )
|
||||
QStringList s;
|
||||
for ( const auto& m : maintainers )
|
||||
{
|
||||
s += m.text();
|
||||
return s;
|
||||
} );
|
||||
s.append( m.text() );
|
||||
}
|
||||
return s.join( QString() );
|
||||
}
|
||||
|
||||
static QString
|
||||
|
23
src/libcalamares/compat/Size.h
Normal file
23
src/libcalamares/compat/Size.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2024 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef CALAMARES_COMPAT_SIZE_H
|
||||
#define CALAMARES_COMPAT_SIZE_H
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
/* Compatibility of size types (e.g. qsizetype, STL sizes, int) between Qt5 and Qt6 */
|
||||
|
||||
using NumberForTr = int;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -11,6 +11,7 @@
|
||||
#include "RequirementsChecker.h"
|
||||
|
||||
#include "compat/Mutex.h"
|
||||
#include "compat/Size.h"
|
||||
#include "modulesystem/Module.h"
|
||||
#include "modulesystem/Requirement.h"
|
||||
#include "modulesystem/RequirementsModel.h"
|
||||
@ -120,7 +121,7 @@ RequirementsChecker::reportProgress()
|
||||
{
|
||||
cDebug() << "Remaining modules:" << remaining << Logger::DebugList( remainingNames );
|
||||
unsigned int posInterval = ( m_progressTimer->interval() < 0 ) ? 1000 : uint( m_progressTimer->interval() );
|
||||
QString waiting = tr( "Waiting for %n module(s)…", "@status", remaining );
|
||||
QString waiting = tr( "Waiting for %n module(s)…", "@status", static_cast<Calamares::NumberForTr>(remaining) );
|
||||
QString elapsed = tr( "(%n second(s))", "@status", m_progressTimeouts * posInterval / 999 );
|
||||
Q_EMIT requirementsProgress( waiting + QString( " " ) + elapsed );
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ RequirementsModel::reCheckList()
|
||||
int
|
||||
RequirementsModel::rowCount( const QModelIndex& ) const
|
||||
{
|
||||
return m_requirements.count();
|
||||
return static_cast< int >( m_requirements.count() ); // TODO 3.4 use qsizetype
|
||||
}
|
||||
|
||||
QVariant
|
||||
|
@ -61,8 +61,8 @@ public:
|
||||
|
||||
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
int rowCount( const QModelIndex& ) const override;
|
||||
int count() const { return m_requirements.count(); }
|
||||
int rowCount( const QModelIndex& ) const override; // TODO 3.4 use qsizetype
|
||||
int count() const { return static_cast< int >( m_requirements.count() ); } // TODO 3.4 use qsizetype
|
||||
|
||||
///@brief Debugging tool, describe the checking-state
|
||||
void describe() const;
|
||||
|
@ -151,8 +151,12 @@ class FstabGenerator(object):
|
||||
if not mapper_name or not luks_uuid:
|
||||
return None
|
||||
|
||||
password = "/crypto_keyfile.bin"
|
||||
crypttab_options = self.crypttab_options
|
||||
# Make sure to not use missing keyfile
|
||||
if os.path.isfile(os.path.join(self.root_mount_point, "crypto_keyfile.bin")):
|
||||
password = "/crypto_keyfile.bin"
|
||||
else:
|
||||
password = "none"
|
||||
|
||||
# Set crypttab password for partition to none and remove crypttab options
|
||||
# if root partition was not encrypted
|
||||
|
@ -11,6 +11,8 @@ he us - he
|
||||
ar us - ar
|
||||
ir us - fa
|
||||
|
||||
# This list is from /usr/share/X11/xkb/rules/base, all the non-latin
|
||||
# layouts are collected in $nonlatin . Add us (English) to all of them.
|
||||
af us - af
|
||||
am us - am
|
||||
ara us - ara
|
||||
|
@ -60,6 +60,7 @@ if(KPMcore_FOUND)
|
||||
core/DeviceList.cpp
|
||||
core/DeviceModel.cpp
|
||||
core/KPMHelpers.cpp
|
||||
core/OsproberEntry.cpp
|
||||
core/PartitionActions.cpp
|
||||
core/PartitionCoreModule.cpp
|
||||
core/PartitionInfo.cpp
|
||||
|
@ -444,6 +444,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_allowZfsEncryption = Calamares::getBool( configurationMap, "allowZfsEncryption", true );
|
||||
|
||||
m_allowManualPartitioning = Calamares::getBool( configurationMap, "allowManualPartitioning", true );
|
||||
m_preCheckEncryption = Calamares::getBool( configurationMap, "preCheckEncryption", false );
|
||||
m_showNotEncryptedBootMessage = Calamares::getBool( configurationMap, "showNotEncryptedBootMessage", true );
|
||||
m_requiredPartitionTableType = Calamares::getStringList( configurationMap, "requiredPartitionTableType" );
|
||||
|
||||
|
@ -35,7 +35,7 @@ class Config : public QObject
|
||||
replaceModeFilesystemChanged )
|
||||
|
||||
Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL )
|
||||
|
||||
Q_PROPERTY( bool preCheckEncryption READ preCheckEncryption CONSTANT FINAL )
|
||||
Q_PROPERTY( bool showNotEncryptedBootMessage READ showNotEncryptedBootMessage CONSTANT FINAL )
|
||||
|
||||
public:
|
||||
@ -148,6 +148,13 @@ public:
|
||||
/// @brief Is manual partitioning allowed (not explicitly disabled in the config file)?
|
||||
bool allowManualPartitioning() const { return m_allowManualPartitioning; }
|
||||
|
||||
/** @brief Pre-check encryption checkbox.
|
||||
*
|
||||
* This is meaningful only if enableLuksAutomatedPartitioning is @c true.
|
||||
* Default value is @c false
|
||||
*/
|
||||
bool preCheckEncryption() const { return m_preCheckEncryption; }
|
||||
|
||||
/// @brief Show "Boot partition not encrypted" warning (not explicitly disabled in the config file)?
|
||||
bool showNotEncryptedBootMessage() const { return m_showNotEncryptedBootMessage; }
|
||||
|
||||
@ -199,6 +206,7 @@ private:
|
||||
QStringList m_requiredPartitionTableType;
|
||||
bool m_allowZfsEncryption = true;
|
||||
bool m_allowManualPartitioning = true;
|
||||
bool m_preCheckEncryption = false;
|
||||
bool m_showNotEncryptedBootMessage = true;
|
||||
};
|
||||
|
||||
|
@ -223,9 +223,15 @@ PartitionViewStep::prettyStatus() const
|
||||
const QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
|
||||
|
||||
cDebug() << "Summary for Partition" << list.length() << choice;
|
||||
auto joinDiskInfo = [ choice ]( QString& s, const PartitionCoreModule::SummaryInfo& i )
|
||||
{ return s + diskDescription( 1, i, choice ); };
|
||||
const QString diskInfoLabel = std::accumulate( list.begin(), list.end(), QString(), joinDiskInfo );
|
||||
const QString diskInfoLabel = [ &choice, &list ]()
|
||||
{
|
||||
QStringList s;
|
||||
for ( const auto& i : list )
|
||||
{
|
||||
s.append( diskDescription( 1, i, choice ) );
|
||||
}
|
||||
return s.join( QString() );
|
||||
}();
|
||||
const QString jobsLabel = jobDescriptions( jobs() ).join( QStringLiteral( "<br/>" ) );
|
||||
return diskInfoLabel + "<br/>" + jobsLabel;
|
||||
}
|
||||
|
63
src/modules/partition/core/OsproberEntry.cpp
Normal file
63
src/modules/partition/core/OsproberEntry.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
|
||||
* SPDX-FileCopyrightText: 2018-2019, 2024 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-FileCopyrightText: 2019 Collabora Ltd <arnaud.ferraris@collabora.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "OsproberEntry.h"
|
||||
|
||||
|
||||
bool
|
||||
FstabEntry::isValid() const
|
||||
{
|
||||
return !partitionNode.isEmpty() && !mountPoint.isEmpty() && !fsType.isEmpty();
|
||||
}
|
||||
|
||||
FstabEntry
|
||||
FstabEntry::fromEtcFstab( const QString& rawLine )
|
||||
{
|
||||
QString line = rawLine.simplified();
|
||||
if ( line.startsWith( '#' ) )
|
||||
{
|
||||
return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 };
|
||||
}
|
||||
|
||||
QStringList splitLine = line.split( ' ' );
|
||||
if ( splitLine.length() != 6 )
|
||||
{
|
||||
return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 };
|
||||
}
|
||||
|
||||
return FstabEntry {
|
||||
splitLine.at( 0 ), // path, or UUID, or LABEL, etc.
|
||||
splitLine.at( 1 ), // mount point
|
||||
splitLine.at( 2 ), // fs type
|
||||
splitLine.at( 3 ), // options
|
||||
splitLine.at( 4 ).toInt(), //dump
|
||||
splitLine.at( 5 ).toInt() //pass
|
||||
};
|
||||
}
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
FstabEntryList
|
||||
fromEtcFstabContents( const QStringList& fstabLines )
|
||||
{
|
||||
FstabEntryList fstabEntries;
|
||||
|
||||
for ( const QString& rawLine : fstabLines )
|
||||
{
|
||||
fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) );
|
||||
}
|
||||
const auto invalidEntries = std::remove_if(
|
||||
fstabEntries.begin(), fstabEntries.end(), []( const FstabEntry& x ) { return !x.isValid(); } );
|
||||
fstabEntries.erase( invalidEntries, fstabEntries.end() );
|
||||
return fstabEntries;
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
@ -32,11 +32,24 @@ struct FstabEntry
|
||||
* If the string isn't valid (e.g. comment-line, or broken
|
||||
* fstab entry) then the entry that is returned is invalid.
|
||||
*/
|
||||
static FstabEntry fromEtcFstab( const QString& ); // implemented in Partutils.cpp
|
||||
static FstabEntry fromEtcFstab( const QString& );
|
||||
};
|
||||
|
||||
typedef QList< FstabEntry > FstabEntryList;
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
/** @brief Returns valid entries from the lines of a fstab file */
|
||||
FstabEntryList fromEtcFstabContents( const QStringList& fstabLines );
|
||||
|
||||
/** @brief Returns valid entries from the byte-contents of a fstab file */
|
||||
inline FstabEntryList
|
||||
fromEtcFstabContents( const QByteArray& contents )
|
||||
{
|
||||
return fromEtcFstabContents( QString::fromLocal8Bit( contents ).split( '\n' ) );
|
||||
}
|
||||
} // namespace Calamares
|
||||
|
||||
struct OsproberEntry
|
||||
{
|
||||
QString prettyName;
|
||||
|
@ -254,30 +254,25 @@ lookForFstabEntries( const QString& partitionPath )
|
||||
|
||||
if ( fstabFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
const QStringList fstabLines = QString::fromLocal8Bit( fstabFile.readAll() ).split( '\n' );
|
||||
|
||||
for ( const QString& rawLine : fstabLines )
|
||||
{
|
||||
fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) );
|
||||
}
|
||||
const auto fstabLines = QString::fromLocal8Bit( fstabFile.readAll() ).split( '\n' );
|
||||
fstabFile.close();
|
||||
const int lineCount = fstabEntries.count();
|
||||
std::remove_if(
|
||||
fstabEntries.begin(), fstabEntries.end(), []( const FstabEntry& x ) { return !x.isValid(); } );
|
||||
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries from" << lineCount
|
||||
|
||||
const auto fstabEntries = Calamares::fromEtcFstabContents( fstabLines );
|
||||
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries from" << fstabLines.count()
|
||||
<< "lines in" << fstabFile.fileName();
|
||||
return fstabEntries;
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Could not read fstab from mounted fs";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Could not mount existing fs";
|
||||
return {};
|
||||
}
|
||||
|
||||
return fstabEntries;
|
||||
}
|
||||
|
||||
static QString
|
||||
@ -641,36 +636,3 @@ canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
|
||||
}
|
||||
|
||||
} // namespace PartUtils
|
||||
|
||||
/* Implementation of methods for FstabEntry, from OsproberEntry.h */
|
||||
|
||||
bool
|
||||
FstabEntry::isValid() const
|
||||
{
|
||||
return !partitionNode.isEmpty() && !mountPoint.isEmpty() && !fsType.isEmpty();
|
||||
}
|
||||
|
||||
FstabEntry
|
||||
FstabEntry::fromEtcFstab( const QString& rawLine )
|
||||
{
|
||||
QString line = rawLine.simplified();
|
||||
if ( line.startsWith( '#' ) )
|
||||
{
|
||||
return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 };
|
||||
}
|
||||
|
||||
QStringList splitLine = line.split( ' ' );
|
||||
if ( splitLine.length() != 6 )
|
||||
{
|
||||
return FstabEntry { QString(), QString(), QString(), QString(), 0, 0 };
|
||||
}
|
||||
|
||||
return FstabEntry {
|
||||
splitLine.at( 0 ), // path, or UUID, or LABEL, etc.
|
||||
splitLine.at( 1 ), // mount point
|
||||
splitLine.at( 2 ), // fs type
|
||||
splitLine.at( 3 ), // options
|
||||
splitLine.at( 4 ).toInt(), //dump
|
||||
splitLine.at( 5 ).toInt() //pass
|
||||
};
|
||||
}
|
||||
|
@ -185,7 +185,6 @@ ChoicePage::init( PartitionCoreModule* core )
|
||||
setModelToComboBox( m_drivesCombo, core->deviceModel() );
|
||||
|
||||
connect( m_drivesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), this, &ChoicePage::applyDeviceChoice );
|
||||
|
||||
connect( m_encryptWidget, &EncryptWidget::stateChanged, this, &ChoicePage::onEncryptWidgetStateChanged );
|
||||
connect( m_reuseHomeCheckBox, &QCheckBox::stateChanged, this, &ChoicePage::onHomeCheckBoxStateChanged );
|
||||
|
||||
@ -468,6 +467,8 @@ ChoicePage::onActionChanged()
|
||||
{
|
||||
m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) );
|
||||
}
|
||||
|
||||
m_encryptWidget->setEncryptionCheckbox( m_config->preCheckEncryption() );
|
||||
}
|
||||
|
||||
Device* currd = selectedDevice();
|
||||
@ -678,9 +679,13 @@ void
|
||||
ChoicePage::onLeave()
|
||||
{
|
||||
if ( m_config->installChoice() == InstallChoice::Alongside )
|
||||
{
|
||||
if ( m_afterPartitionSplitterWidget->splitPartitionSize() >= 0
|
||||
&& m_afterPartitionSplitterWidget->newPartitionSize() >= 0 )
|
||||
{
|
||||
doAlongsideApply();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_isEfi
|
||||
&& ( m_config->installChoice() == InstallChoice::Alongside
|
||||
@ -1579,7 +1584,10 @@ ChoicePage::calculateNextEnabled() const
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_config->installChoice() != InstallChoice::Manual && m_encryptWidget->isVisible() )
|
||||
// You can have an invisible encryption checkbox, which is
|
||||
// still checked -- then do the encryption.
|
||||
if ( m_config->installChoice() != InstallChoice::Manual
|
||||
&& ( m_encryptWidget->isVisible() || m_encryptWidget->isEncryptionCheckboxChecked() ) )
|
||||
{
|
||||
switch ( m_encryptWidget->state() )
|
||||
{
|
||||
|
@ -70,6 +70,18 @@ EncryptWidget::EncryptWidget( QWidget* parent )
|
||||
CALAMARES_RETRANSLATE_SLOT( &EncryptWidget::retranslate );
|
||||
}
|
||||
|
||||
bool
|
||||
EncryptWidget::isEncryptionCheckboxChecked()
|
||||
{
|
||||
return m_ui->m_encryptCheckBox->isChecked();
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::setEncryptionCheckbox( bool preCheckEncrypt )
|
||||
{
|
||||
m_ui->m_encryptCheckBox->setChecked( preCheckEncrypt );
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::reset( bool checkVisible )
|
||||
{
|
||||
@ -170,17 +182,12 @@ EncryptWidget::updateState( const bool notify )
|
||||
}
|
||||
}
|
||||
|
||||
Encryption newState = state();
|
||||
|
||||
if ( newState != m_state )
|
||||
{
|
||||
m_state = newState;
|
||||
m_state = state();
|
||||
if ( notify )
|
||||
{
|
||||
Q_EMIT stateChanged( m_state );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::onPassphraseEdited()
|
||||
|
@ -36,8 +36,10 @@ public:
|
||||
|
||||
explicit EncryptWidget( QWidget* parent = nullptr );
|
||||
|
||||
void setEncryptionCheckbox( bool preCheckEncrypt = false);
|
||||
void reset( bool checkVisible = true );
|
||||
|
||||
bool isEncryptionCheckboxChecked();
|
||||
Encryption state() const;
|
||||
void setText( const QString& text );
|
||||
|
||||
|
@ -240,6 +240,11 @@ defaultFileSystemType: "ext4"
|
||||
# If nothing is specified, LUKS is enabled in automated modes.
|
||||
#enableLuksAutomatedPartitioning: true
|
||||
|
||||
# When enableLuksAutomatedPartitioning is true, this option will pre-check
|
||||
# encryption checkbox. This option is only usefull to help people to not forget
|
||||
# to cypher their disk when installing in enterprise (for exemple).
|
||||
#preCheckEncryption: false
|
||||
|
||||
# Partition layout.
|
||||
#
|
||||
# This optional setting specifies a custom partition layout.
|
||||
|
@ -34,6 +34,7 @@ properties:
|
||||
|
||||
luksGeneration: { type: string, enum: [luks1, luks2] } # Also allows "luks" as alias of "luks1"
|
||||
enableLuksAutomatedPartitioning: { type: boolean, default: false }
|
||||
preCheckEncryption: { type: boolean, default: false }
|
||||
|
||||
allowManualPartitioning: { type: boolean, default: true }
|
||||
showNotEncryptedBootMessage: { type: boolean, default: true }
|
||||
|
@ -14,6 +14,12 @@ include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set(PartitionModule_basic_SRC
|
||||
${PartitionModule_SOURCE_DIR}/core/OsproberEntry.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartitionInfo.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartUtils.cpp
|
||||
)
|
||||
|
||||
calamares_add_test(
|
||||
partitionjobtest
|
||||
SOURCES
|
||||
@ -40,10 +46,9 @@ calamares_add_test(
|
||||
partitioncreatelayoutstest
|
||||
SOURCES
|
||||
CreateLayoutsTests.cpp
|
||||
${PartitionModule_basic_SRC}
|
||||
${PartitionModule_SOURCE_DIR}/core/KPMHelpers.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartitionInfo.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartitionLayout.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartUtils.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/DeviceModel.cpp
|
||||
LIBRARIES calamares::kpmcore Calamares::calamaresui
|
||||
DEFINITIONS ${_partition_defs}
|
||||
@ -66,9 +71,8 @@ calamares_add_test(
|
||||
partitionconfigtest
|
||||
SOURCES
|
||||
ConfigTests.cpp
|
||||
${PartitionModule_basic_SRC}
|
||||
${PartitionModule_SOURCE_DIR}/core/DeviceModel.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartitionInfo.cpp
|
||||
${PartitionModule_SOURCE_DIR}/core/PartUtils.cpp
|
||||
${PartitionModule_SOURCE_DIR}/Config.cpp
|
||||
LIBRARIES calamares::kpmcore Calamares::calamaresui
|
||||
DEFINITIONS
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include "core/OsproberEntry.h"
|
||||
#include "core/PartUtils.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
@ -17,6 +18,7 @@
|
||||
#include "utils/System.h"
|
||||
#include "utils/Yaml.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
@ -35,6 +37,9 @@ private Q_SLOTS:
|
||||
void testLegacySize();
|
||||
void testAll();
|
||||
void testWeirdConfig();
|
||||
|
||||
void testNormalFstab();
|
||||
void testWeirdFstab();
|
||||
};
|
||||
|
||||
ConfigTests::ConfigTests() = default;
|
||||
@ -222,6 +227,48 @@ ConfigTests::testWeirdConfig()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ConfigTests::testNormalFstab()
|
||||
{
|
||||
const auto contents
|
||||
= QByteArrayLiteral( "# A FreeBSD fstab\n"
|
||||
"/dev/nvd0p3 none swap sw 0 0\n" );
|
||||
const auto entries = Calamares::fromEtcFstabContents( contents );
|
||||
for ( const auto& e : entries )
|
||||
{
|
||||
QVERIFY( e.isValid() );
|
||||
}
|
||||
QCOMPARE( entries.count(), 1 );
|
||||
}
|
||||
|
||||
void
|
||||
ConfigTests::testWeirdFstab()
|
||||
{
|
||||
const auto contents
|
||||
= QByteArrayLiteral( "# <file system> <mount point> <type> <options> <dump> <pass>\n"
|
||||
"UUID=dae80d0a-f6c7-46f4-a04a-6761f2cfd9b6 / ext4 defaults,noatime 0 1\n"
|
||||
"UUID=423892d5-a929-41a9-a846-f410cf3fe25b swap swap defaults,noatime 0 2\n"
|
||||
"# another comment\n"
|
||||
"borked 2\n"
|
||||
"ok /dev1 ext4 none 0 0\n"
|
||||
"bogus /dev2 ext4 none no later\n"
|
||||
"# comment\n" );
|
||||
const auto entries = Calamares::fromEtcFstabContents( contents );
|
||||
QCOMPARE( entries.count(), 4 );
|
||||
|
||||
QStringList mountPoints;
|
||||
for ( const auto& e : entries )
|
||||
{
|
||||
mountPoints.append( e.mountPoint );
|
||||
}
|
||||
mountPoints.sort();
|
||||
QCOMPARE( mountPoints,
|
||||
QStringList() << "/"
|
||||
<< "/dev1"
|
||||
<< "/dev2"
|
||||
<< "swap" );
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( ConfigTests )
|
||||
|
||||
|
@ -51,7 +51,6 @@ ActiveDirectoryJob::exec()
|
||||
if ( !m_ip.isEmpty() )
|
||||
{
|
||||
const QString hostsFilePath = Calamares::System::instance()->targetPath( QStringLiteral( "/etc/hosts" ) );
|
||||
;
|
||||
QFile hostsFile( hostsFilePath );
|
||||
if ( hostsFile.open( QIODevice::Append | QIODevice::Text ) )
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const Q
|
||||
|
||||
Calamares::ImageType statusImage = Calamares::StatusOk;
|
||||
|
||||
painter->setPen( QColorConstants::Black );
|
||||
painter->setPen( Qt::black );
|
||||
if ( index.data( Calamares::RequirementsModel::Satisfied ).toBool() )
|
||||
{
|
||||
painter->fillRect( textRect, option.palette.window().color() );
|
||||
|
Loading…
Reference in New Issue
Block a user