From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 07BF3158090 for ; Sat, 28 May 2022 20:52:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0308CE08A0; Sat, 28 May 2022 20:52:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DE821E08A0 for ; Sat, 28 May 2022 20:52:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 106E03413AE for ; Sat, 28 May 2022 20:52:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B9A0D3C3 for ; Sat, 28 May 2022 20:52:28 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1653458561.c3249d243fcf6dc56f46e2442df6751db91a4606.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.scripts X-VCS-Directories: defaults/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: c3249d243fcf6dc56f46e2442df6751db91a4606 X-VCS-Branch: master Date: Sat, 28 May 2022 20:52:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: aee87c59-d115-4d5c-a0fe-e26ff0c23897 X-Archives-Hash: 8629fae40827f9b1c2c8a720ff314ccf commit: c3249d243fcf6dc56f46e2442df6751db91a4606 Author: Dmitry Baranov gmail com> AuthorDate: Tue May 24 23:38:22 2022 +0000 Commit: Robin H. Johnson gentoo 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 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"