Added some more fields to the configuration output, as well as added a better fail safe for the logging output. Any exception during the installation will be caught by __exit__ in Installer(), hopefully.

This commit is contained in:
Anton Hvornum 2021-01-25 00:09:34 +01:00
parent 9a94a632bf
commit 435d2f687e
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
3 changed files with 9 additions and 3 deletions

View File

@ -245,9 +245,9 @@ class sys_command():#Thread):
self.exit_code = 0
if self.exit_code != 0 and not self.kwargs['suppress_errors']:
self.log(f"'{self.raw_cmd}' did not exit gracefully, exit code {self.exit_code}.", level=LOG_LEVELS.Error)
self.log(self.trace_log.decode('UTF-8'), level=LOG_LEVELS.Debug)
raise SysCallError(f"'{self.raw_cmd}' did not exit gracefully, exit code {self.exit_code}.\n{self.trace_log.decode('UTF-8')}")
#self.log(self.trace_log.decode('UTF-8'), level=LOG_LEVELS.Debug)
#self.log(f"'{self.raw_cmd}' did not exit gracefully, exit code {self.exit_code}.", level=LOG_LEVELS.Error)
raise SysCallError(f"{self.trace_log.decode('UTF-8')}\n'{self.raw_cmd}' did not exit gracefully (trace log above), exit code: {self.exit_code}")
self.ended = time.time()
with open(f'{self.cwd}/trace.log', 'wb') as fh:

View File

@ -75,6 +75,7 @@ class Installer():
# b''.join(sys_command(f'sync')) # No need to, since the underlaying fs() object will call sync.
# TODO: https://stackoverflow.com/questions/28157929/how-to-safely-handle-an-exception-inside-a-context-manager
if len(args) >= 2 and args[1]:
self.log(args[1], level=LOG_LEVELS.Error)
raise args[1]
self.genfstab()

View File

@ -85,6 +85,7 @@ archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_error
if len(keyboard_language := archinstall.select_language(archinstall.list_keyboard_languages()).strip()):
archinstall.set_keyboard_language(keyboard_language)
archinstall.storage['_guided']['keyboard_layout'] = keyboard_language
# Create a storage structure for all our information.
# We'll print this right before the user gets informed about the formatting timer.
@ -102,6 +103,7 @@ while (disk_password := getpass.getpass(prompt='Enter disk encryption password (
if disk_password != disk_password_verification:
archinstall.log(' * Passwords did not match * ', bg='black', fg='red')
continue
archinstall.storage['_guided']['disk_encryption'] = True
break
archinstall.storage['_guided']['harddrive'] = harddrive
@ -118,7 +120,10 @@ while (root_pw := getpass.getpass(prompt='Enter root password (leave blank to le
archinstall.log(' * Passwords did not match * ', bg='black', fg='red')
continue
# Storing things in _guided_hidden helps us avoid printing it
# when echoing user configuration: archinstall.storage['_guided']
archinstall.storage['_guided_hidden']['root_pw'] = root_pw
archinstall.storage['_guided']['root_unlocked'] = True
break
# Ask for additional users (super-user if root pw was not set)