index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-04-20 12:57:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 12:57:14 +0000 |
commit | f5ef751d53d8bb2c7d180166c196349c86057138 (patch) | |
tree | a72efaad83cecc010fa81447d28ecd7247bc6b39 /archinstall/lib/luks.py | |
parent | e32dbfbd108e9b8598e148a0873d20384c573034 (diff) | |
parent | 2b7face25222c580ebf733942d13a83469f766e5 (diff) |
-rw-r--r-- | archinstall/lib/luks.py | 11 |
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 62067ec1..ca077b3d 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -1,5 +1,7 @@ import os import shlex +import time +import pathlib from .exceptions import * from .general import * from .disk import Partition @@ -43,8 +45,6 @@ class luks2(): return True def encrypt(self, partition, password=None, key_size=512, hash_type='sha512', iter_time=10000, key_file=None): - # TODO: We should be able to integrate this into the main log some how. - # Perhaps post-mortem? if not self.partition.allow_formatting: raise DiskError(f'Could not encrypt volume {self.partition} due to it having a formatting lock.') @@ -116,7 +116,7 @@ class luks2(): def unlock(self, partition, mountpoint, key_file): """ - Mounts a lukts2 compatible partition to a certain mountpoint. + Mounts a luks2 compatible partition to a certain mountpoint. Keyfile must be specified as there's no way to interact with the pw-prompt atm. :param mountpoint: The name without absolute path, for instance "luksdev" will point to /dev/mapper/luksdev @@ -125,6 +125,11 @@ class luks2(): from .disk import get_filesystem_type if '/' in mountpoint: os.path.basename(mountpoint) # TODO: Raise exception instead? + + wait_timer = time.time() + while pathlib.Path(partition.path).exists() is False and time.time() - wait_timer < 10: + time.sleep(0.025) + 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.mapdev = f'/dev/mapper/{mountpoint}' |