update_engine: Detect supported minor version from conf file.
If the delta minor version is not given as a command line argument, the
payload generator will look for the minor version in
etc/update_engine.conf in the old image.
BUG=chromium:455493
TEST=`FEATURES=test emerge-link update_engine`
CQ-DEPEND=CL:249956
Change-Id: I0f8e3f3c05432169770f2e8e283e8f1fb363def3
Reviewed-on: https://chromium-review.googlesource.com/249955
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
diff --git a/utils.cc b/utils.cc
index 77e5a35..c512414 100644
--- a/utils.cc
+++ b/utils.cc
@@ -37,6 +37,7 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include <chromeos/data_encoding.h>
+#include <chromeos/key_value_store.h>
#include <glib.h>
#include "update_engine/clock_interface.h"
@@ -1574,6 +1575,17 @@
return ret;
}
+bool GetMinorVersion(base::FilePath path, uint32_t* minor_version) {
+ chromeos::KeyValueStore store;
+ std::string result;
+ if (base::PathExists(path) && store.Load(path) &&
+ store.GetString("PAYLOAD_MINOR_VERSION", &result)) {
+ *minor_version = atoi(result.c_str());
+ return true;
+ }
+ return false;
+}
+
} // namespace utils
} // namespace chromeos_update_engine