diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2022-05-28 13:51:31 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2022-05-28 13:51:31 -0700 |
commit | 144ba9a735ff65d65fc1d3dbd8902f5ecd5b7ba8 (patch) | |
tree | 73279e8a142eb94868f158ddb1544d77a76fb76b | |
parent | add keyctl support for loading LUKS passphrase into a keyring (diff) | |
parent | defaults/initrd.scripts: start_LUKS_*(): fix bootstrap calls and sleeps (diff) | |
download | genkernel-144ba9a735ff65d65fc1d3dbd8902f5ecd5b7ba8.tar.gz genkernel-144ba9a735ff65d65fc1d3dbd8902f5ecd5b7ba8.tar.bz2 genkernel-144ba9a735ff65d65fc1d3dbd8902f5ecd5b7ba8.zip |
Detached header: fix bootstrap calls and sleeps, remove extra bracket
Merges: https://github.com/gentoo/genkernel/pull/37
Closes: https://github.com/gentoo/genkernel/pull/37
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | defaults/initrd.scripts | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index eb556d6e..f8cc861d 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1848,7 +1848,7 @@ openLUKS() { good_msg "The LUKS device ${LUKS_DEVICE} meanwhile was opened by someone else." break # if crypt_silent=1 and some error occurs, enter shell quietly - elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 \) \) ] + elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( ${DEV_ERROR} -eq 1 \) \) ] then run_emergency_shell elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${HEADER_ERROR} -eq 1 \) \) -o \( ${HEADERDEV_ERROR} -eq 1 \) \) ] @@ -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" |