From 0bca22f9950d5efd0db9f20d801aa0bc312cfa64 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 2 Oct 2025 15:31:36 +0200 Subject: [PATCH] make sure dcDir can be overwritten on commandline. however, not if usb/sd was detected. --- DownloadDCFirmware/main.cpp | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/DownloadDCFirmware/main.cpp b/DownloadDCFirmware/main.cpp index eef770d..16a6386 100644 --- a/DownloadDCFirmware/main.cpp +++ b/DownloadDCFirmware/main.cpp @@ -134,10 +134,13 @@ int main(int argc, char **argv) { QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr)); */ - QString const &psaDcDir = internal::customerRepoDcDir(); - QString const &psaRepoRootDir = internal::customerRepoRoot(); - QString const &psaRepoDir = internal::customerRepoDir(); - QString const &branchName = internal::branchName(); + QString psaDcDir = internal::customerRepoDcDir(); + QString psaRepoRootDir = internal::customerRepoRoot(); + QString psaRepoDir = internal::customerRepoDir(); + QString branchName = internal::branchName(); + QString rootDir = "/etc/dc/"; + // bool usbDetected = false; + // bool sdCardDetected = false; bool debug = false; bool noaction = true; @@ -151,8 +154,17 @@ int main(int argc, char **argv) { workingDir = settings->value("workingdir", "/tmp").toString(); libca = settings->value("libca", "/usr/lib/libCAslave.so").toString(); settings->endGroup(); + } else { + qCritical() << "count not read ATBUpdateTool.ini"; + return -1; } + QString dcDir = parser.dcDir(); + if (!dcDir.isEmpty()) { + psaDcDir = dcDir; + } + debug = parser.debug(); + if (debug) { qInfo() << " using dc directory: " << psaDcDir; qInfo() << "using psa repo root directory: " << psaRepoRootDir; @@ -164,26 +176,33 @@ int main(int argc, char **argv) { std::optional mountPath = System::checkForUSBStick(psaDcDir); QFileInfo fi; if (mountPath.has_value()) { + // usbDetected = true; + // mountPath/etc/dc must exists ! + // cannot override with commandline parameter --dc-directory if (debug) { qInfo() << "using mount path (USB): " << mountPath.value(); } } else if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) { + // sdCardDetected = true; + // mountPath/etc/dc must exists ! + // cannot override with commandline parameter --dc-directory if (debug) { qInfo() << "using mount path (SD): " << mountPath.value(); } } else { + rootDir = ""; + mountPath = QDir::cleanPath(psaRepoRootDir + QDir::separator() + psaDcDir); if (debug) { - qInfo() << "using customer repository" << psaRepoDir; + qInfo() << "using as dc-directory" << mountPath.value(); } - mountPath = ""; } if (debug) { - qInfo() << "using mount path: " << mountPath.value(); + qInfo() << "using as mount path: " << mountPath.value(); } - std::unique_ptr c = internal::dcCandidateToInstall("/etc/dc/", mountPath.value()); + std::unique_ptr c = internal::dcCandidateToInstall(rootDir, mountPath.value()); if (c) { fi.setFile(*c); if (fi.exists() == false) {