Use constructor instead of a loop

This commit is contained in:
Chrysostomus 2020-11-05 01:01:26 +02:00
parent 26b1c349d3
commit 741c1c5d1e
2 changed files with 4 additions and 9 deletions

View File

@ -91,11 +91,8 @@ def modify_grub_default(partitions, root_mount_point, distributor):
swap_outer_mappername = None swap_outer_mappername = None
no_save_default = False no_save_default = False
unencrypted_separate_boot = False unencrypted_separate_boot = False
if any(partition["mountPoint"] == "/boot" and "luksMapperName" not in partition for partition in partitions):
for partition in partitions: unencrypted_separate_boot = True
if (partition["mountPoint"] == "/boot"
and "luksMapperName" not in partition):
unencrypted_separate_boot = True
for partition in partitions: for partition in partitions:
if partition["mountPoint"] in ("/", "/boot") and partition["fs"] in ("btrfs", "f2fs"): if partition["mountPoint"] in ("/", "/boot") and partition["fs"] in ("btrfs", "f2fs"):

View File

@ -21,10 +21,6 @@ _ = gettext.translation("calamares-python",
fallback=True).gettext fallback=True).gettext
for partition in partitions:
if (partition["mountPoint"] == "/boot"
and "luksMapperName" not in partition):
unencrypted_separate_boot = True
def pretty_name(): def pretty_name():
return _("Configuring OpenRC dmcrypt service.") return _("Configuring OpenRC dmcrypt service.")
@ -34,6 +30,8 @@ def write_dmcrypt_conf(partitions, root_mount_point, dmcrypt_conf_path):
crypto_target = "" crypto_target = ""
crypto_source = "" crypto_source = ""
unencrypted_separate_boot = False unencrypted_separate_boot = False
if any(partition["mountPoint"] == "/boot" and "luksMapperName" not in partition for partition in partitions):
unencrypted_separate_boot = True
for partition in partitions: for partition in partitions:
has_luks = "luksMapperName" in partition has_luks = "luksMapperName" in partition