Merge pull request 'Custom OBSW update path' (#582) from feature_custom_obsw_update_path into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #582
This commit is contained in:
Robin Müller 2023-04-11 16:12:42 +02:00
commit d552b51c0d
2 changed files with 19 additions and 1 deletions

View File

@ -30,6 +30,13 @@ will consitute of a breaking change warranting a new major release:
This gives other tasks some time to register the SD cards being unusable, and therefore provides This gives other tasks some time to register the SD cards being unusable, and therefore provides
a way for them to perform any re-initialization tasks necessary after SD card switches. a way for them to perform any re-initialization tasks necessary after SD card switches.
## Changed
- Allow specifying custom OBSW update filename. This allowed keeping a cleaner file structure
where each update has a name including the version
- The files extracted during an update process are deleted after the update was performed to keep
the update directory cleaner.
# [v1.44.0] 2023-04-07 # [v1.44.0] 2023-04-07
- eive-tmtc: v2.22.0 - eive-tmtc: v2.22.0

View File

@ -1984,7 +1984,14 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
} else if (sourceDir == SwUpdateSources::TMP_DIR) { } else if (sourceDir == SwUpdateSources::TMP_DIR) {
prefixPath = path("/tmp"); prefixPath = path("/tmp");
} }
path archivePath = prefixPath / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME); path archivePath;
// It is optionally possible to supply the source file path
if (size > 2) {
archivePath = prefixPath / std::string(reinterpret_cast<const char *>(data + 2), size - 2);
} else {
archivePath = prefixPath / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME);
}
sif::info << "Updating with archive path " << archivePath << std::endl;
std::error_code e; std::error_code e;
if (not exists(archivePath, e)) { if (not exists(archivePath, e)) {
return HasFileSystemIF::FILE_DOES_NOT_EXIST; return HasFileSystemIF::FILE_DOES_NOT_EXIST;
@ -2071,6 +2078,10 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
cmd.str(""); cmd.str("");
cmd.clear(); cmd.clear();
// Remove the extracted files to keep directories clean.
std::filesystem::remove(strippedImagePath, e);
std::filesystem::remove(obswVersionFilePath, e);
// TODO: This takes a long time and will block the core controller.. Maybe use command executor? // TODO: This takes a long time and will block the core controller.. Maybe use command executor?
// For now dont care.. // For now dont care..
cmd << "writeprotect " << std::to_string(data[0]) << " " << std::to_string(data[1]) << " 1"; cmd << "writeprotect " << std::to_string(data[0]) << " " << std::to_string(data[1]) << " 1";