From c0d014644c6125d3d3d578a77ee04bad1a61279c Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 14 May 2024 12:35:18 +0200 Subject: [PATCH] Update (conf) JSON-Files using USB stick. When plugged in, look for JSON-files in directory psa-config-directory and load them to the PSA. Note: these files are overwritten during a usual ISMAS-update if not checked in into the customer repository. --- DownloadDCJsonFiles/main.cpp | 48 ++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/DownloadDCJsonFiles/main.cpp b/DownloadDCJsonFiles/main.cpp index b044507..aa861e3 100644 --- a/DownloadDCJsonFiles/main.cpp +++ b/DownloadDCJsonFiles/main.cpp @@ -113,28 +113,31 @@ int main(int argc, char **argv) { return 0; } - QString const customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr)); - - qCritical() << "Using customer repository" << customerRepo; - - // always execute contents of opkg_commands-file + QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr)); QStringList filesToUpdate; - QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config")); - - if (dir.exists()) { - QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files); - if (!jsons.isEmpty()) { - for (QStringList::size_type i=0; i mountPath = System::checkForUSBStick(psaConfigDir); + if (mountPath.has_value()) { + filesToUpdate = System::getJsonFilesOnUsbStick(mountPath.value()); } else { - qCritical() << "DIRECTORY" << dir << "DOES NOT EXIST"; - return -1; + qCritical() << "Using customer repository" << customerRepo; + + QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config")); + if (dir.exists()) { + QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files); + if (!jsons.isEmpty()) { + for (QStringList::size_type i=0; i