diff --git a/CHANGELOG.md b/CHANGELOG.md index e3995873..5620ec22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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 - eive-tmtc: v2.22.0 diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 9e40b03c..554e5268 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1984,7 +1984,14 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u } else if (sourceDir == SwUpdateSources::TMP_DIR) { 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(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; if (not exists(archivePath, e)) { return HasFileSystemIF::FILE_DOES_NOT_EXIST; @@ -2071,6 +2078,10 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u cmd.str(""); 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? // For now dont care.. cmd << "writeprotect " << std::to_string(data[0]) << " " << std::to_string(data[1]) << " 1";