Merge branch 'master' of https://github.com/calamares/calamares into development
This commit is contained in:
commit
54a7f31433
14
CHANGES
14
CHANGES
@ -3,6 +3,19 @@ contributors are listed. Note that Calamares does not have a historical
|
||||
changelog -- this log starts with version 3.2.0. The release notes on the
|
||||
website will have to do for older versions.
|
||||
|
||||
# 3.2.5 (unreleased) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
|
||||
## Core ##
|
||||
|
||||
## Modules ##
|
||||
|
||||
* Python modules: several modules have had translations added. This is
|
||||
usually only visible when the module runs as part of the *exec* step,
|
||||
when the module's *pretty name* is displayed. In addition, error
|
||||
messages are now translated.
|
||||
|
||||
# 3.2.4 (2019-02-12) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
@ -66,6 +79,7 @@ This release contains contributions from (alphabetically by first name):
|
||||
the installation media to the target stystem. This can be used, for instance,
|
||||
for block-level-identical installations.
|
||||
|
||||
|
||||
# 3.2.3 (2019-01-09) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
|
@ -75,8 +75,8 @@ set( CALAMARES_DESCRIPTION_SUMMARY
|
||||
|
||||
set( CALAMARES_VERSION_MAJOR 3 )
|
||||
set( CALAMARES_VERSION_MINOR 2 )
|
||||
set( CALAMARES_VERSION_PATCH 4 )
|
||||
set( CALAMARES_VERSION_RC 0 )
|
||||
set( CALAMARES_VERSION_PATCH 5 )
|
||||
set( CALAMARES_VERSION_RC 1 )
|
||||
|
||||
|
||||
### Transifex (languages) info
|
||||
@ -240,7 +240,7 @@ include( CMakeColors )
|
||||
|
||||
### DEPENDENCIES
|
||||
#
|
||||
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools Svg Quick QuickWidgets )
|
||||
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core Gui Widgets LinguistTools Svg Quick QuickWidgets )
|
||||
find_package( YAMLCPP ${YAMLCPP_VERSION} REQUIRED )
|
||||
if( INSTALL_POLKIT )
|
||||
find_package( PolkitQt5-1 REQUIRED )
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017-2019, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -68,9 +68,9 @@ logLevel()
|
||||
}
|
||||
|
||||
static void
|
||||
log( const char* msg, unsigned int debugLevel, bool toDisk = true )
|
||||
log( const char* msg, unsigned int debugLevel )
|
||||
{
|
||||
if ( toDisk || debugLevel < s_threshold )
|
||||
if ( true )
|
||||
{
|
||||
QMutexLocker lock( &s_mutex );
|
||||
|
||||
|
@ -51,7 +51,7 @@ struct NamedEnumTable
|
||||
*
|
||||
* static const NamedEnumTable<Colors> c{ {"red", Colors::Red } };
|
||||
*/
|
||||
NamedEnumTable( const std::initializer_list< pair_t >& v ) : table( v ) { /* static_assert( v.size() > 0 ); */ };
|
||||
NamedEnumTable( const std::initializer_list< pair_t >& v ) : table( v ) { /* static_assert( v.size() > 0 ); */ }
|
||||
|
||||
/** @brief Find a name @p s in the table.
|
||||
*
|
||||
|
@ -768,11 +768,11 @@ def run():
|
||||
displaymanagers.remove(dm)
|
||||
|
||||
if not dm_impl:
|
||||
return (
|
||||
_("No display managers selected for the displaymanager module."),
|
||||
_("The list is empty after checking for installed display managers.")
|
||||
libcalamares.utils.warning(
|
||||
"No display managers selected for the displaymanager module. "
|
||||
"The list is empty after checking for installed display managers."
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
# Pick up remaining settings
|
||||
if "defaultDesktopEnvironment" in libcalamares.job.configuration:
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
explicit LocaleConfiguration();
|
||||
/// @brief Create a locale with everything set to the given @p localeName
|
||||
explicit LocaleConfiguration( const QString& localeName /* "en_US.UTF-8" */ )
|
||||
: LocaleConfiguration( localeName, localeName ) { };
|
||||
: LocaleConfiguration( localeName, localeName ) { }
|
||||
/// @brief Create a locale with language and formats separate
|
||||
explicit LocaleConfiguration( const QString& localeName, const QString& formatsName );
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
|
||||
# Copyright 2016, Philip Müller <philm@manjaro.org>
|
||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -408,6 +408,56 @@ isEfiBootable( const Partition* candidate )
|
||||
flags.testFlag( PartitionTable::FlagBoot );
|
||||
}
|
||||
|
||||
QString
|
||||
findFS( QString fsName, FileSystem::Type* fsType )
|
||||
{
|
||||
QStringList fsLanguage { QLatin1Literal( "C" ) }; // Required language list to turn off localization
|
||||
if ( fsName.isEmpty() )
|
||||
fsName = QStringLiteral( "ext4" );
|
||||
|
||||
FileSystem::Type tmpType = FileSystem::typeForName( fsName, fsLanguage );
|
||||
if ( tmpType != FileSystem::Unknown )
|
||||
{
|
||||
cDebug() << "Found filesystem" << fsName;
|
||||
if ( fsType )
|
||||
*fsType = tmpType;
|
||||
return fsName;
|
||||
}
|
||||
|
||||
// Second pass: try case-insensitive
|
||||
const auto fstypes = FileSystem::types();
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
{
|
||||
if ( 0 == QString::compare( fsName, FileSystem::nameForType( t, fsLanguage ), Qt::CaseInsensitive ) )
|
||||
{
|
||||
QString fsRealName = FileSystem::nameForType( t, fsLanguage );
|
||||
cDebug() << "Filesystem name" << fsName << "translated to" << fsRealName;
|
||||
if ( fsType )
|
||||
*fsType = t;
|
||||
return fsRealName;
|
||||
}
|
||||
}
|
||||
|
||||
cDebug() << "Filesystem" << fsName << "not found, using ext4";
|
||||
fsName = QStringLiteral( "ext4" );
|
||||
// fsType can be used to check whether fsName was a valid filesystem.
|
||||
if (fsType)
|
||||
*fsType = FileSystem::Unknown;
|
||||
#ifdef DEBUG_FILESYSTEMS
|
||||
// This bit is for distro's debugging their settings, and shows
|
||||
// all the strings that KPMCore is matching against for FS type.
|
||||
{
|
||||
Logger::CDebug d;
|
||||
using TR = Logger::DebugRow< int, QString >;
|
||||
const auto fstypes = FileSystem::types();
|
||||
d << "Available types (" << fstypes.count() << ')';
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
d << TR( static_cast<int>( t ), FileSystem::nameForType( t, fsLanguage ) );
|
||||
}
|
||||
#endif
|
||||
return fsName;
|
||||
}
|
||||
|
||||
} // nmamespace PartUtils
|
||||
|
||||
/* Implementation of methods for FstabEntry, from OsproberEntry.h */
|
||||
|
@ -22,6 +22,10 @@
|
||||
|
||||
#include "OsproberEntry.h"
|
||||
|
||||
// KPMcore
|
||||
#include <kpmcore/fs/filesystem.h>
|
||||
|
||||
// Qt
|
||||
#include <QString>
|
||||
|
||||
class PartitionCoreModule;
|
||||
@ -73,6 +77,15 @@ bool isEfiSystem();
|
||||
* the partition table layout, this may mean different flags.
|
||||
*/
|
||||
bool isEfiBootable( const Partition* candidate );
|
||||
|
||||
/** @brief translate @p fsName into a recognized name and type
|
||||
*
|
||||
* Makes several attempts to translate the string into a
|
||||
* name that KPMCore will recognize.
|
||||
* The corresponding filesystem type is stored in @p fsType, and
|
||||
* its value is FileSystem::Unknown if @p fsName is not recognized.
|
||||
*/
|
||||
QString findFS( QString fsName, FileSystem::Type* fsType );
|
||||
}
|
||||
|
||||
#endif // PARTUTILS_H
|
||||
|
@ -18,27 +18,50 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
#include "core/PartitionLayout.h"
|
||||
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "core/PartitionActions.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "core/PartUtils.h"
|
||||
|
||||
#include <kpmcore/core/device.h>
|
||||
#include <kpmcore/core/partition.h>
|
||||
#include <kpmcore/fs/filesystem.h>
|
||||
|
||||
static FileSystem::Type
|
||||
getDefaultFileSystemType()
|
||||
{
|
||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
FileSystem::Type defaultFS = FileSystem::Ext4;
|
||||
|
||||
if ( gs->contains( "defaultFileSystemType" ) )
|
||||
{
|
||||
PartUtils::findFS( gs->value( "defaultFileSystemType" ).toString(), &defaultFS);
|
||||
if ( defaultFS == FileSystem::Unknown )
|
||||
defaultFS = FileSystem::Ext4;
|
||||
}
|
||||
|
||||
return defaultFS;
|
||||
}
|
||||
|
||||
PartitionLayout::PartitionLayout()
|
||||
{
|
||||
m_defaultFsType = getDefaultFileSystemType();
|
||||
}
|
||||
|
||||
PartitionLayout::PartitionLayout( PartitionLayout::PartitionEntry entry )
|
||||
{
|
||||
partLayout.append( entry );
|
||||
m_defaultFsType = getDefaultFileSystemType();
|
||||
m_partLayout.append( entry );
|
||||
}
|
||||
|
||||
PartitionLayout::PartitionLayout( const PartitionLayout& layout )
|
||||
: partLayout( layout.partLayout )
|
||||
: m_partLayout( layout.m_partLayout )
|
||||
, m_defaultFsType( layout.m_defaultFsType )
|
||||
{
|
||||
}
|
||||
|
||||
@ -49,7 +72,7 @@ PartitionLayout::~PartitionLayout()
|
||||
void
|
||||
PartitionLayout::addEntry( PartitionLayout::PartitionEntry entry )
|
||||
{
|
||||
partLayout.append( entry );
|
||||
m_partLayout.append( entry );
|
||||
}
|
||||
|
||||
static double
|
||||
@ -115,9 +138,9 @@ PartitionLayout::addEntry( const QString& mountPoint, const QString& size, const
|
||||
PartitionLayout::PartitionEntry entry( size, min );
|
||||
|
||||
entry.partMountPoint = mountPoint;
|
||||
entry.partFileSystem = FileSystem::Ext4;
|
||||
entry.partFileSystem = m_defaultFsType;
|
||||
|
||||
partLayout.append( entry );
|
||||
m_partLayout.append( entry );
|
||||
}
|
||||
|
||||
void
|
||||
@ -127,9 +150,11 @@ PartitionLayout::addEntry( const QString& label, const QString& mountPoint, cons
|
||||
|
||||
entry.partLabel = label;
|
||||
entry.partMountPoint = mountPoint;
|
||||
entry.partFileSystem = FileSystem::typeForName( fs );
|
||||
PartUtils::findFS( fs, &entry.partFileSystem );
|
||||
if ( entry.partFileSystem == FileSystem::Unknown )
|
||||
entry.partFileSystem = m_defaultFsType;
|
||||
|
||||
partLayout.append( entry );
|
||||
m_partLayout.append( entry );
|
||||
}
|
||||
|
||||
static qint64
|
||||
@ -175,7 +200,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
// TODO: Refine partition sizes to make sure there is room for every partition
|
||||
// Use a default (200-500M ?) minimum size for partition without minSize
|
||||
|
||||
foreach( const PartitionLayout::PartitionEntry& part, partLayout )
|
||||
foreach( const PartitionLayout::PartitionEntry& part, m_partLayout )
|
||||
{
|
||||
Partition *currentPartition = nullptr;
|
||||
|
||||
@ -194,7 +219,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
parent,
|
||||
*dev,
|
||||
role,
|
||||
static_cast<FileSystem::Type>(part.partFileSystem),
|
||||
part.partFileSystem,
|
||||
firstSector,
|
||||
end,
|
||||
PartitionTable::FlagNone
|
||||
@ -206,7 +231,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
parent,
|
||||
*dev,
|
||||
role,
|
||||
static_cast<FileSystem::Type>(part.partFileSystem),
|
||||
part.partFileSystem,
|
||||
firstSector,
|
||||
end,
|
||||
luksPassphrase,
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
// KPMcore
|
||||
#include <kpmcore/core/partitiontable.h>
|
||||
#include <kpmcore/fs/filesystem.h>
|
||||
|
||||
// Qt
|
||||
#include <QList>
|
||||
@ -48,7 +49,7 @@ public:
|
||||
{
|
||||
QString partLabel;
|
||||
QString partMountPoint;
|
||||
int partFileSystem = 0;
|
||||
FileSystem::Type partFileSystem = FileSystem::Unknown;
|
||||
double partSize = 0.0L;
|
||||
SizeUnit partSizeUnit = Percent;
|
||||
double partMinSize = 0.0L;
|
||||
@ -76,7 +77,8 @@ public:
|
||||
QList< Partition* > execute( Device *dev, qint64 firstSector, qint64 lastSector, QString luksPassphrase, PartitionNode* parent, const PartitionRole& role );
|
||||
|
||||
private:
|
||||
QList< PartitionEntry > partLayout;
|
||||
FileSystem::Type m_defaultFsType;
|
||||
QList< PartitionEntry > m_partLayout;
|
||||
};
|
||||
|
||||
#endif /* PARTITIONLAYOUT_H */
|
||||
|
@ -1248,7 +1248,7 @@ ChoicePage::setupActions()
|
||||
}
|
||||
if ( PartUtils::canBeReplaced( *it ) )
|
||||
{
|
||||
cDebug() << ".. contains replacable" << it;
|
||||
cDebug() << ".. contains replaceable" << it;
|
||||
atLeastOneCanBeReplaced = true;
|
||||
}
|
||||
if ( (*it)->isMounted() )
|
||||
|
@ -34,7 +34,7 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog( QString& vgName,
|
||||
, m_selectedPVs( selectedPVs )
|
||||
, m_peSize( pSize )
|
||||
{
|
||||
setWindowTitle( "Create Volume Group" );
|
||||
setWindowTitle( tr( "Create Volume Group" ) );
|
||||
|
||||
peSize()->setValue( pSize );
|
||||
|
||||
|
@ -44,7 +44,7 @@ void
|
||||
standardMountPoints(QComboBox& combo)
|
||||
{
|
||||
combo.clear();
|
||||
combo.addItem( combo.tr( "(no mount point)" ) );
|
||||
combo.addItem( QObject::tr( "(no mount point)" ) );
|
||||
combo.addItems( standardMountPoints() );
|
||||
}
|
||||
|
||||
|
@ -493,55 +493,6 @@ nameToChoice( QString name, bool& ok )
|
||||
return names.find( name, ok );
|
||||
}
|
||||
|
||||
/** @brief translate @p defaultFS into a recognized name
|
||||
*
|
||||
* Makes several attempts to translate the string into a
|
||||
* name that KPMCore will recognize.
|
||||
*/
|
||||
static QString
|
||||
findFS( QString defaultFS )
|
||||
{
|
||||
QStringList fsLanguage { QLatin1Literal( "C" ) }; // Required language list to turn off localization
|
||||
if ( defaultFS.isEmpty() )
|
||||
{
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, using ext4";
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
}
|
||||
if ( FileSystem::typeForName( defaultFS, fsLanguage ) != FileSystem::Unknown )
|
||||
{
|
||||
cDebug() << "Partition-module setting *defaultFileSystemType*" << defaultFS;
|
||||
return defaultFS;
|
||||
}
|
||||
|
||||
// Second pass: try case-insensitive
|
||||
const auto fstypes = FileSystem::types();
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
{
|
||||
if ( 0 == QString::compare( defaultFS, FileSystem::nameForType( t, fsLanguage ), Qt::CaseInsensitive ) )
|
||||
{
|
||||
defaultFS = FileSystem::nameForType( t, fsLanguage );
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << defaultFS;
|
||||
return defaultFS;
|
||||
}
|
||||
}
|
||||
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << defaultFS << ") using ext4.";
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
#ifdef DEBUG_FILESYSTEMS
|
||||
// This bit is for distro's debugging their settings, and shows
|
||||
// all the strings that KPMCore is matching against for FS type.
|
||||
{
|
||||
Logger::CDebug d;
|
||||
using TR = Logger::DebugRow< int, QString >;
|
||||
const auto fstypes = FileSystem::types();
|
||||
d << "Available types (" << fstypes.count() << ')';
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
d << TR( static_cast<int>( t ), FileSystem::nameForType( t, fsLanguage ) );
|
||||
}
|
||||
#endif
|
||||
return defaultFS;
|
||||
}
|
||||
|
||||
void
|
||||
PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
@ -630,7 +581,21 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
|
||||
gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
|
||||
gs->insert( "allowManualPartitioning", CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
|
||||
gs->insert( "defaultFileSystemType", findFS( CalamaresUtils::getString( configurationMap, "defaultFileSystemType" ) ) );
|
||||
|
||||
// The defaultFileSystemType setting needs a bit more processing,
|
||||
// as we want to cover various cases (such as different cases)
|
||||
QString fsName = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" );
|
||||
FileSystem::Type fsType;
|
||||
if ( fsName.isEmpty() )
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4";
|
||||
QString fsRealName = PartUtils::findFS( fsName, &fsType );
|
||||
if ( fsRealName == fsName )
|
||||
cDebug() << "Partition-module setting *defaultFileSystemType*" << fsRealName;
|
||||
else if ( fsType != FileSystem::Unknown )
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << fsRealName;
|
||||
else
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsRealName << ") using ext4.";
|
||||
gs->insert( "defaultFileSystemType", fsRealName );
|
||||
|
||||
|
||||
// Now that we have the config, we load the PartitionCoreModule in the background
|
||||
|
@ -35,7 +35,7 @@ ResizeVolumeGroupDialog::ResizeVolumeGroupDialog( LvmDevice *device,
|
||||
: VolumeGroupBaseDialog( device->name(), device->physicalVolumes(), parent )
|
||||
, m_selectedPVs( selectedPVs )
|
||||
{
|
||||
setWindowTitle( "Resize Volume Group" );
|
||||
setWindowTitle( tr( "Resize Volume Group" ) );
|
||||
|
||||
for ( int i = 0; i < pvList()->count(); i++ )
|
||||
pvList()->item(i)->setCheckState( Qt::Checked );
|
||||
|
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>VolumeGroupDialog</string>
|
||||
<string>Create Volume Group</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
class CreateVolumeGroupJob : public Calamares::Job
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreateVolumeGroupJob( QString& vgName, QVector< const Partition* > pvList, const qint32 peSize );
|
||||
|
||||
|
@ -25,6 +25,7 @@ class LvmDevice;
|
||||
|
||||
class DeactivateVolumeGroupJob : public Calamares::Job
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeactivateVolumeGroupJob( LvmDevice* device );
|
||||
|
||||
|
@ -25,6 +25,7 @@ class LvmDevice;
|
||||
|
||||
class RemoveVolumeGroupJob : public Calamares::Job
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RemoveVolumeGroupJob( LvmDevice* device );
|
||||
|
||||
|
@ -28,6 +28,7 @@ class Partition;
|
||||
|
||||
class ResizeVolumeGroupJob : public Calamares::Job
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ResizeVolumeGroupJob( LvmDevice* device, QVector< const Partition* >& partitionList );
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
# Copyright 2016, Artoo <artoo@manjaro.org>
|
||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||
# Copyright 2018, Gabriel Craciunescu <crazy@frugalware.org>
|
||||
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -24,6 +25,16 @@ import libcalamares
|
||||
|
||||
from libcalamares.utils import debug, target_env_call
|
||||
|
||||
import gettext
|
||||
_ = gettext.translation("calamares-python",
|
||||
localedir=libcalamares.utils.gettext_path(),
|
||||
languages=libcalamares.utils.gettext_languages(),
|
||||
fallback=True).gettext
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return _("Configure Plymouth theme")
|
||||
|
||||
|
||||
class PlymouthController:
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#
|
||||
# Copyright 2015, Teo Mrnjavac <teo@kde.org>
|
||||
# Copyright 2017. Alf Gaida <agaida@siduction.org>
|
||||
# Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -22,6 +23,16 @@
|
||||
import subprocess
|
||||
import libcalamares
|
||||
|
||||
import gettext
|
||||
_ = gettext.translation("calamares-python",
|
||||
localedir=libcalamares.utils.gettext_path(),
|
||||
languages=libcalamares.utils.gettext_languages(),
|
||||
fallback=True).gettext
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return _("Remove live user from target system")
|
||||
|
||||
|
||||
def run():
|
||||
"""
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Copyright 2016, Artoo <artoo@manjaro.org>
|
||||
# Copyright 2017, Philip Müller <philm@manjaro.org>
|
||||
# Copyright 2018, Artoo <artoo@artixlinux.org>
|
||||
# Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
# Copyright 2018-2019, Adriaan de Groot <groot@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -27,6 +27,17 @@ from libcalamares.utils import target_env_call, warning
|
||||
from os.path import exists, join
|
||||
|
||||
|
||||
import gettext
|
||||
_ = gettext.translation("calamares-python",
|
||||
localedir=libcalamares.utils.gettext_path(),
|
||||
languages=libcalamares.utils.gettext_languages(),
|
||||
fallback=True).gettext
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return _("Configure OpenRC services")
|
||||
|
||||
|
||||
class OpenrcController:
|
||||
"""
|
||||
This is the openrc service controller.
|
||||
@ -45,6 +56,22 @@ class OpenrcController:
|
||||
self.initdDir = libcalamares.job.configuration['initdDir']
|
||||
self.runlevelsDir = libcalamares.job.configuration['runlevelsDir']
|
||||
|
||||
|
||||
def make_failure_description(self, state, name, runlevel):
|
||||
"""
|
||||
Returns a generic "could not <foo>" failure message, specialized
|
||||
for the action @p state and the specific service @p name in @p runlevel.
|
||||
"""
|
||||
if state == "add":
|
||||
description = _("Cannot add service {name!s} to run-level {level!s}.")
|
||||
elif state == "del":
|
||||
description = _("Cannot remove service {name!s} from run-level {level!s}.")
|
||||
else:
|
||||
description = _("Unknown service-action <code>{arg!s}</code> for service {name!s} in run-level {level!s}.")
|
||||
|
||||
return description.format(arg=state, name=name, level=runlevel)
|
||||
|
||||
|
||||
def update(self, state):
|
||||
"""
|
||||
Call rc-update for each service listed
|
||||
@ -69,24 +96,31 @@ class OpenrcController:
|
||||
if exists(runlevel_path):
|
||||
ec = target_env_call(["rc-update", state, name, runlevel])
|
||||
if ec != 0:
|
||||
warning("Cannot {} service {} to {}".format(state, name, runlevel))
|
||||
warning("rc-update returned error code {!s}".format(ec))
|
||||
if mandatory:
|
||||
return ("Cannot {} service {} to {}".format(state, name, runlevel),
|
||||
"rc-update {} call in chroot returned error code {}".format(state, ec)
|
||||
title = _("Cannot modify service")
|
||||
diagnostic = _("<code>rc-update {arg!s}</code> call in chroot returned error code {num!s}.").format(arg=state, num=ec)
|
||||
return (title,
|
||||
self.make_failure_description(state, name, runlevel) + " " + diagnostic
|
||||
)
|
||||
else:
|
||||
warning("Could not {} service {} in {}, error {!s}".format(state, name, runlevel, ec))
|
||||
else:
|
||||
warning("Target runlevel {} does not exist for {}.".format(runlevel, name))
|
||||
if mandatory:
|
||||
return ("Target runlevel {} does not exist for {}.".format(runlevel, name),
|
||||
"No {} found.".format(runlevel_path))
|
||||
else:
|
||||
warning("Target runlevel {} does not exist for {}.".format(runlevel, name))
|
||||
title = _("Target runlevel does not exist")
|
||||
diagnostic = _("The path for runlevel {level!s} is <code>{path!s}</code>, which does not exist.").format(level=runlevel, path=runlevel_path)
|
||||
|
||||
return (title,
|
||||
self.make_failure_description(state, name, runlevel) + " " + diagnostic
|
||||
)
|
||||
else:
|
||||
warning("Target service {} does not exist in {}.".format(name, self.initdDir))
|
||||
if mandatory:
|
||||
return ("Target service {} does not exist.".format(name),
|
||||
"No {} found.".format(service_path))
|
||||
else:
|
||||
warning("Target service {} does not exist in {}.".format(name, self.initdDir))
|
||||
title = _("Target service does not exist")
|
||||
diagnostic = _("The path for service {name!s} is <code>{path!s}</code>, which does not exist.").format(name=name, path=service_path)
|
||||
return (title,
|
||||
self.make_failure_description(state, name, runlevel) + " " + diagnostic
|
||||
)
|
||||
|
||||
|
||||
def run(self):
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||
# Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
# Copyright 2018-2019, Adriaan de Groot <groot@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -24,6 +24,17 @@
|
||||
import libcalamares
|
||||
|
||||
|
||||
import gettext
|
||||
_ = gettext.translation("calamares-python",
|
||||
localedir=libcalamares.utils.gettext_path(),
|
||||
languages=libcalamares.utils.gettext_languages(),
|
||||
fallback=True).gettext
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return _("Configure systemd services")
|
||||
|
||||
|
||||
def systemctl(targets, command, suffix):
|
||||
"""
|
||||
For each entry in @p targets, run "systemctl <command> <thing>",
|
||||
@ -47,17 +58,32 @@ def systemctl(targets, command, suffix):
|
||||
)
|
||||
|
||||
if ec != 0:
|
||||
libcalamares.utils.warning(
|
||||
"Cannot {} systemd {} {}".format(command, suffix, name)
|
||||
)
|
||||
libcalamares.utils.warning(
|
||||
"systemctl {} call in chroot returned error code {}".format(command, ec)
|
||||
)
|
||||
if mandatory:
|
||||
return ("Cannot {} systemd {} {}".format(command, suffix, name),
|
||||
"systemctl {} call in chroot returned error code {}".format(command, ec)
|
||||
title = _("Cannot modify service")
|
||||
diagnostic = _("<code>systemctl {arg!s}</code> call in chroot returned error code {num!s}.").format(arg=command, num=ec)
|
||||
|
||||
if command == "enable" and suffix == ".service":
|
||||
description = _("Cannot enable systemd service <code>{name!s}</code>.")
|
||||
elif command == "enable" and suffix == ".target":
|
||||
description = _("Cannot enable systemd target <code>{name!s}</code>.")
|
||||
elif command == "disable" and suffix == ".service":
|
||||
description = _("Cannot enable systemd service <code>{name!s}</code>.")
|
||||
elif command == "disable" and suffix == ".target":
|
||||
description = _("Cannot disable systemd target <code>{name!s}</code>.")
|
||||
elif command == "mask":
|
||||
description = _("Cannot mask systemd unit <code>{name!s}</code>.")
|
||||
else:
|
||||
description = _("Unknown systemd commands <code>{command!s}</code> and <code>{suffix!s}</code> for unit {name!s}.")
|
||||
|
||||
return (title,
|
||||
description.format(name=name, command=command, suffix=suffix) + " " + diagnostic
|
||||
)
|
||||
else:
|
||||
libcalamares.utils.warning(
|
||||
"Cannot {} systemd {} {}".format(command, suffix, name)
|
||||
)
|
||||
libcalamares.utils.warning(
|
||||
"systemctl {} call in chroot returned error code {}".format(command, ec)
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
@ -92,6 +118,4 @@ def run():
|
||||
if r is not None:
|
||||
return r
|
||||
|
||||
|
||||
# This could have just been return r
|
||||
return None
|
||||
|
@ -154,29 +154,29 @@ CreateUserJob::exec()
|
||||
useradd << "-c" << m_fullName;
|
||||
useradd << m_userName;
|
||||
|
||||
auto pres = CalamaresUtils::System::instance()->targetEnvCommand( useradd );
|
||||
if ( pres.getExitCode() )
|
||||
auto commandResult = CalamaresUtils::System::instance()->targetEnvCommand( useradd );
|
||||
if ( commandResult.getExitCode() )
|
||||
{
|
||||
cError() << "useradd failed" << pres.getExitCode();
|
||||
return pres.explainProcess( useradd, 10 /* bogus timeout */ );
|
||||
cError() << "useradd failed" << commandResult.getExitCode();
|
||||
return commandResult.explainProcess( useradd, 10 /* bogus timeout */ );
|
||||
}
|
||||
|
||||
pres = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
commandResult = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
{ "usermod", "-aG", defaultGroups, m_userName } );
|
||||
if ( pres.getExitCode() )
|
||||
if ( commandResult.getExitCode() )
|
||||
{
|
||||
cError() << "usermod failed" << pres.getExitCode();
|
||||
return pres.explainProcess( "usermod", 10 );
|
||||
cError() << "usermod failed" << commandResult.getExitCode();
|
||||
return commandResult.explainProcess( "usermod", 10 );
|
||||
}
|
||||
|
||||
QString userGroup = QString( "%1:%2" ).arg( m_userName ).arg( m_userName );
|
||||
QString homeDir = QString( "/home/%1" ).arg( m_userName );
|
||||
pres = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
commandResult = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
{ "chown", "-R", userGroup, homeDir } );
|
||||
if ( pres.getExitCode() )
|
||||
if ( commandResult.getExitCode() )
|
||||
{
|
||||
cError() << "chown failed" << pres.getExitCode();
|
||||
return pres.explainProcess( "chown", 10 );
|
||||
cError() << "chown failed" << commandResult.getExitCode();
|
||||
return commandResult.explainProcess( "chown", 10 );
|
||||
}
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
|
Loading…
Reference in New Issue
Block a user