Move InstallPlan partitions to a list of partitions.
This patch changes the InstallPlan instance from having hard-coded
rootfs and kernel paritions to have a list of partitions with a
name, source and target information.
The FilesystemVerifierAction, DeltaPerformer and PostInstallAction were
adapter to use the list of partitions instead.
In delta payloads (only supported in the current major version 1) the
list of operations is still fixed: the rootfs first and the kernel.
This list is now populated by the FilesystemVerifierAction including
the size of these partitions, until the whole source partition hash
checking is deprecated (b/23182225).
The PostIntallAction now relies on the DeltaPerformer to populate the
post-install information from the payload. This means that in rollback
we won't run any device-specific post-install operation, and will
simply flip the slots in the bootloader.
Bug: 24667689
Test: Updated unittests. Tested on a dragonboard and a link.
Change-Id: I8277e3190ac74e57832a58dc0730e3713f48af8a
diff --git a/postinstall_runner_action.h b/postinstall_runner_action.h
index c56218a..8b2f55d 100644
--- a/postinstall_runner_action.h
+++ b/postinstall_runner_action.h
@@ -51,19 +51,28 @@
: system_state_(system_state),
powerwash_marker_file_(powerwash_marker_file) {}
+ void PerformPartitionPostinstall();
+
// Subprocess::Exec callback.
- void CompletePostinstall(int return_code,
- const std::string& output);
+ void CompletePartitionPostinstall(int return_code,
+ const std::string& output);
+
+ //
+ void CompletePostinstall(ErrorCode error_code);
InstallPlan install_plan_;
std::string temp_rootfs_dir_;
+ // The partition being processed on the list of partitions specified in the
+ // InstallPlan.
+ size_t current_partition_{0};
+
// The main SystemState singleton.
SystemState* system_state_;
// True if Powerwash Marker was created before invoking post-install script.
// False otherwise. Used for cleaning up if post-install fails.
- bool powerwash_marker_created_ = false;
+ bool powerwash_marker_created_{false};
// Non-null value will cause post-install to override the default marker
// file name; used for testing.