Implemented #106 in branch skip-partitioning. Also moving the disk_password from being a local variable to a BlockDevice setting/variable.

This commit is contained in:
Anton Hvornum 2021-02-17 12:24:56 +01:00
parent 3a8a25982a
commit 5cb3b0d176
3 changed files with 18 additions and 9 deletions

View File

@ -23,6 +23,10 @@ class BlockDevice():
self.path = path
self.info = info
self.part_cache = OrderedDict()
# TODO: Currently disk encryption is a BIT missleading.
# It's actually partition-encryption, but for future-proofing this
# I'm placing the encryption password on a BlockDevice level.
self.encryption_passwoed = None
def __repr__(self, *args, **kwargs):
return f"BlockDevice({self.device})"

View File

@ -1,10 +1,20 @@
import getpass
from .exceptions import *
from .profiles import Profile
from .locale_helpers import search_keyboard_layout
from .output import log
## TODO: Some inconsistencies between the selection processes.
## Some return the keys from the options, some the values?
def get_password(prompt="Enter a password: "):
while (passwd := getpass.getpass(prompt)):
passwd_verification = getpass.getpass(prompt='And one more time for verification: ')
if passwd != passwd_verification:
log(' * Passwords did not match * ', bg='black', fg='red')
continue
return passwd
def generic_select(options, input_text="Select one of the above by index or absolute value: ", sort=True):
"""
A generic select function that does not output anything

View File

@ -152,16 +152,11 @@ if archinstall.arguments['harddrive'].has_partitions():
else:
archinstall.arguments['harddrive'].keep_partitions = False
disk_password = archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')
archinstall.arguments['harddrive'].encryption_passwoed = disk_password
exit(0)
while (disk_password := getpass.getpass(prompt='Enter disk encryption password (leave blank for no encryption): ')):
disk_password_verification = getpass.getpass(prompt='And one more time for verification: ')
if disk_password != disk_password_verification:
archinstall.log(' * Passwords did not match * ', bg='black', fg='red')
continue
archinstall.storage['_guided']['disk_encryption'] = True
break
# Ask for a hostname
hostname = input('Desired hostname for the installation: ')
if len(hostname) == 0: