Parse postinstall parameters from the payload metadata.
Payload v2 includes a description of the post-install command it should
run, while in payload v1 we use the default values. This patch mounts
the partition on the new top-level directory called /postinstall that
should already be created.
Bug: 27177071
TEST=FEATURES=test emerge-link update_engine
Change-Id: Iaedf3b01e5e1ad57c68bd316b4b6e79cbab35bb6
diff --git a/common/utils.cc b/common/utils.cc
index 91dcfc8..b4956e7 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -613,9 +613,14 @@
bool MountFilesystem(const string& device,
const string& mountpoint,
- unsigned long mountflags) { // NOLINT(runtime/int)
- // TODO(sosa): Remove "ext3" once crbug.com/208022 is resolved.
- const vector<const char*> fstypes{"ext2", "ext3", "ext4", "squashfs"};
+ unsigned long mountflags, // NOLINT(runtime/int)
+ const string& type) {
+ vector<const char*> fstypes;
+ if (type.empty()) {
+ fstypes = {"ext2", "ext3", "ext4", "squashfs"};
+ } else {
+ fstypes = {type.c_str()};
+ }
for (const char* fstype : fstypes) {
int rc = mount(device.c_str(), mountpoint.c_str(), fstype, mountflags,
nullptr);
@@ -625,7 +630,9 @@
PLOG(WARNING) << "Unable to mount destination device " << device
<< " on " << mountpoint << " as " << fstype;
}
- LOG(ERROR) << "Unable to mount " << device << " with any supported type";
+ if (!type.empty()) {
+ LOG(ERROR) << "Unable to mount " << device << " with any supported type";
+ }
return false;
}