custominstall: don't extract or rebuild title.db if no titles were installed

This commit is contained in:
Ian Burgwin
2020-05-25 19:26:02 -07:00
parent a515ca7e61
commit b3365c47bd

View File

@@ -162,14 +162,11 @@ class CustomInstall:
# TODO: Move a lot of these into their own methods # TODO: Move a lot of these into their own methods
self.log("Finding path to install to...") self.log("Finding path to install to...")
[sd_path, id1s] = self.get_sd_path() [sd_path, id1s] = self.get_sd_path()
try:
if len(id1s) > 1: if len(id1s) > 1:
raise SDPathError(f'There are multiple id1 directories for id0 {crypto.id0.hex()}, ' raise SDPathError(f'There are multiple id1 directories for id0 {crypto.id0.hex()}, '
f'please remove extra directories') f'please remove extra directories')
elif len(id1s) == 0: elif len(id1s) == 0:
raise SDPathError(f'Could not find a suitable id1 directory for id0 {crypto.id0.hex()}') raise SDPathError(f'Could not find a suitable id1 directory for id0 {crypto.id0.hex()}')
except SDPathError:
self.log("")
cifinish_path = join(self.sd, 'cifinish.bin') cifinish_path = join(self.sd, 'cifinish.bin')
sd_path = join(sd_path, id1s[0]) sd_path = join(sd_path, id1s[0])
@@ -369,8 +366,10 @@ class CustomInstall:
cifinish_data[int(cia.tmd.title_id, 16)] = {'seed': (cia.contents[0].seed if cia.contents[0].flags.uses_seed else None)} cifinish_data[int(cia.tmd.title_id, 16)] = {'seed': (cia.contents[0].seed if cia.contents[0].flags.uses_seed else None)}
# This is saved regardless if any titles were installed, so the file can be upgraded just in case.
save_cifinish(cifinish_path, cifinish_data) save_cifinish(cifinish_path, cifinish_data)
if title_info_entries:
with TemporaryDirectory(suffix='-custom-install') as tempdir: with TemporaryDirectory(suffix='-custom-install') as tempdir:
# set up the common arguments for the two times we call save3ds_fuse # set up the common arguments for the two times we call save3ds_fuse
save3ds_fuse_common_args = [ save3ds_fuse_common_args = [
@@ -398,6 +397,9 @@ class CustomInstall:
self.log('FINAL STEP:\nRun custom-install-finalize through homebrew launcher.') self.log('FINAL STEP:\nRun custom-install-finalize through homebrew launcher.')
self.log('This will install a ticket and seed if required.') self.log('This will install a ticket and seed if required.')
else:
self.log('Did not install any titles.', 2)
def get_sd_path(self): def get_sd_path(self):
sd_path = join(self.sd, 'Nintendo 3DS', self.crypto.id0.hex()) sd_path = join(self.sd, 'Nintendo 3DS', self.crypto.id0.hex())
id1s = [] id1s = []