Skip to content

Commit 8916a10

Browse files
committed
Update luks-unlock.sh to work with current libraries
1 parent 33883e5 commit 8916a10

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

contrib/luks-unlock.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,23 @@
2929
## in a dracut.conf(5) file inside the directory specified for the option
3030
## `Global.DracutConfDir` in the ZFSBootMenu `config.yaml`.
3131

32-
# shellcheck disable=SC1091
33-
[ -f /lib/zfsbootmenu-lib.sh ] && source /lib/zfsbootmenu-lib.sh
32+
sources=(
33+
/lib/profiling-lib.sh
34+
/etc/zfsbootmenu.conf
35+
/lib/zfsbootmenu-core.sh
36+
/lib/kmsg-log-lib.sh
37+
/etc/profile
38+
)
39+
40+
for src in "${sources[@]}"; do
41+
# shellcheck disable=SC1090
42+
if ! source "${src}" > /dev/null 2>&1 ; then
43+
echo -e "\033[0;31mWARNING: ${src} was not sourced; unable to proceed\033[0m"
44+
exit 1
45+
fi
46+
done
47+
48+
unset src sources
3449

3550
luks="/dev/disk/by-partlabel/KEYSTORE"
3651
dm="/dev/mapper/KEYSTORE"
@@ -78,8 +93,10 @@ while true; do
7893

7994
# failed all password attempts
8095
if [ "${ret}" -eq 2 ] ; then
81-
if prompt="Continuing in %0.2d seconds" timed_prompt "[RETURN] continue unlock attempts" "[ESCAPE] emergency shell" "" ; then
82-
continue
96+
if timed_prompt -e "emergency shell" \
97+
-r "continue unlock attempts" \
98+
-p "Continuing in %0.2d seconds" ; then
99+
continue
83100
else
84101
emergency_shell "Unable to unlock LUKS partition"
85102
fi

0 commit comments

Comments
 (0)