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.feeds+github@gmail.com>2020-11-04 22:41:50 +0100
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-11-04 22:41:50 +0100
commitb98850819bdbdb23e354bb5bf5d5383cf807d22d (patch)
tree8c2f5138612e532837dedfefc2832bd14b519abe /archinstall/lib/luks.py
parente06ca749a4382c37350d36cf08aa3fa5369ce9e2 (diff)
Added multiple log features.
* [Reintroduced](https://github.com/Torxed/archinstall/blob/f64a605449f59c677dff39962f1cb46616d893b7/archinstall.py#L57-L71) log levels * Created a global log file definition * Optional support for `python-systemd`'s journald handler. * Optional file output that has a globally configurable definition, that archinstall will honor in `archinstall.storage['logfile']`.
Diffstat (limited to 'archinstall/lib/luks.py')
-rw-r--r--archinstall/lib/luks.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py
index d4ee6632..7dfa9edc 100644
--- a/archinstall/lib/luks.py
+++ b/archinstall/lib/luks.py
@@ -2,6 +2,8 @@ import os
from .exceptions import *
from .general import *
from .disk import Partition
+from .output import log, LOG_LEVELS
+from .storage import storage
class luks2():
def __init__(self, partition, mountpoint, password, *args, **kwargs):
@@ -22,7 +24,10 @@ class luks2():
return True
def encrypt(self, partition, password, key_size=512, hash_type='sha512', iter_time=10000, key_file=None):
- log(f'Encrypting {partition}')
+ # TODO: We should be able to integrate this into the main log some how.
+ # Perhaps post-mortem?
+ log(f'Encrypting {partition}', level=LOG_LEVELS.Info, file=storage.get('logfile', None))
+
if not key_file:
key_file = f"/tmp/{os.path.basename(self.partition.path)}.disk_pw" # TODO: Make disk-pw-file randomly unique?
if type(password) != bytes: password = bytes(password, 'UTF-8')