[fstab] Fix unencrypted root check

There are more ways (than not having a keyfile) for the root
partition to be unencrypted. Check it based on the settings
in the partition data.
This commit is contained in:
abalfoort 2022-05-19 19:47:55 +02:00 committed by Adriaan de Groot
parent 61c67f8c22
commit 4e5078c950

View File

@ -162,8 +162,10 @@ class FstabGenerator(object):
crypttab_options = self.crypttab_options
# Set crypttab password for partition to none and remove crypttab options
# if crypto_keyfile.bin was not generated
if not os.path.exists(os.path.join(self.root_mount_point, "crypto_keyfile.bin")):
# if root partition was not encrypted
if any([p["mountPoint"] == "/"
and "luksMapperName" not in p
for p in self.partitions]):
password = "none"
crypttab_options = ""
# on root partition when /boot is unencrypted
@ -173,7 +175,6 @@ class FstabGenerator(object):
for p in self.partitions]):
password = "none"
crypttab_options = ""
return dict(
name=mapper_name,