3 #include "aktualizr_helpers.h" 5 void targets_autoclean_cb(
Aktualizr &aktualizr,
const std::shared_ptr<event::BaseEvent> &
event) {
10 std::vector<Uptane::Target> installed_targets = aktualizr.
GetStoredTargets();
11 std::vector<bool> to_remove(installed_targets.size(),
true);
13 Aktualizr::InstallationLog log = aktualizr.GetInstallationLog();
17 auto start = entry.installs.size() >= 2 ? entry.installs.end() - 2 : entry.installs.begin();
18 for (
auto it = start; it != entry.installs.end(); it++) {
19 auto fit = std::find_if(installed_targets.begin(), installed_targets.end(),
20 [&it](
const Uptane::Target &t2) {
return it->sha256Hash() == t2.sha256Hash(); });
22 if (fit == installed_targets.end()) {
26 size_t rem_idx =
static_cast<size_t>(fit - installed_targets.begin());
27 to_remove[rem_idx] =
false;
31 for (
size_t k = 0; k < installed_targets.size(); k++) {
All ECU installation attempts for an update have completed.
std::vector< Uptane::Target > GetStoredTargets()
Get list of targets currently in storage.
void DeleteStoredTarget(const Uptane::Target &target)
Delete a stored target from storage.
This class provides the main APIs necessary for launching and controlling libaktualizr.
Get log of installations.