From 32346c26659901c91fdd37bf17077ab608c70e63 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 13 Dec 2023 13:49:22 +0100 Subject: [PATCH] If the repository is cloned (or repaired and cloned) and the settings always-download-config and always-download-dc are set in the ini-file, then download the json-files and dc-file, even without an activated WAIT-button. The tariff-files are always synced for a clone. --- worker.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/worker.cpp b/worker.cpp index b51ccb6..f48e457 100644 --- a/worker.cpp +++ b/worker.cpp @@ -340,21 +340,30 @@ void Worker::privateUpdate() { // //////////////////////////////////////////////////////////////////////////// m_ismasTriggerActive = false; - if ((continueUpdate = updateTriggerSet()) == false) { + if (m_clone == false) { + if ((continueUpdate = updateTriggerSet()) == false) { + return; + } else { + GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS)); + setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS); + } + } else { if (m_initialClone) { GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER)); } - return; - } else { - GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER)); } + + qCritical() << "**** m_ismasTriggerActive:" << m_ismasTriggerActive; + qCritical() << "**** m_clone:" << m_clone; + if (m_ismasTriggerActive == false) {// make it explicit again: only if the // ismas trigger is active ('WAIT'), // then proceed - return; - } - GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS)); - setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS); + + if (m_clone == false) { // if it is an (initial) clone, then + return; // run the whole update process: + } // sync tariff-files, download jsons, + } // download device controller //////////////////////////////////////////////////////////////////////////// @@ -650,10 +659,7 @@ bool Worker::filesToUpdate() { // always execute contents of opkg_commands-file m_filesToUpdate << "etc/psa_update/opkg_commands"; - if (m_alwaysDownloadConfig) { -#if 0 - QStringList lst(QString("m_alwaysDownloadConfig NOT TESTED")); - CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY; + if (m_clone && m_alwaysDownloadConfig) { // always download all json-config files, even if none of them have been // changed in the git repository. useful for first installation. QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config")); @@ -663,24 +669,19 @@ bool Worker::filesToUpdate() { m_filesToUpdate << jsons; } } -#endif } - if (m_alwaysDownloadDC) { -#if 0 - QStringList lst(QString("m_alwaysDownloadDC NOT TESTED")); - CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY; + if (m_clone && m_alwaysDownloadDC) { // always download the last dc-binary, even if not changed in the // git repository. useful for first installation. - QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_update")); + QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/dc")); if (dir.exists()) { - QStringList dc = dir.entryList(QStringList() << "dc2c*.bin", QDir::Files, + QStringList dc = dir.entryList(QStringList() << "dc2c.bin", QDir::Files, QDir::SortFlag::Time | QDir::SortFlag::Reversed); if (!dc.isEmpty()) { m_filesToUpdate << dc.first(); } } -#endif } if (std::optional changes = m_gc.gitPull()) { @@ -713,8 +714,7 @@ bool Worker::computeFilesToDownload() { fName.contains("DC2C_cash", Qt::CaseInsensitive)) { m_filesToDownload << fName; // download printer-config-files } else { - static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$"); - if (fName.contains(version)) { + if (fName.contains("dc2c.bin")) { m_filesToDownload << fName; // download device controller } }