Removed redundant error handling as well as added some more debug logs.

This commit is contained in:
Anton Hvornum 2021-03-14 13:54:01 +01:00
parent 1c6d705714
commit 7ac68b2436
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
2 changed files with 5 additions and 2 deletions

View File

@ -69,6 +69,7 @@ class luks2():
cmd_handle = sys_command(f'/usr/bin/cryptsetup -q -v --type luks2 --pbkdf argon2i --hash {hash_type} --key-size {key_size} --iter-time {iter_time} --key-file {os.path.abspath(key_file)} --use-urandom luksFormat {partition.path}')
except SysCallError as err:
if err.exit_code == 256:
log(f'{partition} is being used, trying to unmount and crypt-close the device and running one more attempt at encrypting the device.', level=LOG_LEVELS.Debug)
# Partition was in use, unmount it and try again
partition.unmount()
@ -81,9 +82,11 @@ class luks2():
for child in children:
# Unmount the child location
if child_mountpoint := child.get('mountpoint', None):
log(f'Unmounting {child_mountpoint}', level=LOG_LEVELS.Debug)
sys_command(f"umount {child_mountpoint}")
# And close it if possible.
log(f"Closing crypt device {child['name']}", level=LOG_LEVELS.Debug)
sys_command(f"cryptsetup close {child['name']}")
# Then try again to set up the crypt-device

View File

@ -305,8 +305,8 @@ def perform_installation(device, boot_partition, language, mirrors):
if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '':
installation.add_additional_packages(archinstall.arguments.get('packages', None))
if archinstall.arguments.get('profile', None) and len(profile := archinstall.arguments.get('profile').strip()):
installation.install_profile(profile)
if archinstall.arguments.get('profile', None):
installation.install_profile(archinstall.arguments.get('profile', None))
if archinstall.arguments.get('users', None):
for user in archinstall.arguments.get('users'):