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/update_attempter.h b/update_attempter.h
index 315e545..d33d69e 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -18,6 +18,7 @@
#include "update_engine/action_processor.h"
#include "update_engine/chrome_browser_proxy_resolver.h"
#include "update_engine/download_action.h"
+#include "update_engine/filesystem_copier_action.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/omaha_response_handler_action.h"
#include "update_engine/proxy_resolver.h"
@@ -45,6 +46,7 @@
UPDATE_STATUS_FINALIZING,
UPDATE_STATUS_UPDATED_NEED_REBOOT,
UPDATE_STATUS_REPORTING_ERROR_EVENT,
+ UPDATE_STATUS_ATTEMPTING_ROLLBACK
};
enum UpdateNotice {
@@ -142,6 +144,12 @@
const std::string& omaha_url,
bool is_interactive);
+ // This is the internal entry point for going through a rollback. This will
+ // attempt to run the postinstall on the non-active partition and set it as
+ // the partition to boot from. If |powerwash| is True, perform a powerwash
+ // as part of rollback.
+ void Rollback(bool powerwash);
+
// Initiates a reboot if the current state is
// UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise.
bool RebootIfNeeded();
@@ -270,9 +278,15 @@
// scatter factor value specified from policy.
void GenerateNewWaitingPeriod();
+ // Helper method of Update() and Rollback() to construct the sequence of
+ // actions to be performed for the postinstall.
+ // |previous_action| is the previous action to get
+ // bonded with the install_plan that gets passed to postinstall.
+ void BuildPostInstallActions(InstallPlanAction* previous_action);
+
// Helper method of Update() to construct the sequence of actions to
// be performed for an update check. Please refer to
- // Update() method for the meaning of the parametes.
+ // Update() method for the meaning of the parameters.
void BuildUpdateActions(bool interactive);
// Decrements the count in the kUpdateCheckCountFilePath.