Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/
Date: Sat, 28 May 2022 20:52:33
Message-Id: 1653458561.c3249d243fcf6dc56f46e2442df6751db91a4606.robbat2@gentoo
1 commit: c3249d243fcf6dc56f46e2442df6751db91a4606
2 Author: Dmitry Baranov <reagentoo <AT> gmail <DOT> com>
3 AuthorDate: Tue May 24 23:38:22 2022 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Wed May 25 06:02:41 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c3249d24
7
8 defaults/initrd.scripts: start_LUKS_*(): fix bootstrap calls and sleeps
9
10 Signed-off-by: Dmitry Baranov <reagentoo <AT> gmail.com>
11
12 defaults/initrd.scripts | 41 ++++++++++++++++++++++++++---------------
13 1 file changed, 26 insertions(+), 15 deletions(-)
14
15 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
16 index 7012356..f8cc861 100644
17 --- a/defaults/initrd.scripts
18 +++ b/defaults/initrd.scripts
19 @@ -2486,18 +2486,23 @@ ipv6_tentative() {
20 }
21
22 start_LUKS_root() {
23 - # if key is set but neither ssh enabled or key device is given, find
24 - # the key device
25 + # if key/header is set but neither ssh enabled or key device is given, find
26 + # the key/header device
27
28 - if [ -n "${CRYPT_ROOT_KEY}" ]
29 + if (
30 + [ -n "${CRYPT_ROOT_KEY}" -a -z "${CRYPT_ROOT_KEYDEV}" ] ||
31 + [ -n "${CRYPT_ROOT_HEADER}" -a -z "${CRYPT_ROOT_HEADERDEV}" ]
32 + )
33 then
34 - ( [ -z "${CRYPT_ROOT_KEYDEV}" ] || [ -z "${CRYPT_ROOT_HEADERDEV}" ] ) \
35 - && sleep 6
36 -
37 - [ -z "${CRYPT_ROOT_KEYDEV}" ] && bootstrapKey "ROOT"
38 - [ -z "${CRYPT_ROOT_HEADERDEV}" ] && bootstrapHeader "ROOT"
39 + sleep 6
40 fi
41
42 + [ -n "${CRYPT_ROOT_KEY}" -a -z "${CRYPT_ROOT_KEYDEV}" ] \
43 + && bootstrapKey "ROOT"
44 +
45 + [ -n "${CRYPT_ROOT_HEADER}" -a -z "${CRYPT_ROOT_HEADERDEV}" ] \
46 + && bootstrapHeader "ROOT"
47 +
48 if [ -n "${CRYPT_ROOT}" ]
49 then
50 openLUKS "root"
51 @@ -2512,16 +2517,22 @@ start_LUKS_root() {
52 }
53
54 start_LUKS_swap() {
55 - if [ -n "${CRYPT_SWAP_KEY}" ]
56 - then
57 - # same for swap, but no need to sleep if root was unencrypted
58 - ( [ -z "${CRYPT_ROOT_KEYDEV}" ] || [ -z "${CRYPT_ROOT_HEADERDEV}" ] ) \
59 - && [ -z "${CRYPT_ROOT}" ] && sleep 6
60 + # same for swap, but no need to sleep if root was unencrypted
61
62 - [ -z "${CRYPT_SWAP_KEYDEV}" ] && bootstrapKey "SWAP"
63 - [ -z "${CRYPT_SWAP_HEADERDEV}" ] && bootstrapHeader "SWAP"
64 + if (
65 + [ -n "${CRYPT_SWAP_KEY}" -a -z "${CRYPT_SWAP_KEYDEV}" ] ||
66 + [ -n "${CRYPT_SWAP_HEADER}" -a -z "${CRYPT_SWAP_HEADERDEV}" ]
67 + )
68 + then
69 + [ -z "${CRYPT_ROOT}" ] && sleep 6
70 fi
71
72 + [ -n "${CRYPT_SWAP_KEY}" -a -z "${CRYPT_SWAP_KEYDEV}" ] \
73 + && bootstrapKey "SWAP"
74 +
75 + [ -n "${CRYPT_SWAP_HEADER}" -a -z "${CRYPT_SWAP_HEADERDEV}" ] \
76 + && bootstrapHeader "SWAP"
77 +
78 if [ -n "${CRYPT_SWAP}" ]
79 then
80 openLUKS "swap"