dual-image: Always create os-release symlink
Create os-release symlink in processBMCImage() so that the functional
image is always available.
Without this change, processBMCImage() will find the alt image first, and
skip checking the os-release file in the running image. This results in
the missing DBus object for the running image.
Tested: Verify the two objects are created for BMC running and alt
images.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I07e9df4ad07ede36b13a8f447618b569ec446b86
diff --git a/item_updater.cpp b/item_updater.cpp
index b3af305..ceabde5 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -175,6 +175,7 @@
// Functional images are mounted as rofs-<location>-functional
constexpr auto functionalSuffix = "-functional";
+ bool functionalFound = false;
// Read os-release from folders under /media/ to get
// BMC Software Versions.
@@ -238,6 +239,7 @@
// Set functional to true and remove the functional suffix
functional = true;
flashId.erase(flashId.length() - strlen(functionalSuffix));
+ functionalFound = true;
}
auto purpose = server::Version::VersionPurpose::BMC;
@@ -321,11 +323,11 @@
}
}
- // If there are no bmc versions mounted under MEDIA_DIR, then read the
- // /etc/os-release and create rofs-<versionId>-functional under MEDIA_DIR,
- // then call again processBMCImage() to create the D-Bus interface for it.
- if (activations.size() == 0)
+ if (!functionalFound)
{
+ // If there is no functional version found, read the /etc/os-release and
+ // create rofs-<versionId>-functional under MEDIA_DIR, then call again
+ // processBMCImage() to create the D-Bus interface for it.
auto version = VersionClass::getBMCVersion(OS_RELEASE_FILE);
auto id = phosphor::software::manager::Version::getId(version +
functionalSuffix);