delta_generator: Include postinstall calls in the payload major version 2.
Added a new flag --new_postinstall_config_file which takes a path to a key
value store config file and saves this information to the PartitionUpdate
field.
The config file looks like this:
RUN_POSTINSTALL_root=true
POSTINSTALL_PATH_root=postinstall
FILESYSTEM_TYPE_root=ext4
"root" can be changed to any partition name.
Bug: 24537566
TEST=Generated a payload v2 with postinstall.
TEST=Added unittest.
Change-Id: Ied3c7bc2cfb54f4bcc69207f1e5bd473f72024fe
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index 8b3efa6..d268ab8 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -87,6 +87,7 @@
Partition part;
part.name = new_conf.name;
part.aops = aops;
+ part.postinstall = new_conf.postinstall;
// Initialize the PartitionInfo objects if present.
if (!old_conf.path.empty())
TEST_AND_RETURN_FALSE(diff_utils::InitializePartitionInfo(old_conf,
@@ -132,6 +133,13 @@
if (major_version_ == kBrilloMajorPayloadVersion) {
PartitionUpdate* partition = manifest_.add_partitions();
partition->set_partition_name(part.name);
+ if (part.postinstall.run) {
+ partition->set_run_postinstall(true);
+ if (!part.postinstall.path.empty())
+ partition->set_postinstall_path(part.postinstall.path);
+ if (!part.postinstall.filesystem_type.empty())
+ partition->set_filesystem_type(part.postinstall.filesystem_type);
+ }
for (const AnnotatedOperation& aop : part.aops) {
*partition->add_operations() = aop.op;
}