Bug#754166: Plymouth support for LUKS password prompt
Source: live-boot
Severity: wishlist
Tags: patch
The attached patch against the debian-next branch implements plymouth
support for the LUKS password prompt.
Gaudenz
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (800, 'testing'), (700, 'unstable'), (50, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_CH.utf8, LC_CTYPE=de_CH.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From 569f3e1ac944685cdc5696b17c800d724768b17c Mon Sep 17 00:00:00 2001
From: Gaudenz Steinlin <gaudenz@debian.org>
Date: Tue, 8 Jul 2014 09:48:14 +0200
Subject: [PATCH] Plymouth support for LUKS password prompt
---
components/9990-misc-helpers.sh | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh
index 2bf2db1..4c6c313 100755
--- a/components/9990-misc-helpers.sh
+++ b/components/9990-misc-helpers.sh
@@ -803,9 +803,22 @@ open_luks_device ()
load_keymap
+ # check for plymouth
+ [ -x /bin/plymouth ] && plymouth --ping && plymouth="y"
+
+ if [ "${plymouth}" == "y" ]
+ then
+ cryptkeyscript="plymouth ask-for-password --prompt"
+ # Plymouth will add a : if it is a non-graphical prompt
+ cryptkeyprompt="Please unlock disk ${dev}"
+ else
+ cryptkeyscript="/lib/cryptsetup/askpass"
+ cryptkeyprompt="Please unlock disk ${dev}: "
+ fi
+
while true
do
- /lib/cryptsetup/askpass "Enter passphrase for ${dev}: " | \
+ $cryptkeyscript "$cryptkeyprompt" | \
/sbin/cryptsetup -T 1 luksOpen ${dev} ${name} ${opts}
if [ 0 -eq ${?} ]
@@ -816,11 +829,19 @@ open_luks_device ()
fi
echo >&6
- echo -n "There was an error decrypting ${dev} ... Retry? [Y/n] " >&6
- read answer
+ retryprompt="There was an error decrypting ${dev} ... Retry? [Y/n]"
+ if [ "${plymouth}" == "y" ]
+ then
+ plymouth display-message --text "${retryprompt}"
+ answer=$(plymouth watch-keystroke --keys="YNyn")
+ else
+ echo -n "${retryprompt} " >&6
+ read answer
+ fi
if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ]
then
+ [ "${plymouth}" == "y" ] && plymouth display-message --text ""
return 2
fi
done
--
2.0.0
Reply to: