From e96bc08d812ab7133d60162811e9dafb576cf632 Mon Sep 17 00:00:00 2001 From: Roman Kubiak <56821808+rkubiak01@users.noreply.github.com> Date: Wed, 16 Dec 2020 13:32:06 +0100 Subject: [PATCH] [EGD-4969] update fixes for vfs changes (#1199) --- .idea/modules.xml | 8 -------- .../endpoints/update/UpdateMuditaOS.cpp | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 4c94f38f723c4a220d82724ba4352c9acd745fd2..0000000000000000000000000000000000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/module-services/service-desktop/endpoints/update/UpdateMuditaOS.cpp b/module-services/service-desktop/endpoints/update/UpdateMuditaOS.cpp index d7eb1948cb5b120cc2cc9c38867e493ecb64478a..5e61a0e41dd294feea134b21b582cb58571e309e 100644 --- a/module-services/service-desktop/endpoints/update/UpdateMuditaOS.cpp +++ b/module-services/service-desktop/endpoints/update/UpdateMuditaOS.cpp @@ -110,6 +110,10 @@ updateos::UpdateError UpdateMuditaOS::runUpdate() return informError(err, "Can't verify version"); } + // at this point we should set the system to update mode we are + // writing directly to eMMC when updating the bootloader + // then placing the new files in destination folders/files + if ((err = updateBootloader()) == updateos::UpdateError::NoError) { informUpdate(status, "Update bootloader"); } @@ -142,13 +146,16 @@ updateos::UpdateError UpdateMuditaOS::unpackUpdate() mtar_header_t tarHeader; filesInUpdatePackage.clear(); status = updateos::UpdateState::ExtractingFiles; - + std::rewind(updateTar.stream); while ((mtar_read_header(&updateTar, &tarHeader)) != MTAR_ENULLRECORD) { + if (std::string(tarHeader.name) == "./") { + mtar_next(&updateTar); + continue; + } unsigned long fileCRC32 = 0; - if (tarHeader.type == MTAR_TDIR) { fs::path tmpPath = getUpdateTmpChild(tarHeader.name); - if (std::filesystem::create_directory(tmpPath.c_str())) { + if (!std::filesystem::create_directory(tmpPath.c_str())) { return informError(updateos::UpdateError::CantCreateExtractedFile, "unpackUpdate failed to create %s when extracting update tar", tmpPath.c_str()); @@ -475,7 +482,10 @@ updateos::UpdateError UpdateMuditaOS::cleanupAfterUpdate() const fs::path UpdateMuditaOS::getUpdateTmpChild(const fs::path &childPath) { - return updateTempDirectory / childPath; + if (childPath.string().rfind("./", 0) == 0) + return updateTempDirectory / childPath.string().substr(2); + else + return updateTempDirectory / childPath; } updateos::UpdateError UpdateMuditaOS::prepareTempDirForUpdate()