update_engine: Attempt to mount the ROOTFS as squashfs during postinst.
This patch extends utils::MountFilesystem() to attempt to mount
the device as ext3, ext2 and squashfs before failing.
BUG=chromium:432016
TEST=None
Change-Id: Ibad2f359968d7abe9f82f11c895cac95130d73c5
Reviewed-on: https://chromium-review.googlesource.com/229020
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/postinstall_runner_action.cc b/postinstall_runner_action.cc
index 81e546e..b619cce 100644
--- a/postinstall_runner_action.cc
+++ b/postinstall_runner_action.cc
@@ -38,27 +38,8 @@
&temp_rootfs_dir_));
ScopedDirRemover temp_dir_remover(temp_rootfs_dir_);
- unsigned long mountflags = MS_RDONLY; // NOLINT(runtime/int)
- int rc = mount(install_device.c_str(),
- temp_rootfs_dir_.c_str(),
- "ext2",
- mountflags,
- nullptr);
- // TODO(sosa): Remove once crbug.com/208022 is resolved.
- if (rc < 0) {
- LOG(INFO) << "Failed to mount install part "
- << install_device << " as ext2. Trying ext3.";
- rc = mount(install_device.c_str(),
- temp_rootfs_dir_.c_str(),
- "ext3",
- mountflags,
- nullptr);
- }
- if (rc < 0) {
- LOG(ERROR) << "Unable to mount destination device " << install_device
- << " onto " << temp_rootfs_dir_;
+ if (!utils::MountFilesystem(install_device, temp_rootfs_dir_, MS_RDONLY))
return;
- }
temp_dir_remover.set_should_remove(false);
completer.set_should_complete(false);