ItemUpdater: Validate BMC squashfs image
- Validate the image dir by checking its content.
- Set Activation to "Active" if current image,
"Ready" if validation passed and "Invalid" if
validation fails
Resolves openbmc/openbmc#1629
Change-Id: I5f1c42fb2ba93c849ea8653c9e81c737ae27c814
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/item_updater.hpp b/item_updater.hpp
index e9bea6f..14737fb 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -25,6 +25,16 @@
ItemUpdater(ItemUpdater&&) = delete;
ItemUpdater& operator=(ItemUpdater&&) = delete;
+ /*
+ * @brief Types of Activation status for image validation.
+ */
+ enum class ActivationStatus
+ {
+ ready,
+ invalid,
+ active
+ };
+
/** @brief Constructs ItemUpdater
*
* @param[in] bus - The Dbus bus object
@@ -50,6 +60,18 @@
*/
void createActivation(sdbusplus::message::message& msg);
+ /**
+ * @brief Validates the presence of SquashFS iamge in the image dir.
+ *
+ * @param[in] versionId - The software version ID.
+ * @param[out] result - ActivationStatus Enum.
+ * ready if validation was successful.
+ * invalid if validation fail.
+ * active if image is the current version.
+ *
+ */
+ ActivationStatus validateSquashFSImage(const std::string& versionId);
+
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;