From: GDR! Date: Tue, 19 Oct 2021 10:21:26 +0000 (+0200) Subject: Remove downloaded system images which failed checksum verification X-Git-Tag: 1.2.1~14 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/commitdiff_plain/d13c81a7ca2c002cd36ba759f4467a04e1c9aca3 Remove downloaded system images which failed checksum verification --- diff --git a/tools/helpers/images.py b/tools/helpers/images.py index 8a5a38b..b54a301 100644 --- a/tools/helpers/images.py +++ b/tools/helpers/images.py @@ -36,6 +36,10 @@ def get(args): args, system_response['url'], system_response['filename'], cache=False) logging.info("Validating system image") if sha256sum(images_zip) != system_response['id']: + try: + os.remove(images_zip) + except: + pass raise ValueError("Downloaded system image hash doesn't match, expected: {}".format( system_response['id'])) logging.info("Extracting to " + args.images_path) @@ -61,6 +65,10 @@ def get(args): args, vendor_response['url'], vendor_response['filename'], cache=False) logging.info("Validating vendor image") if sha256sum(images_zip) != vendor_response['id']: + try: + os.remove(images_zip) + except: + pass raise ValueError("Downloaded vendor image hash doesn't match, expected: {}".format( vendor_response['id'])) logging.info("Extracting to " + args.images_path)