Re-create the composite disk with newer partitions
The change that introduced the composite disk would never re-create it.
launch_cvd now checks if any of the partition images are newer than the
composite disk to decide if it should re-create the composite image.
This should happen due to a newer fetch_artifacts.py run or a recompile.
This also changes the metadata partition to only be created when it is
missing to avoid spurious "input partitions are newer" issues.
Bug: 133432409
Test: Run `launch_cvd --composite_disk=composite.img` multiple times
Change-Id: Icb831a491ef6e6903396c2f0e5eda9fbbff52b84
diff --git a/host/commands/launch/flags.cc b/host/commands/launch/flags.cc
index 63ccd0d..a325d10 100644
--- a/host/commands/launch/flags.cc
+++ b/host/commands/launch/flags.cc
@@ -741,7 +741,9 @@
exit(cvd::kCuttlefishConfigurationInitError);
}
- CreateBlankImage(FLAGS_metadata_image, FLAGS_blank_metadata_image_mb, "none");
+ if (!cvd::FileExists(FLAGS_metadata_image)) {
+ CreateBlankImage(FLAGS_metadata_image, FLAGS_blank_metadata_image_mb, "none");
+ }
// Check that the files exist
for (const auto& file :