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.
This commit is contained in:
Gerhard Hoffmann 2023-12-13 13:49:22 +01:00
parent 38e7bf4985
commit 32346c2665

View File

@ -340,21 +340,30 @@ void Worker::privateUpdate() {
// //
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
m_ismasTriggerActive = false; m_ismasTriggerActive = false;
if (m_clone == false) {
if ((continueUpdate = updateTriggerSet()) == 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) { if (m_initialClone) {
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER)); 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 if (m_ismasTriggerActive == false) {// make it explicit again: only if the
// ismas trigger is active ('WAIT'), // ismas trigger is active ('WAIT'),
// then proceed // then proceed
return;
} if (m_clone == false) { // if it is an (initial) clone, then
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS)); return; // run the whole update process:
setProgress(_CHECK_ISMAS_TRIGGER_SUCCESS); } // sync tariff-files, download jsons,
} // download device controller
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
@ -650,10 +659,7 @@ bool Worker::filesToUpdate() {
// always execute contents of opkg_commands-file // always execute contents of opkg_commands-file
m_filesToUpdate << "etc/psa_update/opkg_commands"; m_filesToUpdate << "etc/psa_update/opkg_commands";
if (m_alwaysDownloadConfig) { if (m_clone && 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 // always download all json-config files, even if none of them have been
// changed in the git repository. useful for first installation. // changed in the git repository. useful for first installation.
QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config")); QDir dir(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_config"));
@ -663,24 +669,19 @@ bool Worker::filesToUpdate() {
m_filesToUpdate << jsons; m_filesToUpdate << jsons;
} }
} }
#endif
} }
if (m_alwaysDownloadDC) { if (m_clone && 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 // always download the last dc-binary, even if not changed in the
// git repository. useful for first installation. // 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()) { 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); QDir::SortFlag::Time | QDir::SortFlag::Reversed);
if (!dc.isEmpty()) { if (!dc.isEmpty()) {
m_filesToUpdate << dc.first(); m_filesToUpdate << dc.first();
} }
} }
#endif
} }
if (std::optional<QString> changes = m_gc.gitPull()) { if (std::optional<QString> changes = m_gc.gitPull()) {
@ -713,8 +714,7 @@ bool Worker::computeFilesToDownload() {
fName.contains("DC2C_cash", Qt::CaseInsensitive)) { fName.contains("DC2C_cash", Qt::CaseInsensitive)) {
m_filesToDownload << fName; // download printer-config-files m_filesToDownload << fName; // download printer-config-files
} else { } else {
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$"); if (fName.contains("dc2c.bin")) {
if (fName.contains(version)) {
m_filesToDownload << fName; // download device controller m_filesToDownload << fName; // download device controller
} }
} }