Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-03-14 12:27:48 +0100
committerAnton Hvornum <anton@hvornum.se>2021-03-14 12:27:48 +0100
commite4514e8fc37995656528835d4fd81dc997136575 (patch)
tree07ea3cd41abb88f238b4677947e21ba80f3e3fc7
parent4ac252882291861c612ad1b69a0ce547cbf73ae8 (diff)
Some more error handling.
-rw-r--r--archinstall/lib/luks.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py
index a4d2a07d..77622304 100644
--- a/archinstall/lib/luks.py
+++ b/archinstall/lib/luks.py
@@ -70,7 +70,14 @@ class luks2():
if err.exit_code == 256:
# Partition was in use, unmount it and try again
partition.unmount()
- sys_command(f'cryptsetup close {partition.path}')
+ try:
+ sys_command(f'cryptsetup close {partition.path}')
+ except SysCallError as err:
+ # 0 Means everything went smoothly,
+ # 1024 means the device was not found.
+ if err.exit_code not in (0, 1024):
+ raise err
+
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}')
else:
raise err