From 42961dea40fab4667018bdf5c8c7538f52c05114 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 18 Oct 2023 11:26:30 +0200 Subject: [PATCH] Add command-parameters yoctoVersionOption (yocto-version of ATBUpdateTool as reported by opkg), and yoctoInstallStatusOption (info if ATBUpdateTool is installed as reported by opkg). --- main.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index f7b4916..b882273 100644 --- a/main.cpp +++ b/main.cpp @@ -116,12 +116,22 @@ int main(int argc, char *argv[]) { QCoreApplication::translate("main", "Show extended version (including last git commit).")); parser.addOption(extendedVersionOption); + QCommandLineOption yoctoVersionOption(QStringList() << "y" << "yocto-version", + QCoreApplication::translate("main", "Show yocto version of ATBUpdateTool.")); + parser.addOption(yoctoVersionOption); + + QCommandLineOption yoctoInstallStatusOption(QStringList() << "Y" << "yocto-install", + QCoreApplication::translate("main", "Show yocto install status of ATBUpdateTool.")); + parser.addOption(yoctoInstallStatusOption); + // Process the actual command line arguments given by the user parser.process(a); QString plugInDir = parser.value(pluginDirectoryOption); QString plugInName = parser.value(pluginNameOption); QString workingDir = parser.value(workingDirectoryOption); bool const dryRun = parser.isSet(dryRunOption); + bool const showYoctoVersion = parser.isSet(yoctoVersionOption); + bool const showYoctoInstallStatus = parser.isSet(yoctoInstallStatusOption); bool const showExtendedVersion = parser.isSet(extendedVersionOption); QString const rtPath = QCoreApplication::applicationDirPath(); @@ -130,17 +140,30 @@ int main(int argc, char *argv[]) { return 0; } + if (showYoctoVersion) { + printf("%s\n", Worker::getATBUpdateToolYoctoVersion().toStdString().c_str()); + return 0; + } + + if (showYoctoInstallStatus) { + printf("%s\n", Worker::getATBUpdateToolYoctoInstallationStatus().toStdString().c_str()); + return 0; + } + if (!QDir(plugInDir).exists()) { qCritical() << plugInDir << "does not exists, but has to contain dc-library"; exit(-1); } - qInfo() << "pwd ..............." << rtPath; - qInfo() << "plugInDir ........." << plugInDir; - qInfo() << "plugInName ........" << plugInName; - qInfo() << "workingDir ........" << workingDir; - qInfo() << "dryRun ............" << dryRun; + qInfo() << "pwd ......................" << rtPath; + qInfo() << "plugInDir ................" << plugInDir; + qInfo() << "plugInName ..............." << plugInName; + qInfo() << "workingDir ..............." << workingDir; + qInfo() << "dryRun ..................." << dryRun; + qInfo() << "extended-version ........." << APP_EXTENDED_VERSION; + //qInfo() << "yocto-version ............" << Worker::getATBUpdateToolYoctoVersion(); + //qInfo() << "yocto-install-status ....." << Worker::getATBUpdateToolYoctoInstallationStatus(); // before loading the library, delete all possible shared memory segments #if defined Q_OS_LINUX || defined Q_OS_UNIX