aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Baranov <reagentoo@gmail.com>2022-05-25 02:38:22 +0300
committerDmitry Baranov <reagentoo@gmail.com>2022-05-25 09:02:41 +0300
commitc3249d243fcf6dc56f46e2442df6751db91a4606 (patch)
tree73279e8a142eb94868f158ddb1544d77a76fb76b /defaults
parentdefaults/initrd.scripts: openLUKS(): remove extra bracket in conditional block (diff)
downloadgenkernel-c3249d243fcf6dc56f46e2442df6751db91a4606.tar.gz
genkernel-c3249d243fcf6dc56f46e2442df6751db91a4606.tar.bz2
genkernel-c3249d243fcf6dc56f46e2442df6751db91a4606.zip
defaults/initrd.scripts: start_LUKS_*(): fix bootstrap calls and sleeps
Signed-off-by: Dmitry Baranov <reagentoo@gmail.com>
Diffstat (limited to 'defaults')
-rw-r--r--defaults/initrd.scripts41
1 files changed, 26 insertions, 15 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 7012356b..f8cc861d 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"