From 7d8b122835c31085ba4f12f9b8981ffb10764dfb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 29 Apr 2019 08:49:53 -0400 Subject: [PATCH] [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. --- CHANGES | 2 + src/modules/oemid/CMakeLists.txt | 10 +++++ src/modules/oemid/OEMViewStep.cpp | 75 +++++++++++++++++++++++++++++++ src/modules/oemid/OEMViewStep.h | 60 +++++++++++++++++++++++++ src/modules/oemid/oemid.conf | 7 +++ 5 files changed, 154 insertions(+) create mode 100644 src/modules/oemid/CMakeLists.txt create mode 100644 src/modules/oemid/OEMViewStep.cpp create mode 100644 src/modules/oemid/OEMViewStep.h create mode 100644 src/modules/oemid/oemid.conf diff --git a/CHANGES b/CHANGES index cb4b0a7ce..c6a9c9a8b 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/src/modules/oemid/CMakeLists.txt b/src/modules/oemid/CMakeLists.txt new file mode 100644 index 000000000..be7c97c61 --- /dev/null +++ b/src/modules/oemid/CMakeLists.txt @@ -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 +) diff --git a/src/modules/oemid/OEMViewStep.cpp b/src/modules/oemid/OEMViewStep.cpp new file mode 100644 index 000000000..8e038e7ff --- /dev/null +++ b/src/modules/oemid/OEMViewStep.cpp @@ -0,0 +1,75 @@ +/* === This file is part of Calamares - === + * + * Copyright 2019, Adriaan de Groot + * + * 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 . + */ + +#include "OEMViewStep.h" + +#include "utils/Variant.h" + +#include + +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(); ) diff --git a/src/modules/oemid/OEMViewStep.h b/src/modules/oemid/OEMViewStep.h new file mode 100644 index 000000000..137047b11 --- /dev/null +++ b/src/modules/oemid/OEMViewStep.h @@ -0,0 +1,60 @@ +/* === This file is part of Calamares - === + * + * Copyright 2019, Adriaan de Groot + * + * 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 . + */ + +#ifndef OEMVIEWSTEP_H +#define OEMVIEWSTEP_H + +#include +#include + +#include + +#include + +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 diff --git a/src/modules/oemid/oemid.conf b/src/modules/oemid/oemid.conf new file mode 100644 index 000000000..90587faae --- /dev/null +++ b/src/modules/oemid/oemid.conf @@ -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@@