From fc264689b1aeef7fbc91a7b09895eaf55ffbc96a Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 30 Oct 2023 15:22:59 +0100 Subject: [PATCH] Use and implement getAPISMYoctoVersion() and getAPISMYoctoInstallationSTatus(). --- worker.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/worker.cpp b/worker.cpp index 168ef76..36d25b1 100644 --- a/worker.cpp +++ b/worker.cpp @@ -157,9 +157,7 @@ Worker::Worker(int customerNr, this->setObjectName("worker-object"); QDir::setCurrent(m_workingDirectory); - if (std::optional v = getApismVersion()) { - m_apismVersion = v.value(); - } + m_apismVersion = getAPISMYoctoVersion(); this->moveToThread(&m_workerThread); m_workerThread.start(); @@ -1045,6 +1043,17 @@ QString Worker::getATBUpdateToolYoctoVersion() { return "N/A"; } +QString Worker::getAPISMYoctoVersion() { + if (QFile::exists("/var/lib/opkg/status")) { + QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A1 apism | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2)"); + Command c("bash"); + if (c.execute("/tmp", QStringList() << "-c" << cmd)) { + return c.getCommandResult(); // 1.4.1.0-r4 + } + } + return "N/A"; +} + QString Worker::getATBUpdateToolYoctoInstallationStatus() { if (QFile::exists("/var/lib/opkg/status")) { QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A3 atbupdatetool | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2,3,4)"); @@ -1056,6 +1065,16 @@ QString Worker::getATBUpdateToolYoctoInstallationStatus() { return "N/A"; } +QString Worker::getAPISMYoctoInstallationStatus() { + if (QFile::exists("/var/lib/opkg/status")) { + QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A3 apism | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2,3,4)"); + Command c("bash"); + if (c.execute("/tmp", QStringList() << "-c" << cmd)) { + return c.getCommandResult(); // 1.3.9+git0+226553a8ab-r0 + } + } + return "N/A"; +} QString Worker::getATBQTVersion() const {