brillo_payload_generator: Adding warn function and flag verification
- Adding warn function
- Add check to verify that metadata_hash_file flag is set
BUG=b:25479363
TEST=brillo_payload_generator called successfully in local env
Change-Id: I1920c85c06be69cee93be74ef21d4f912714048d
Reviewed-on: https://chromium-review.googlesource.com/310889
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Jason Kusuma <jkusuma@chromium.org>
diff --git a/scripts/brillo_update_payload b/scripts/brillo_update_payload
index cff8fc6..282fbcf 100755
--- a/scripts/brillo_update_payload
+++ b/scripts/brillo_update_payload
@@ -45,6 +45,10 @@
# specified file
# Note that the number of signature sizes and payload signatures have to match.
+warn() {
+ echo "brillo_update_payload: warning: $*" >&2
+}
+
die() {
echo "brillo_update_payload: error: $*" >&2
exit 1
@@ -440,6 +444,9 @@
[[ -n "${FLAGS_payload_hash_file}" ]] ||
die "Error: you must specify --payload_hash_file FILENAME"
+
+ [[ -n "${FLAGS_metadata_hash_file}" ]] ||
+ die "Error: you must specify --metadata_hash_file FILENAME"
}
cmd_hash() {