Implement Rollback to previously booted partitions.
This CL implements rollback to whatever partition we ran from before.
We expose this functionality via dbus under AttemptRollback and expose
a new command-line option to update_engine_client that a developer can
use.
BUG=chromium:242665
TEST=Unittests, full update, update + rollback and verified.
Change-Id: Ie59f90b9a0b777dc1329592449090c70892236bf
Reviewed-on: https://gerrit.chromium.org/gerrit/58427
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/postinstall_runner_action.cc b/postinstall_runner_action.cc
index 20dfae9..1143447 100644
--- a/postinstall_runner_action.cc
+++ b/postinstall_runner_action.cc
@@ -23,8 +23,8 @@
void PostinstallRunnerAction::PerformAction() {
CHECK(HasInputObject());
- const InstallPlan install_plan = GetInputObject();
- const string install_device = install_plan.install_path;
+ install_plan_ = GetInputObject();
+ const string install_device = install_plan_.install_path;
ScopedActionCompleter completer(processor_, this);
// Make mountpoint.
@@ -38,8 +38,10 @@
"ext2",
mountflags,
NULL);
+ // TODO(sosa): Remove once crbug.com/208022 is resolved.
if (rc < 0) {
- LOG(INFO) << "Failed to mount install part as ext2. Trying ext3.";
+ 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",
@@ -55,7 +57,7 @@
temp_dir_remover.set_should_remove(false);
completer.set_should_complete(false);
- if (install_plan.powerwash_required) {
+ if (install_plan_.powerwash_required) {
if (utils::CreatePowerwashMarkerFile()) {
powerwash_marker_created_ = true;
} else {
@@ -94,11 +96,9 @@
}
LOG(INFO) << "Postinst command succeeded";
- CHECK(HasInputObject());
- const InstallPlan install_plan = GetInputObject();
-
- if (HasOutputPipe())
- SetOutputObject(install_plan);
+ if (HasOutputPipe()) {
+ SetOutputObject(install_plan_);
+ }
completer.set_code(kErrorCodeSuccess);
}