From f904049c06a4da4c2fdb2ddae23b0234111c1c7e Mon Sep 17 00:00:00 2001 From: Ian Burgwin Date: Mon, 8 Feb 2021 23:43:13 -0800 Subject: [PATCH] custominstall: stop if cifinish.bin is corrupt --- custominstall.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/custominstall.py b/custominstall.py index eea6260..0d8ae17 100644 --- a/custominstall.py +++ b/custominstall.py @@ -276,6 +276,16 @@ class CustomInstall: else: cifinish_path = join(self.sd, 'cifinish.bin') + try: + cifinish_data = load_cifinish(cifinish_path) + except InvalidCIFinishError as e: + self.log(f'{type(e).__qualname__}: {e}') + self.log(f'{cifinish_path} was corrupt!\n' + f'This could mean an issue with the SD card or the filesystem. Please check it for errors.\n' + f'It is also possible, though less likely, to be an issue with custom-install.\n' + f'Exiting now to prevent possible issues. If you want to try again, delete cifinish.bin from the SD card and re-run custom-install.') + return None, False + with TemporaryDirectory(suffix='-custom-install') as tempdir: # set up the common arguments for the two times we call save3ds_fuse save3ds_fuse_common_args = [ @@ -308,12 +318,6 @@ class CustomInstall: return None, False sd_path = join(sd_path, id1s[0]) - try: - cifinish_data = load_cifinish(cifinish_path) - except InvalidCIFinishError as e: - self.log(f'{cifinish_path} is invalid, not loading.') - self.log(f'{type(e).__qualname__}: {e}') - cifinish_data = {} load_seeddb(self.seeddb)