diff options
-rw-r--r-- | service/OneService.cpp | 3 | ||||
-rw-r--r-- | service/SoftwareUpdater.cpp | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index 697be24a..b273aad4 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -722,7 +722,8 @@ public: // Check for updates (if enabled) if ((_updater)&&((now - lastUpdateCheck) > 10000)) { lastUpdateCheck = now; - _updater->check(now); + if (_updater->check(now) && _updateAutoApply) + _updater->apply(); } // Refresh bindings in case device's interfaces have changed, and also sync routes to update any shadow routes (e.g. shadow default) diff --git a/service/SoftwareUpdater.cpp b/service/SoftwareUpdater.cpp index f10eb204..0f5b4fca 100644 --- a/service/SoftwareUpdater.cpp +++ b/service/SoftwareUpdater.cpp @@ -450,7 +450,7 @@ bool SoftwareUpdater::check(const uint64_t now) if (_latestBinLength > 0) { if (_latestBin.length() >= _latestBinLength) { if (_latestBinValid) { - return _latestMeta; + return true; } else { // This is the very important security validation part that makes sure // this software update doesn't have cooties. @@ -466,7 +466,7 @@ bool SoftwareUpdater::check(const uint64_t now) // If we passed both of these, the update is good! _latestBinValid = true; printf("VALID UPDATE\n%s\n",OSUtils::jsonDump(_latestMeta).c_str()); - return _latestMeta; + return true; } } } catch ( ... ) {} // any exception equals verification failure @@ -488,7 +488,7 @@ bool SoftwareUpdater::check(const uint64_t now) } } - return nlohmann::json(); + return false; } void SoftwareUpdater::apply() |