Scan directories that store PSU images on start
When the service starts, scan the directories that store PSU images,
including the built-in images, and the saved images during PSU update.
When the scanned image is different than the running images, create
activation/version object;
When the scanned image is the same as the running images, update the
version object's path to indicate the PSU image path, so it could be
used for future update in case a PSU is replaced with a different
software.
Tested: On Witherspoon, fake create a dummy PSU image with a different
version than running PSU, verify a new object is created on
restart;
fake creating a dummy PSU image with a same version as a running
PSU, verify no new object is created, but the "Path" property is
set to the PSU image directory.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I860b978250a718eb82d948a1c88bd8f41bb2b2e3
diff --git a/src/version.hpp b/src/version.hpp
index 89db260..dbc48d7 100644
--- a/src/version.hpp
+++ b/src/version.hpp
@@ -112,7 +112,7 @@
}
/**
- * @brief Read the manifest file to get the value of the key.
+ * @brief Read the manifest file to get the values of the keys.
*
* @param[in] filePath - The path to the file which contains the value
* of keys.
@@ -124,6 +124,18 @@
getValues(const std::string& filePath,
const std::vector<std::string>& keys);
+ /**
+ * @brief Read the manifest file to get the value of the key.
+ *
+ * @param[in] filePath - The path to the file which contains the value
+ * of keys.
+ * @param[in] key - The string of the key.
+ *
+ * @return The string of the value.
+ **/
+ static std::string getValue(const std::string& filePath,
+ const std::string& key);
+
/** @brief Get information from extVersion
*
* @param[in] extVersion - The extended version string that contains