start to refactor update-procedure
This commit is contained in:
parent
ea1d858f15
commit
3358e1a0d4
@ -203,7 +203,8 @@ int main(int argc, char *argv[]) {
|
|||||||
mw.showFullScreen();
|
mw.showFullScreen();
|
||||||
|
|
||||||
// test
|
// test
|
||||||
worker.jsUpdate();
|
//worker.jsUpdate();
|
||||||
|
worker.workList().exec();
|
||||||
// worker.summary();
|
// worker.summary();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "message_handler.h"
|
#include "message_handler.h"
|
||||||
#include <DeviceController/interfaces.h>
|
#include <DeviceController/interfaces.h>
|
||||||
#include "ismas/ismas_client.h"
|
#include "ismas/ismas_client.h"
|
||||||
@ -27,6 +29,15 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "process/command.h"
|
#include "process/command.h"
|
||||||
|
#include "process/update_command.h"
|
||||||
|
#include "process/check_ismas_connectivity_command.h"
|
||||||
|
#include "process/check_update_activation_command.h"
|
||||||
|
#include "process/check_and_fetch_customer_repository_command.h"
|
||||||
|
#include "process/update_json_command.h"
|
||||||
|
#include "process/update_filesystem_command.h"
|
||||||
|
#include "process/exec_opkg_command.h"
|
||||||
|
#include "process/update_dc_command.h"
|
||||||
|
#include "process/show_software_status_command.h"
|
||||||
|
|
||||||
QString const Worker::UPDATE_STEP_OK ( " [ ok]");
|
QString const Worker::UPDATE_STEP_OK ( " [ ok]");
|
||||||
QString const Worker::UPDATE_STEP_DONE ( " [done]");
|
QString const Worker::UPDATE_STEP_DONE ( " [done]");
|
||||||
@ -181,8 +192,65 @@ Worker::Worker(int customerNr,
|
|||||||
, m_dcDownloadJsonFiles(new Command(
|
, m_dcDownloadJsonFiles(new Command(
|
||||||
QString("/opt/app/tools/atbupdate/ATBDownloadDCJsonFiles --set-ppid %1").arg(QCoreApplication::applicationPid())))
|
QString("/opt/app/tools/atbupdate/ATBDownloadDCJsonFiles --set-ppid %1").arg(QCoreApplication::applicationPid())))
|
||||||
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
||||||
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
||||||
|
|
||||||
|
// check ISMAS connectivity
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<CheckIsmasConnectivityCommand>(
|
||||||
|
QString("echo CheckIsmasConnectivityCommand")
|
||||||
|
, this));
|
||||||
|
|
||||||
|
// check if update activated in ISMAS
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<CheckUpdateActivationCommand>(
|
||||||
|
QString("echo CheckUpdateActivationCommand")
|
||||||
|
, this));
|
||||||
|
|
||||||
|
// check and fetch git-customer repository
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<CheckAndFetchCustomerRepositoryCommand>(
|
||||||
|
QString("echo CheckAndFetchCustomerRepositoryCommand")
|
||||||
|
, this));
|
||||||
|
|
||||||
|
// exec opkg-commands
|
||||||
|
// first with no action -> dry-run
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<ExecOpkgCommand>(
|
||||||
|
QString("echo ExecOpkgCommand")
|
||||||
|
, this, true));
|
||||||
|
|
||||||
|
// exec opkg-commands
|
||||||
|
// now with action -> no dry-run
|
||||||
|
|
||||||
|
// send json files down to device controller
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<UpdateJsonCommand>(
|
||||||
|
QString("echo UpdateJsonCommand")
|
||||||
|
//QString("/opt/app/tools/atbupdate/ATBDownloadDCJsonFiles --set-ppid %1").arg(QCoreApplication::applicationPid())
|
||||||
|
, this, false));
|
||||||
|
|
||||||
|
// sync json files in repo etc-directory with /etc fs-directory
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<UpdateFileSystemCommand>(
|
||||||
|
QString("echo UpdateFileSystemCommand")
|
||||||
|
, this));
|
||||||
|
|
||||||
|
|
||||||
|
// send device-controller firmware down to device-controller-hardware
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<UpdateDCCommand>(
|
||||||
|
QString("echo UpdateDCCommand")
|
||||||
|
// QString("/opt/app/tools/atbupdate/ATBDownloadDCFirmware --read-dc-version true")
|
||||||
|
, this));
|
||||||
|
|
||||||
|
// show/send software-status
|
||||||
|
m_workList.push_back(
|
||||||
|
std::make_unique<ShowSoftwareStatusCommand>(
|
||||||
|
QString("echo ShowSoftwareStatusCommand")
|
||||||
|
, this));
|
||||||
|
|
||||||
|
// reboot machine
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
m_start = QDateTime::currentDateTime();
|
m_start = QDateTime::currentDateTime();
|
||||||
m_dcDownloadFirmware->setWorker(this);
|
m_dcDownloadFirmware->setWorker(this);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
@ -19,6 +20,7 @@
|
|||||||
#include "git/git_client.h"
|
#include "git/git_client.h"
|
||||||
#include "ismas/ismas_client.h"
|
#include "ismas/ismas_client.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "work_process_list.h"
|
||||||
|
|
||||||
#ifdef PTU5
|
#ifdef PTU5
|
||||||
#define SERIAL_PORT "ttymxc2"
|
#define SERIAL_PORT "ttymxc2"
|
||||||
@ -196,6 +198,8 @@ class Worker : public QThread{
|
|||||||
bool m_withoutIsmasDirectPort;
|
bool m_withoutIsmasDirectPort;
|
||||||
QString m_apismVersion;
|
QString m_apismVersion;
|
||||||
|
|
||||||
|
WorkList m_workList;
|
||||||
|
|
||||||
bool executeOpkgCommand(QString opkgCommand);
|
bool executeOpkgCommand(QString opkgCommand);
|
||||||
bool cleanUpOpkgCache();
|
bool cleanUpOpkgCache();
|
||||||
QString getOsVersion() const;
|
QString getOsVersion() const;
|
||||||
@ -469,6 +473,9 @@ public:
|
|||||||
|
|
||||||
QByteArray standardOutput() const { return m_standardOutput; }
|
QByteArray standardOutput() const { return m_standardOutput; }
|
||||||
|
|
||||||
|
WorkList const &workList() const { return m_workList; }
|
||||||
|
WorkList &workList() { return m_workList; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void appendText(QString, QString suffix = "");
|
void appendText(QString, QString suffix = "");
|
||||||
void insertText(QString);
|
void insertText(QString);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user