Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/luks.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-05-15 17:49:58 +0000
committerGitHub <noreply@github.com>2021-05-15 17:49:58 +0000
commita75dd6ea3a4f961ddfeaff6b4378bd4aac5c3b39 (patch)
tree7db58a8b4e1c640dc16d0060704f3b304a4e325d /archinstall/lib/luks.py
parent5254ac62200bb279c855d06bea1006b323bfae87 (diff)
parent5067aaa260d218f7d1d60ada2fe8413e90970060 (diff)
Merge pull request #447 from dylanmtaylor/formatting
Very selectively fix some PEP 8 issues and other manual formatting changes
Diffstat (limited to 'archinstall/lib/luks.py')
-rw-r--r--archinstall/lib/luks.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py
index 7f8485e6..e6e1c897 100644
--- a/archinstall/lib/luks.py
+++ b/archinstall/lib/luks.py
@@ -1,13 +1,9 @@
-import os
-import shlex
-import time
import pathlib
-import logging
-from .exceptions import *
-from .general import *
+
from .disk import Partition
+from .general import *
from .output import log
-from .storage import storage
+
class luks2():
def __init__(self, partition, mountpoint, password, key_file=None, auto_unmount=False, *args, **kwargs):
@@ -22,12 +18,12 @@ class luks2():
self.mapdev = None
def __enter__(self):
- #if self.partition.allow_formatting:
- # self.key_file = self.encrypt(self.partition, *self.args, **self.kwargs)
- #else:
+ # if self.partition.allow_formatting:
+ # self.key_file = self.encrypt(self.partition, *self.args, **self.kwargs)
+ # else:
if not self.key_file:
self.key_file = f"/tmp/{os.path.basename(self.partition.path)}.disk_pw" # TODO: Make disk-pw-file randomly unique?
-
+
if type(self.password) != bytes:
self.password = bytes(self.password, 'UTF-8')
@@ -112,7 +108,7 @@ class luks2():
if cmd_handle.exit_code != 0:
raise DiskError(f'Could not encrypt volume "{partition.path}": {cmd_output}')
-
+
return key_file
def unlock(self, partition, mountpoint, key_file):