Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-03-09 12:00:40 +0100
committerAnton Hvornum <anton.feeds@gmail.com>2021-03-09 12:00:40 +0100
commit3bf8ba081967a041f3552b68efff84340edb5138 (patch)
treeab01e86e7b4cc228d59070871d592dd5e76ca137
parent251624734faa7a01590cb35b3416b72c2271ba55 (diff)
Fixed luks2().close() to properly detect it's own mapped path
-rw-r--r--archinstall/lib/luks.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py
index 283a1b51..7c5d3e55 100644
--- a/archinstall/lib/luks.py
+++ b/archinstall/lib/luks.py
@@ -15,6 +15,7 @@ class luks2():
self.key_file = key_file
self.auto_unmount = auto_unmount
self.filesystem = 'crypto_LUKS'
+ self.mappoint = None
def __enter__(self):
#if self.partition.allow_formatting:
@@ -82,14 +83,15 @@ class luks2():
os.path.basename(mountpoint) # TODO: Raise exception instead?
sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2')
if os.path.islink(f'/dev/mapper/{mountpoint}'):
+ self.mappoint = f'/dev/mapper/{mountpoint}'
return Partition(f'/dev/mapper/{mountpoint}', encrypted=True, filesystem=get_filesystem_type(f'/dev/mapper/{mountpoint}'))
def close(self, mountpoint=None):
if not mountpoint:
- mountpoint = self.partition.path
-
- sys_command(f'cryptsetup close /dev/mapper/{mountpoint}')
- return os.path.islink(f'/dev/mapper/{mountpoint}') is False
+ mountpoint = self.mappoint
+
+ sys_command(f'/usr/bin/cryptsetup close {self.mappoint}')
+ return os.path.islink(self.mappoint) is False
def format(self, path):
if (handle := sys_command(f"/usr/bin/cryptsetup -q -v luksErase {path}")).exit_code != 0: