[machineid] Read systemd-style from config

This commit is contained in:
Adriaan de Groot 2023-12-09 00:08:38 +01:00
parent 89348910c3
commit 1b37eb1262

View File

@ -14,6 +14,7 @@
#include "Workers.h"
#include "utils/Logger.h"
#include "utils/NamedEnum.h"
#include "utils/System.h"
#include "utils/Variant.h"
@ -22,6 +23,25 @@
#include <QFile>
const NamedEnumTable< MachineId::SystemdMachineIdStyle >&
styleNames()
{
using T = MachineId::SystemdMachineIdStyle;
// *INDENT-OFF*
// clang-format off
static const NamedEnumTable< MachineId::SystemdMachineIdStyle > names {
{ QStringLiteral( "none" ), T::Blank },
{ QStringLiteral( "blank" ), T::Blank },
{ QStringLiteral( "uuid" ), T::Uuid },
{ QStringLiteral( "systemd" ), T::Uuid },
{ QStringLiteral( "literal-uninitialized" ), T::Uninitialized },
};
// clang-format on
// *INDENT-ON*
return names;
}
MachineIdJob::MachineIdJob( QObject* parent )
: Calamares::CppJob( parent )
{
@ -134,6 +154,12 @@ MachineIdJob::setConfigurationMap( const QVariantMap& map )
{
m_systemd = Calamares::getBool( map, "systemd", false );
const auto style = Calamares::getString( map, "systemd-style", QString() );
if ( !style.isEmpty() )
{
m_systemd_style = styleNames().find( style, MachineId::SystemdMachineIdStyle::Uuid );
}
m_dbus = Calamares::getBool( map, "dbus", false );
if ( map.contains( "dbus-symlink" ) )
{