diff --git a/worker.cpp b/worker.cpp index fb9727c..78b88eb 100644 --- a/worker.cpp +++ b/worker.cpp @@ -116,6 +116,8 @@ Worker::Worker(int customerNr, QString pluginName, QString workingDirectory, bool noUpdatePsaHardware, + bool alwaysDownloadConfig, + bool alwaysDownloadDC, bool dryRun, QObject *parent, char const *serialInterface, @@ -131,6 +133,8 @@ Worker::Worker(int customerNr, , m_customerRepositoryPath(QString("%1/%2.git").arg(repositoryUrl).arg(m_customerNrStr)) , m_customerRepository(QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr)) , m_noUpdatePsaHardware(noUpdatePsaHardware) + , m_alwaysDownloadConfig(alwaysDownloadConfig) + , m_alwaysDownloadDC(alwaysDownloadDC) , m_dryRun(dryRun) , m_parent(parent) , m_serialInterface(serialInterface) @@ -638,6 +642,39 @@ 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; + // 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")); + if (dir.exists()) { + QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files); + if (!jsons.isEmpty()) { + m_filesToUpdate << jsons; + } + } +#endif + } + + if (m_alwaysDownloadDC) { +#if 0 + QStringList lst(QString("m_alwaysDownloadDC NOT TESTED")); + CONSOLE(lst) << UPDATE_STEP::UPDATE_REPOSITORY; + // 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")); + if (dir.exists()) { + 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()) { if (!changes.value().contains("Already up to date")) { if (std::optional changedFileNames = m_gc.gitDiff(changes.value())) { @@ -652,7 +689,6 @@ bool Worker::filesToUpdate() { return false; } - return true; }