From 2dda429ebd78e44446001190ee496720792d32b4 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Thu, 15 Mar 2018 15:09:51 -0700 Subject: utils: fixup for downloader SHA256 check The image package is not unzipped or kept if the SHA256 checksum fails --- host/utils/uhd_images_downloader.py.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'host/utils') diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index 4c896c18c..5dffe625e 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -358,9 +358,14 @@ def main(): buffer_size=args.buffer_size, print_progress=(_LOG_LEVEL <= _LOG_LEVELS.get("INFO", 3)) ) + # If the check fails, print an error and don't unzip the file if downloaded_sha256 != target_sha256: - log("ERROR", "Downloaded SHA256 does not match manifest for {}!".format( - full_url)) + log("ERROR", "Downloaded SHA256 does not match manifest for {}! " + "The images from this package have not been updated." + .format(full_url)) + continue + # Note: this skips the --keep option, so we'll never keep image packages + # that fail the SHA256 checksum log("TRACE", "{} successfully downloaded ({} Bytes)" .format(temp_path, downloaded_size)) -- cgit v1.2.3