[bootloader] Resume from outer swap partition

- These fixes are similar to the other swap-from-LUKS changes,
  and just needed to be applied to a different module.
This commit is contained in:
Gabriel Craciunescu 2020-03-18 17:21:20 +01:00 committed by Adriaan de Groot
parent 65a989d3cd
commit 47c167dc04

View File

@ -117,6 +117,7 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker
partitions = libcalamares.globalstorage.value("partitions") partitions = libcalamares.globalstorage.value("partitions")
swap_uuid = "" swap_uuid = ""
swap_outer_mappername = None
cryptdevice_params = [] cryptdevice_params = []
@ -124,18 +125,21 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker
# - unencrypted swap partition sets swap_uuid # - unencrypted swap partition sets swap_uuid
# - encrypted root sets cryptdevice_params # - encrypted root sets cryptdevice_params
for partition in partitions: for partition in partitions:
if partition["fs"] == "linuxswap" and not partition.get("claimed", None):
continue
has_luks = "luksMapperName" in partition has_luks = "luksMapperName" in partition
if partition["fs"] == "linuxswap" and not has_luks: if partition["fs"] == "linuxswap" and not has_luks:
swap_uuid = partition["uuid"] swap_uuid = partition["uuid"]
if (partition["fs"] == "linuxswap" and has_luks):
swap_outer_mappername = partition["luksMapperName"]
if partition["mountPoint"] == "/" and has_luks: if partition["mountPoint"] == "/" and has_luks:
cryptdevice_params = ["cryptdevice=UUID=" cryptdevice_params = ["cryptdevice=UUID="
+ partition["luksUuid"] + partition["luksUuid"]
+ ":" + ":"
+ partition["luksMapperName"], + partition["luksMapperName"],
"root=/dev/mapper/" "root=/dev/mapper/"
+ partition["luksMapperName"],
"resume=/dev/mapper/"
+ partition["luksMapperName"]] + partition["luksMapperName"]]
if cryptdevice_params: if cryptdevice_params:
@ -146,6 +150,10 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker
if swap_uuid: if swap_uuid:
kernel_params.append("resume=UUID={!s}".format(swap_uuid)) kernel_params.append("resume=UUID={!s}".format(swap_uuid))
if swap_outer_mappername:
kernel_params.append("resume=/dev/mapper/{!s}".format(
swap_outer_mappername))
kernel_line = get_kernel_line(kernel_type) kernel_line = get_kernel_line(kernel_type)
libcalamares.utils.debug("Configure: \"{!s}\"".format(kernel_line)) libcalamares.utils.debug("Configure: \"{!s}\"".format(kernel_line))