aboutsummaryrefslogtreecommitdiff
path: root/linaro-media-create
diff options
context:
space:
mode:
authorJames Tunnicliffe <james.tunnicliffe@linaro.org>2011-07-21 11:04:10 +0100
committerJames Tunnicliffe <james.tunnicliffe@linaro.org>2011-07-21 11:04:10 +0100
commitd95d1eea51a5aa2c488dcda1a49ce8b73dd81aad (patch)
tree9a5334db2a0225dbc291a5504ac837c0386df068 /linaro-media-create
parent3e383dae5192dd325ab864744e6184fa2b2cdc52 (diff)
linaro-media-create now aborts on GPG and sha1sum check fails with nice messages.
Unit tests currently failing, but manual testing shows that this is working fine. Moved the registration of the atexit handler so it isn't called before /tmp has been used.
Diffstat (limited to 'linaro-media-create')
-rwxr-xr-xlinaro-media-create18
1 files changed, 14 insertions, 4 deletions
diff --git a/linaro-media-create b/linaro-media-create
index 344d0f2..18a26e3 100755
--- a/linaro-media-create
+++ b/linaro-media-create
@@ -57,7 +57,6 @@ ROOT_DISK = None
# Registered as the first atexit handler as we want this to be the last
# handler to execute.
-@atexit.register
def cleanup_tempdir():
"""Remove TEMP_DIR with all its contents.
@@ -113,14 +112,25 @@ if __name__ == '__main__':
sig_file_list.append(args.binarysig)
verified_files, gpg_sig_pass = verify_file_integrity(sig_file_list)
+ # Check the outputs from verify_file_integrity
+ # Abort if anything fails.
if not gpg_sig_pass:
- # Other users of verifiy_file_integrity find just a sha1sum pass
- # useful, but here we are only interested in a complete pass or fail.
- verified_files = []
+ print >> sys.stderr, "GPG signature verification failed. Aborting."
+ sys.exit(1)
+
+ if not os.path.basename(args.binary) in verified_files:
+ print >> sys.stderr, "OS Binary verification failed"
+ sys.exit(1)
+
+ for hwpack in args.hwpacks:
+ if not os.path.basename(hwpack) in verified_files:
+ print >> sys.stderr, "Hwpack {0} verification failed".format(hwpack)
+ sys.exit(1)
for verified_file in verified_files:
print 'Hash verification of file %s OK.' % verified_file
+ atexit.register(cleanup_tempdir)
media = Media(args.device)
if media.is_block_device:
if not board_config.supports_writing_to_mmc: