read dc-verion directly from binary file

This commit is contained in:
2024-11-28 12:53:44 +01:00
parent 6663866743
commit 11524b8389
4 changed files with 31 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
#include "update.h"
#include "process/command.h"
#include <QCoreApplication>
#include <QFile>
@@ -21,6 +22,8 @@
#include <QDateTime>
#include <QPluginLoader>
#include <QMap>
#include <QStringList>
#include <QString>
#define UPDATE_OPKG (1)
#define UPDATE_DC (0)
@@ -92,6 +95,20 @@ bool Update::unloadDCPlugin() {
return false;
}
QString Update::dcVersion(QString const &dcBinFile) {
Command c("bash");
QStringList param;
param << "-c" << QString(R"(strings %1 | grep DC2c.\[0-9\] | uniq)").arg(dcBinFile);
if (c.execute("/tmp", param)) {
return c.getCommandResult().trimmed().split(QRegularExpression("\\s")).first();
// qInfo() << "(" << __func__ << ":" << __LINE__ << ")" << v;
}
return "";
}
class hwapi;
Update::Update(QString customerRepository,
QString customerNrStr,