diff --git a/DownloadDCFirmware/main.cpp b/DownloadDCFirmware/main.cpp index 84d8755..98e6b11 100644 --- a/DownloadDCFirmware/main.cpp +++ b/DownloadDCFirmware/main.cpp @@ -133,7 +133,6 @@ 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(); @@ -145,7 +144,6 @@ int main(int argc, char **argv) { QString libca; std::unique_ptr settings = internal::readSettings(); - if (settings) { settings->beginGroup("ATBUpdateDC"); debug = settings->value("debug", false).toBool(); @@ -154,29 +152,44 @@ int main(int argc, char **argv) { settings->endGroup(); } + if (debug) { + qInfo() << " using dc directory: " << psaDcDir; + qInfo() << "using psa repo root directory: " << psaRepoRootDir; + qInfo() << " using customer repository: " << psaRepoDir; + qInfo() << " using branch: " << branchName; + } + // etc/dc: located under mount-path std::optional mountPath = System::checkForUSBStick(psaDcDir); QFileInfo fi; if (mountPath.has_value()) { - fi.setFile(mountPath.value(), System::getDCFileOnUsbStick(mountPath.value())); + if (debug) { + qInfo() << "using mount path (USB): " << mountPath.value(); + } } else if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) { - fi.setFile(mountPath.value(), System::getDCFileOnSDCard(mountPath.value())); + if (debug) { + qInfo() << "using mount path (SD): " << mountPath.value(); + } } else { - if (debug) { qInfo() << "using customer repository" << psaRepoDir; } + mountPath = ""; + } - std::unique_ptr c = internal::dcCandidateToInstall("/etc/dc/"); - if (c) { - fi.setFile(*c); - if (fi.exists() == false) { - qCritical() << "dc2c.bin candidate" << *c << "does not exist. STOP."; - return -1; - } - qInfo() << "dc2c.bin canditate" << fi.absoluteFilePath(); + if (debug) { + qInfo() << "using mount path: " << mountPath.value(); + } + + std::unique_ptr c = internal::dcCandidateToInstall("/etc/dc/", mountPath.value()); + if (c) { + fi.setFile(*c); + if (fi.exists() == false) { + qCritical() << "dc2c.bin candidate" << *c << "does not exist. STOP."; + return -1; } + qInfo() << "dc2c.bin canditate" << fi.absoluteFilePath(); } if (debug) { @@ -185,6 +198,9 @@ int main(int argc, char **argv) { qInfo() << "dc-version" << Update::dcVersion(fi.absoluteFilePath()); } + // only for testing + // return 0; + Update u(fi.absoluteFilePath(), libca, debug, noaction); u.run();