Add openswap hook handling to initcpiocfg.

This commit is contained in:
Teo Mrnjavac 2016-05-13 16:09:35 +02:00
parent 44b75220af
commit b6b930dce8

View File

@ -93,6 +93,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
modules = [] modules = []
files = [] files = []
encrypt_hook = False encrypt_hook = False
openswap_hook = False
# It is important that the plymouth hook comes before any encrypt hook # It is important that the plymouth hook comes before any encrypt hook
plymouth_bin = os.path.join(root_mount_point, "usr/bin/plymouth") plymouth_bin = os.path.join(root_mount_point, "usr/bin/plymouth")
@ -102,6 +103,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
for partition in partitions: for partition in partitions:
if partition["fs"] == "linuxswap": if partition["fs"] == "linuxswap":
swap_uuid = partition["uuid"] swap_uuid = partition["uuid"]
if "luksMapperName" in partition:
openswap_hook = True
if partition["fs"] == "btrfs": if partition["fs"] == "btrfs":
btrfs = "yes" btrfs = "yes"
@ -115,6 +118,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
files.append("/crypto_keyfile.bin") files.append("/crypto_keyfile.bin")
if swap_uuid is not "": if swap_uuid is not "":
if encrypt_hook and openswap_hook:
hooks.extend(["openswap"])
hooks.extend(["resume", "filesystems"]) hooks.extend(["resume", "filesystems"])
else: else:
hooks.extend(["filesystems"]) hooks.extend(["filesystems"])