summaryrefslogtreecommitdiffstats
path: root/usr/bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr/bin')
-rwxr-xr-xusr/bin/cryptosmartcard.sh46
1 files changed, 39 insertions, 7 deletions
diff --git a/usr/bin/cryptosmartcard.sh b/usr/bin/cryptosmartcard.sh
index d885248..9d03f2c 100755
--- a/usr/bin/cryptosmartcard.sh
+++ b/usr/bin/cryptosmartcard.sh
@@ -15,6 +15,9 @@
#
# Update by Timothy Pearson <[email protected]> 8/28/2008
# Modified for use with SmartCard script instead of USB key
+#
+# Updated by Timothy Pearson <[email protected]> 4/19/2010
+# Added Plymouth detection and support
# define counter-intuitive shell logic values (based on /bin/true & /bin/false)
TRUE=0
@@ -28,6 +31,9 @@ if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TIMEOUT 180" || true
fi
+# Find plymouth
+PLYDIR=/bin/plymouth
+
# print message to usplash or stderr
# usage: msg <command> "message" [switch]
# command: TEXT | STATUS | SUCCESS | FAILURE | CLEAR (see 'man usplash_write' for all commands)
@@ -36,17 +42,38 @@ fi
# printed according to the usplash <command> definition.
# using the switch -n will allow echo to write multiple messages
# to the same line
+# msg ()
+# {
+# if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then
+# usplash_write "TEXT-URGENT $@"
+# else
+# echo "$@" >&2
+# fi
+# return 0
+# }
+
msg ()
{
- if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then
- usplash_write "TEXT-URGENT $@"
+ HAS_PLYMOUTH=0
+ if [ -e $PLYDIR ]; then
+ plymouth --ping
+ if [ $? -eq 0 ]; then
+ HAS_PLYMOUTH=1
+ fi
+ fi
+ if [ $HAS_PLYMOUTH -eq 1 ]; then
+ plymouth message --text="$@"
else
- echo "$@" >&2
+ if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then
+ usplash_write "TEXT-URGENT $@"
+ else
+ echo "$@" >&2
+ fi
fi
return 0
}
-[ $DEBUG -eq $TRUE ] && msg "Executing crypto-usb-key.sh ..."
+[ $DEBUG -eq $TRUE ] && msg "Executing cryptosmartcard.sh ..."
# flag tracking key-file availability
OPENED=$FALSE
@@ -76,9 +103,14 @@ fi
if [ $OPENED -eq $FALSE ]; then
msg "SmartCard LUKS keyfile invalid or incorrect SmartCard inserted"
- msg "Try to enter the LUKS password: "
- read -s -r A </dev/console
- echo -n "$A"
+ if [ $HAS_PLYMOUTH -eq 1 ]; then
+ plymouth ask-for-password --prompt="Please enter the LUKS password"
+ else
+ msg "Please enter the LUKS password: "
+ read -s -r A < /dev/console
+ echo -n "$A"
+ msg "Attempting to authenticate..."
+ fi
else
msg "SmartCard authenticated and LUKS keyfile loaded"
fi