[luksopenswaphookcfg] Start a C++ port

- this module needs work to handle BTRFS special-cases *anyway*
- limited in scope, few options: port it while doing the
  special-cases

So far, this is just a C++ stub.

SEE #1659 #1644
This commit is contained in:
Adriaan de Groot 2021-11-30 16:02:59 +01:00
parent bc2713ccbb
commit 5ca029df25
4 changed files with 121 additions and 7 deletions

View file

@ -0,0 +1,21 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
# Because LUKS Open Swap Hook (Job) is such a mouthful, we'll
# use LOSH all over the place as a shorthand.
calamares_add_plugin( luksopenswaphook
TYPE job
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
LOSHJob.cpp
SHARED_LIB
)
calamares_add_test(
luksopenswaphooktest
SOURCES
Tests.cpp
)

View file

@ -0,0 +1,62 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "CppJob.h"
#include "DllMacro.h"
#include "utils/Permissions.h"
#include "utils/PluginFactory.h"
#include <QList>
#include <QObject>
#include <QVariantMap>
class PLUGINDLLEXPORT LOSHJob : public Calamares::CppJob
{
Q_OBJECT
public:
explicit LOSHJob( QObject* parent = nullptr );
~LOSHJob() override;
QString prettyName() const override;
Calamares::JobResult exec() override;
void setConfigurationMap( const QVariantMap& configurationMap ) override;
private:
};
LOSHJob::LOSHJob( QObject* parent )
: Calamares::CppJob( parent )
{
}
QString
LOSHJob::prettyName() const
{
return tr( "Configuring encrypted swap." );
}
Calamares::JobResult
LOSHJob::exec()
{
return Calamares::JobResult::ok();
}
void
LOSHJob::setConfigurationMap( const QVariantMap& configurationMap )
{
}
CALAMARES_PLUGIN_FACTORY_DECLARATION( LOSHJobFactory )
CALAMARES_PLUGIN_FACTORY_DEFINITION( LOSHJobFactory, registerPlugin< LOSHJob >(); )
#include "utils/moc-warnings.h"
#include "LOSHJob.moc"

View file

@ -0,0 +1,38 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "utils/Logger.h"
#include <QtTest/QtTest>
// LOSH = LUKS Open Swap Hook (Job)
class LOSHTests : public QObject
{
Q_OBJECT
public:
LOSHTests();
~LOSHTests() override {}
private Q_SLOTS:
void initTestCase();
void testTrue();
};
LOSHTests::LOSHTests() {}
void
LOSHTests::initTestCase()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
cDebug() << "LOSH test started.";
}
#include "utils/moc-warnings.h"
#include "Tests.moc"

View file

@ -1,7 +0,0 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
---
type: "job"
name: "luksopenswaphookcfg"
interface: "python"
script: "main.py"