Skip to content

Commit bcff5d3

Browse files
committed
Adding its own prompt error
1 parent 627ea00 commit bcff5d3

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

defaults/initrd.d/00-crypt.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ _open_luks() {
5757
eval local luks_trim='"${CRYPT_'${ltype}'_TRIM}"'
5858
eval local init_key='"${CRYPT_'${ltype}'_INITKEY}"'
5959

60-
local dev_error=0 key_error=0 keydev_error=0
60+
local dev_error=0 key_error=0 initkey_error=0 keydev_error=0
6161
local mntkey="${KEY_MNT}/" cryptsetup_opts=""
6262

6363
local exit_st=0 luks_device=
@@ -94,6 +94,7 @@ _open_luks() {
9494
[ "${dev_error}" = "1" ] && any_error=1
9595
[ "${key_error}" = "1" ] && any_error=1
9696
[ "${keydev_error}" = "1" ] && any_error=1
97+
[ "${initkey_error}" = "1" ] && any_error=1
9798
if [ "${CRYPT_SILENT}" = "1" ] && [ -n "${any_error}" ]; then
9899
bad_msg "Failed to setup the LUKS device"
99100
exit_st=1
@@ -111,6 +112,12 @@ _open_luks() {
111112
key_error=0
112113
continue
113114
fi
115+
if [ "${initkey_error}" = "1" ]; then
116+
prompt_user "init_key" "${luks_dev_name} key"
117+
initkey_error=0
118+
continue
119+
fi
120+
114121

115122
if [ "${keydev_error}" = "1" ]; then
116123
prompt_user "luks_keydev" "${luks_dev_name} key device"
@@ -223,9 +230,9 @@ _open_luks() {
223230
# if we have a keyfile embedded in the initramfs
224231
if [ -n "${init_key}" ]; then
225232
if [ ! -e "${init_key}" ]; then
226-
bad_msg "{init_key} on initramfs not found."
227-
key_error=1
228-
continue
233+
bad_msg "{init_key} (${init_key}) on initramfs not found."
234+
initkey_error=1
235+
continue
229236
fi
230237
cryptsetup_opts="${cryptsetup_opts} -d ${init_key}"
231238
fi

0 commit comments

Comments
 (0)