commit: c3249d243fcf6dc56f46e2442df6751db91a4606
Author: Dmitry Baranov <reagentoo <AT> gmail <DOT> com>
AuthorDate: Tue May 24 23:38:22 2022 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed May 25 06:02:41 2022 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c3249d24
defaults/initrd.scripts: start_LUKS_*(): fix bootstrap calls and sleeps
Signed-off-by: Dmitry Baranov <reagentoo <AT> gmail.com>
defaults/initrd.scripts | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 7012356..f8cc861 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -2486,18 +2486,23 @@ ipv6_tentative() {
}
start_LUKS_root() {
- # if key is set but neither ssh enabled or key device is given, find
- # the key device
+ # if key/header is set but neither ssh enabled or key device is given,
find
+ # the key/header device
- if [ -n "${CRYPT_ROOT_KEY}" ]
+ if (
+ [ -n "${CRYPT_ROOT_KEY}" -a -z "${CRYPT_ROOT_KEYDEV}" ] ||
+ [ -n "${CRYPT_ROOT_HEADER}" -a -z "${CRYPT_ROOT_HEADERDEV}" ]
+ )
then
- ( [ -z "${CRYPT_ROOT_KEYDEV}" ] || [ -z
"${CRYPT_ROOT_HEADERDEV}" ] ) \
- && sleep 6
-
- [ -z "${CRYPT_ROOT_KEYDEV}" ] && bootstrapKey "ROOT"
- [ -z "${CRYPT_ROOT_HEADERDEV}" ] && bootstrapHeader "ROOT"
+ sleep 6
fi
+ [ -n "${CRYPT_ROOT_KEY}" -a -z "${CRYPT_ROOT_KEYDEV}" ] \
+ && bootstrapKey "ROOT"
+
+ [ -n "${CRYPT_ROOT_HEADER}" -a -z "${CRYPT_ROOT_HEADERDEV}" ] \
+ && bootstrapHeader "ROOT"
+
if [ -n "${CRYPT_ROOT}" ]
then
openLUKS "root"
@@ -2512,16 +2517,22 @@ start_LUKS_root() {
}
start_LUKS_swap() {
- if [ -n "${CRYPT_SWAP_KEY}" ]
- then
- # same for swap, but no need to sleep if root was unencrypted
- ( [ -z "${CRYPT_ROOT_KEYDEV}" ] || [ -z
"${CRYPT_ROOT_HEADERDEV}" ] ) \
- && [ -z "${CRYPT_ROOT}" ] && sleep 6
+ # same for swap, but no need to sleep if root was unencrypted
- [ -z "${CRYPT_SWAP_KEYDEV}" ] && bootstrapKey "SWAP"
- [ -z "${CRYPT_SWAP_HEADERDEV}" ] && bootstrapHeader "SWAP"
+ if (
+ [ -n "${CRYPT_SWAP_KEY}" -a -z "${CRYPT_SWAP_KEYDEV}" ] ||
+ [ -n "${CRYPT_SWAP_HEADER}" -a -z "${CRYPT_SWAP_HEADERDEV}" ]
+ )
+ then
+ [ -z "${CRYPT_ROOT}" ] && sleep 6
fi
+ [ -n "${CRYPT_SWAP_KEY}" -a -z "${CRYPT_SWAP_KEYDEV}" ] \
+ && bootstrapKey "SWAP"
+
+ [ -n "${CRYPT_SWAP_HEADER}" -a -z "${CRYPT_SWAP_HEADERDEV}" ] \
+ && bootstrapHeader "SWAP"
+
if [ -n "${CRYPT_SWAP}" ]
then
openLUKS "swap"