summaryrefslogtreecommitdiff
path: root/app-admin/calamares/files/calamares-2.4.2-grubcfg-luks-unlock.patch
blob: 077b3959108d17b1830727bbcf329737bd334439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
diff -Nur a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py
--- a/src/modules/grubcfg/main.py	2016-10-14 15:11:26.000000000 +0100
+++ b/src/modules/grubcfg/main.py	2016-10-20 16:57:05.788610597 +0100
@@ -36,8 +36,11 @@
     default_grub = os.path.join(default_dir, "grub")
     distributor_replace = distributor.replace("'", "'\\''")
     plymouth_bin = libcalamares.utils.target_env_call(["sh", "-c", "which plymouth"])
+    dracut_bin = libcalamares.utils.target_env_call(["sh", "-c", "which dracut"])
     use_splash = ""
     swap_uuid = ""
+    swap_outer_uuid = ""
+    home_outer_uuid = ""
 
     libcalamares.utils.debug("which plymouth exit code: {!s}".format(plymouth_bin))
 
@@ -46,28 +49,49 @@
 
     cryptdevice_params = []
 
-    for partition in partitions:
-        if partition["fs"] == "linuxswap":
-            swap_uuid = partition["uuid"]
-
-        if partition["mountPoint"] == "/" and "luksMapperName" in partition:
-            cryptdevice_params = [
-                "cryptdevice=UUID={!s}:{!s}".format(partition["luksUuid"],
-                                                    partition["luksMapperName"]),
-                "root=/dev/mapper/{!s}".format(partition["luksMapperName"])
-            ]
+    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"] == "/home" and "luksMapperName" in partition:
+                home_outer_uuid = partition["luksUuid"]
+
+            if partition["mountPoint"] == "/" and "luksMapperName" in partition:
+                cryptdevice_params = ["rd.luks.uuid={!s}".format(partition["luksUuid"])]
+
+    else:
+        for partition in partitions:
+            if partition["fs"] == "linuxswap":
+                swap_uuid = partition["uuid"]
+
+            if partition["mountPoint"] == "/" and "luksMapperName" in partition:
+                cryptdevice_params = [
+                    "cryptdevice=UUID={!s}:{!s}".format(partition["luksUuid"],
+                                                        partition["luksMapperName"]),
+                    "root=/dev/mapper/{!s}".format(partition["luksMapperName"])
+                ]
 
     kernel_params = ["quiet"]
 
     if cryptdevice_params:
         kernel_params.extend(cryptdevice_params)
 
-    if use_splash:
-        kernel_params.append(use_splash)
-
     if swap_uuid:
         kernel_params.append("resume=UUID={!s}".format(swap_uuid))
 
+    if swap_outer_uuid:
+        kernel_params.append("rd.luks.uuid={!s}".format(swap_outer_uuid))
+
+    if home_outer_uuid:
+        kernel_params.append("rd.luks.uuid={!s}".format(home_outer_uuid))
+
+    if use_splash:
+        kernel_params.append(use_splash)
+
     distributor_line = "GRUB_DISTRIBUTOR=\"{!s}\"".format(distributor_replace)
 
     if not os.path.exists(default_dir):