[oemid] New module, stub

- OEMID is a module for configuring phase-0 things for an OEM,
   like batch-ID. This is just a stub.
 - Currently planned functionality is limited to just batch-ID.
This commit is contained in:
Adriaan de Groot 2019-04-29 08:49:53 -04:00
parent 6d073b6757
commit 7d8b122835
5 changed files with 154 additions and 0 deletions

View File

@ -24,6 +24,8 @@ This release contains contributions from (alphabetically by first name):
## Modules ##
- *oemid* is a new module for configuring OEM phase-0 (image pre-mastering,
or pre-deployment) things. It has limited functionality at the moment.
- All Python modules now bail out gracefully on (at least some) bad
configurations, rather than raising an exception. The pre-release
scripts now test for exceptions to avoid shipping modules with

View File

@ -0,0 +1,10 @@
calamares_add_plugin( oemid
TYPE viewmodule
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
OEMViewStep.cpp
LINK_PRIVATE_LIBRARIES
calamaresui
Qt5::Widgets
SHARED_LIB
)

View File

@ -0,0 +1,75 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OEMViewStep.h"
#include "utils/Variant.h"
#include <QLabel>
OEMViewStep::OEMViewStep(QObject* parent)
: Calamares::ViewStep( parent )
, m_widget( nullptr )
{
}
OEMViewStep::~OEMViewStep()
{
}
bool OEMViewStep::isBackEnabled() const
{
return true;
}
bool OEMViewStep::isNextEnabled() const
{
return true;
}
bool OEMViewStep::isAtBeginning() const
{
return true;
}
bool OEMViewStep::isAtEnd() const
{
return true;
}
QString OEMViewStep::prettyName() const
{
return tr( "OEM Configuration" );
}
QWidget * OEMViewStep::widget()
{
return nullptr; // m_widget;
}
Calamares::JobList OEMViewStep::jobs() const
{
return Calamares::JobList();
}
void OEMViewStep::setConfigurationMap(const QVariantMap& configurationMap)
{
m_batch = CalamaresUtils::getString( configurationMap, "batch-identifier" );
}
CALAMARES_PLUGIN_FACTORY_DEFINITION( OEMViewStepFactory, registerPlugin<OEMViewStep>(); )

View File

@ -0,0 +1,60 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OEMVIEWSTEP_H
#define OEMVIEWSTEP_H
#include <utils/PluginFactory.h>
#include <viewpages/ViewStep.h>
#include <PluginDllMacro.h>
#include <QVariantMap>
class OEMPage;
class PLUGINDLLEXPORT OEMViewStep : public Calamares::ViewStep
{
Q_OBJECT
public:
explicit OEMViewStep( QObject* parent = nullptr );
virtual ~OEMViewStep() override;
QString prettyName() const override;
QWidget* widget() override;
bool isNextEnabled() const override;
bool isBackEnabled() const override;
bool isAtBeginning() const override;
bool isAtEnd() const override;
Calamares::JobList jobs() const override;
void setConfigurationMap( const QVariantMap& configurationMap ) override;
private:
QString m_batch;
OEMPage* m_widget;
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( OEMViewStepFactory )
#endif

View File

@ -0,0 +1,7 @@
# This is an OEM setup (phase-0) configuration file.
---
# The batch-identifier is written to /var/log/installer/oem-id.
# This value is put into the text box as the **suggested**
# OEM ID. If @@DATE@@ is included in the identifier, then
# that is replaced by the current date in YYYYMMDD (ISO) format.
batch-identifier: neon-@@DATE@@