summaryrefslogtreecommitdiff
path: root/payload_consumer/postinstall_runner_action.cc
diff options
context:
space:
mode:
authorSen Jiang <senj@google.com>2017-10-31 15:14:11 -0700
committerSen Jiang <senj@google.com>2017-11-01 16:50:30 -0700
commitfe5228282571154b51d3907cad4744e228e66a22 (patch)
tree0ba712bc0a948783ede564bd73d3f6268af3251e /payload_consumer/postinstall_runner_action.cc
parent54e6868331ac10558f8bcb25c5448097a548b268 (diff)
Add support for new payload property headers to delay switching slots.
Set SWITCH_SLOT_ON_REBOOT=0 to skip marking new slot as active. When ready to reboot to the new update, call applyPayload() again to switch the slots, download will be skipped because it has already finished, filesystem verification will always happen, and postinstall can be skipped if it succeeded before for this update and RUN_POST_INSTALL is set to 0. Also removed reset update progress when update succeeded to support reverting to current slot with resetStatus() without clearing download progress. If the next update is a different payload then we will still reset the progress on next update. Bug: 35212183 Test: update_device.py --extra-headers 'SWITCH_SLOT_ON_REBOOT=0' ... Merged-In: I52e2371ea4a9e6a6d026b4dd04bb1a60d95c9d5c Change-Id: I52e2371ea4a9e6a6d026b4dd04bb1a60d95c9d5c (cherry picked from commit e9685de187317c3bc92a2d63d3f4a40b9831f448)
Diffstat (limited to 'payload_consumer/postinstall_runner_action.cc')
-rw-r--r--payload_consumer/postinstall_runner_action.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 27a9ed61..cedecda9 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -82,6 +82,11 @@ void PostinstallRunnerAction::PerformAction() {
}
void PostinstallRunnerAction::PerformPartitionPostinstall() {
+ if (!install_plan_.run_post_install) {
+ LOG(INFO) << "Skipping post-install according to install plan.";
+ return CompletePostinstall(ErrorCode::kSuccess);
+ }
+
if (install_plan_.download_url.empty()) {
LOG(INFO) << "Skipping post-install during rollback";
return CompletePostinstall(ErrorCode::kSuccess);
@@ -331,15 +336,21 @@ void PostinstallRunnerAction::CompletePartitionPostinstall(
void PostinstallRunnerAction::CompletePostinstall(ErrorCode error_code) {
// We only attempt to mark the new slot as active if all the postinstall
// steps succeeded.
- if (error_code == ErrorCode::kSuccess &&
- !boot_control_->SetActiveBootSlot(install_plan_.target_slot)) {
- error_code = ErrorCode::kPostinstallRunnerError;
+ if (error_code == ErrorCode::kSuccess) {
+ if (install_plan_.switch_slot_on_reboot) {
+ if (!boot_control_->SetActiveBootSlot(install_plan_.target_slot)) {
+ error_code = ErrorCode::kPostinstallRunnerError;
+ }
+ } else {
+ error_code = ErrorCode::kUpdatedButNotActive;
+ }
}
ScopedActionCompleter completer(processor_, this);
completer.set_code(error_code);
- if (error_code != ErrorCode::kSuccess) {
+ if (error_code != ErrorCode::kSuccess &&
+ error_code != ErrorCode::kUpdatedButNotActive) {
LOG(ERROR) << "Postinstall action failed.";
// Undo any changes done to trigger Powerwash.