update_engine: Expose the update_engine.conf in the FilesystemInterface.
The old image contains a /etc/update_engine.conf file that states the
payload version supported by that image. Currently we read this file
directly from the mounted filesystem and parse its contents. To stop
mounting the filesystem we need to retrieve the information on this file
somehow.
This patch extends the FilesystemInterface with a method to load the
update_engine.conf settings from the filesystem and implemets it using
ext2fs on ext2 filesystems.
CQ-DEPED=CL:282380
BUG=chromium:305832
TEST=Added new unittests with and without this file.
Change-Id: I41b41e8aac58c645fb40aabfe340cde8821e405a
Reviewed-on: https://chromium-review.googlesource.com/282381
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/payload_generator/fake_filesystem.h b/payload_generator/fake_filesystem.h
index 10b6683..35b7756 100644
--- a/payload_generator/fake_filesystem.h
+++ b/payload_generator/fake_filesystem.h
@@ -26,17 +26,25 @@
size_t GetBlockSize() const override;
size_t GetBlockCount() const override;
bool GetFiles(std::vector<File>* files) const override;
+ bool LoadSettings(chromeos::KeyValueStore* store) const override;
// Fake methods.
// Add a file to the list of fake files.
void AddFile(const std::string& filename, const std::vector<Extent> extents);
+ // Sets the PAYLOAD_MINOR_VERSION key stored by LoadSettings(). Use a negative
+ // value to produce an error in LoadSettings().
+ void SetMinorVersion(int minor_version) {
+ minor_version_ = minor_version;
+ }
+
private:
FakeFilesystem() = default;
uint64_t block_size_;
uint64_t block_count_;
+ int minor_version_{-1};
std::vector<File> files_;