From a279eaf4fa2fbb7b87acd0d1243d63567295c6d5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 20 Oct 2016 16:00:15 +0100 Subject: [PATCH] dracut : unlock encrypted swap if exists (#267) * dracut : unlock encrypted swap if exists * only check for swap_outer_uuid if dracut exists --- src/modules/grubcfg/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index 24038c561..1cbc4a4cd 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -37,6 +37,7 @@ def modify_grub_default(partitions, root_mount_point, distributor): dracut_bin = libcalamares.utils.target_env_call(["sh", "-c", "which dracut"]) use_splash = "" swap_uuid = "" + swap_outer_uuid = "" if libcalamares.globalstorage.contains("hasPlymouth"): if libcalamares.globalstorage.value("hasPlymouth"): @@ -44,11 +45,14 @@ def modify_grub_default(partitions, root_mount_point, distributor): cryptdevice_params = [] - if dracut_bin == 0: + if dracut_bin == "0": for partition in partitions: if partition["fs"] == "linuxswap": swap_uuid = partition["uuid"] + if partition["fs"] == "linuxswap" and "luksMapperName" in partition: + swap_outer_uuid = partition["luksUuid"] + if partition["mountPoint"] == "/" and "luksMapperName" in partition: cryptdevice_params = ["rd.luks.uuid={!s}".format(partition["luksUuid"])] else: @@ -74,6 +78,9 @@ def modify_grub_default(partitions, root_mount_point, distributor): if swap_uuid: kernel_params.append("resume=UUID={!s}".format(swap_uuid)) + if dracut_bin == "0" and swap_outer_uuid: + kernel_params.append("rd.luks.uuid={!s}".format(swap_outer_uuid)) + distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace) if not os.path.exists(default_dir):