Marking the root partitions as encrypted if a disk password is set. In the future, we need to make this a bit more flexible by allowing multiple partitions to be encrypted. But for now, the main partition should be enough.

This commit is contained in:
Anton Hvornum 2021-03-09 10:41:57 +01:00
parent 16b0f4a4a4
commit 1f62a97c90
2 changed files with 9 additions and 0 deletions

View File

@ -352,6 +352,11 @@ class Filesystem():
b''.join(sys_command(f'sync'))
return True
def find_root_partition(self):
for partition in self.blockdevice:
if partition.target_mountpoint == '/' or partition.mountpoint == '/':
return partition
def raw_parted(self, string:str):
x = sys_command(f'/usr/bin/parted -s {string}')
o = b''.join(x)

View File

@ -276,6 +276,10 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT)
if archinstall.arguments['harddrive'].keep_partitions is False:
fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs'),
encrypt_root_partition=archinstall.arguments.get('!encryption-password', False))
# Otherwise, check if encryption is desired and mark the root partition as encrypted.
elif archinstall.arguments.get('!encryption-password', None):
root_partition = fs.find_root_partition()
root_partition.encrypted = True
# After the disk is ready, iterate the partitions and check
# which ones are safe to format, and format those.