summaryrefslogtreecommitdiff
path: root/futility/updater.c
diff options
context:
space:
mode:
Diffstat (limited to 'futility/updater.c')
-rw-r--r--futility/updater.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/futility/updater.c b/futility/updater.c
index 95ec6612..94e672dd 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -1673,12 +1673,19 @@ int updater_setup_config(struct updater_config *cfg,
const char *default_quirks = NULL;
int is_factory = arg->is_factory;
const char *archive_path = arg->archive;
+ struct manifest *manifest = NULL;
/* Setup values that may change output or decision of other argument. */
cfg->verbosity = arg->verbosity;
if (arg->force_update)
cfg->force_update = 1;
+ /* Check incompatible options and return early. */
+ if (arg->do_manifest && !arg->archive) {
+ ERROR("Manifest is only available for archive.");
+ return ++errorcnt;
+ }
+
/* Setup update mode. */
if (arg->try_update)
cfg->try_update = 1;
@@ -1735,9 +1742,20 @@ int updater_setup_config(struct updater_config *cfg,
ERROR("Failed to open archive: %s", archive_path);
return ++errorcnt;
}
+
errorcnt += updater_load_images(
cfg, arg->image, arg->ec_image, arg->pd_image);
+ if (arg->do_manifest) {
+ manifest = new_manifest_from_archive(cfg->archive);
+ if (!manifest) {
+ ERROR("Failure in archive: %s", archive_path);
+ return ++errorcnt;
+ }
+ print_json_manifest(manifest);
+ return errorcnt;
+ }
+
/*
* Quirks must be loaded after images are loaded because we use image
* contents to decide default quirks to load. Also, we have to load
@@ -1758,6 +1776,8 @@ int updater_setup_config(struct updater_config *cfg,
errorcnt++;
ERROR("Factory mode needs WP disabled.");
}
+ if (manifest)
+ delete_manifest(manifest);
return errorcnt;
}