mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #17984 from fjmolinas/pr_suit_install_once
sys/suit: avoid installing payload twice
This commit is contained in:
commit
cdf1d43e15
@ -196,7 +196,8 @@ typedef struct {
|
||||
#define SUIT_COMPONENT_STATE_FETCHED (1 << 0) /**< Component is fetched */
|
||||
#define SUIT_COMPONENT_STATE_FETCH_FAILED (1 << 1) /**< Component fetched but failed */
|
||||
#define SUIT_COMPONENT_STATE_VERIFIED (1 << 2) /**< Component is verified */
|
||||
#define SUIT_COMPONENT_STATE_FINALIZED (1 << 3) /**< Component successfully installed */
|
||||
#define SUIT_COMPONENT_STATE_INSTALLED (1 << 3) /**< Component is installed, but has not been verified */
|
||||
#define SUIT_COMPONENT_STATE_FINALIZED (1 << 4) /**< Component successfully installed */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -488,8 +488,14 @@ static int _dtv_verify_image_match(suit_manifest_t *manifest, int key,
|
||||
LOG_INFO("Starting digest verification against image\n");
|
||||
res = _validate_payload(comp, digest, img_size);
|
||||
if (res == SUIT_OK) {
|
||||
LOG_INFO("Install correct payload\n");
|
||||
suit_storage_install(comp->storage_backend, manifest);
|
||||
if (!suit_component_check_flag(comp, SUIT_COMPONENT_STATE_INSTALLED)) {
|
||||
LOG_INFO("Install correct payload\n");
|
||||
suit_storage_install(comp->storage_backend, manifest);
|
||||
suit_component_set_flag(comp, SUIT_COMPONENT_STATE_INSTALLED);
|
||||
}
|
||||
if (suit_component_check_flag(comp, SUIT_COMPONENT_STATE_INSTALLED)) {
|
||||
LOG_INFO("Verified installed payload\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_INFO("Erasing bad payload\n");
|
||||
|
Loading…
Reference in New Issue
Block a user