]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
Remove downloaded system images which failed checksum verification
authorGDR! <gdr@gdr.name>
Tue, 19 Oct 2021 10:21:26 +0000 (12:21 +0200)
committerErfan Abdi <erfangplus@gmail.com>
Sun, 24 Oct 2021 12:52:21 +0000 (16:22 +0330)
tools/helpers/images.py

index 8a5a38b22af93e5b59365e54750a6ac99bba7ee0..b54a30161a21579adc0bd78d39b772810cee0dfd 100644 (file)
@@ -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)