summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-19 19:06:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-19 19:06:41 +0000
commit3016f6cc8d7e4412d6b65bc98cd42bc2ce40e52b (patch)
treec62c96403dd7305eaa7ed7ed3bf45a1eacf08187 /usr
parent80d75ceaa93ebc4ec7ee9935d2acb4f9cafd0a3b (diff)
downloadsmartcardauth-3016f6cc8d7e4412d6b65bc98cd42bc2ce40e52b.tar.gz
smartcardauth-3016f6cc8d7e4412d6b65bc98cd42bc2ce40e52b.zip
Added Plymouth support
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smartcardauth@1116551 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'usr')
-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 <kb9vqf@pearsoncomputing.net> 8/28/2008
# Modified for use with SmartCard script instead of USB key
+#
+# Updated by Timothy Pearson <kb9vqf@pearsoncomputing.net> 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