Fixed luks2().close() to properly detect it's own path

This commit is contained in:
Anton Hvornum 2021-03-09 11:58:35 +01:00
parent f045462c9a
commit 251624734f
1 changed files with 4 additions and 1 deletions

View File

@ -84,7 +84,10 @@ class luks2():
if os.path.islink(f'/dev/mapper/{mountpoint}'):
return Partition(f'/dev/mapper/{mountpoint}', encrypted=True, filesystem=get_filesystem_type(f'/dev/mapper/{mountpoint}'))
def close(self, 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