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 8/28/2008 # Modified for use with SmartCard script instead of USB key +# +# Updated by Timothy Pearson 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 "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 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