From 60084450e6b971c757c59872578bec018372c2e1 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 17 Jul 2023 16:54:18 +0200 Subject: [PATCH] Removed 't (testMode)' and 'e (executeScript)' options. Adapted call to Worker-ctor. --- main.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/main.cpp b/main.cpp index 8371607..1a6a7ea 100644 --- a/main.cpp +++ b/main.cpp @@ -84,16 +84,6 @@ int main(int argc, char *argv[]) { QCoreApplication::translate("main", "Maintenance mode for underlying script")); parser.addOption(maintenanceOption); - // test-mode: edit the file update_log.csv and execute the commands - // contained in it. Do not call the update-script. - QCommandLineOption testOption(QStringList() << "t" << "test", - QCoreApplication::translate("main", "Test mode for ATBUpdateTool")); - parser.addOption(testOption); - - QCommandLineOption execScriptOption(QStringList() << "e" << "execute-script-only", - QCoreApplication::translate("main", "ATBUpdateTool executes update-script only. No download of any files.")); - parser.addOption(execScriptOption); - QCommandLineOption dryRunOption(QStringList() << "d" << "dry-run", QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions.")); parser.addOption(dryRunOption); @@ -112,8 +102,6 @@ int main(int argc, char *argv[]) { QString plugInName = parser.value(pluginNameOption); QString workingDir = parser.value(workingDirectoryOption); bool maintenanceMode = parser.isSet(maintenanceOption); - bool testMode = parser.isSet(testOption); - bool executeScriptOnly = parser.isSet(execScriptOption); bool dryRun = parser.isSet(dryRunOption); QString const rtPath = QCoreApplication::applicationDirPath(); @@ -131,8 +119,6 @@ int main(int argc, char *argv[]) { qInfo() << "plugInName ........" << plugInName; qInfo() << "workingDir ........" << workingDir; qInfo() << "maintenanceMode ..." << maintenanceMode; - qInfo() << "testMode .........." << testMode; - qInfo() << "execScriptOnly ...." << executeScriptOnly; qInfo() << "dryRun ............" << dryRun; // before loading the library, delete all possible shared memory segments @@ -146,15 +132,22 @@ int main(int argc, char *argv[]) { // hw->dc_autoRequest(false); QString const update_ctrl_file = "/opt/app/tools/atbupdate/update_log.csv"; - Worker worker(hw, update_ctrl_file, - "https://git.mimbach49.de/GerhardHoffmann/customer_999.git", - "customer_999", - "zg1/zone1", + + int machineNr = Worker::read1stLineOfFile("/etc/machine_nr"); + int customerNr = Worker::read1stLineOfFile("/etc/cust_nr"); + QString customerNrStr = QString("customer_") + QString::number(customerNr).rightJustified(3, '0'); + int zoneNr = Worker::read1stLineOfFile("/etc/zone_nr"); + QString branchName = QString("zg1/zone%1").arg(zoneNr); + + Worker worker(hw, + customerNr, + machineNr, + zoneNr, + branchName, workingDir, maintenanceMode, - testMode, - executeScriptOnly, - dryRun); + dryRun + ); return a.exec(); }