Added Plymouth support

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smartcardauth@1116551 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
parent 80d75ceaa9
commit 3016f6cc8d

@ -15,6 +15,9 @@
# #
# Update by Timothy Pearson <kb9vqf@pearsoncomputing.net> 8/28/2008 # Update by Timothy Pearson <kb9vqf@pearsoncomputing.net> 8/28/2008
# Modified for use with SmartCard script instead of USB key # 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) # define counter-intuitive shell logic values (based on /bin/true & /bin/false)
TRUE=0 TRUE=0
@ -28,6 +31,9 @@ if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TIMEOUT 180" || true /sbin/usplash_write "TIMEOUT 180" || true
fi fi
# Find plymouth
PLYDIR=/bin/plymouth
# print message to usplash or stderr # print message to usplash or stderr
# usage: msg <command> "message" [switch] # usage: msg <command> "message" [switch]
# command: TEXT | STATUS | SUCCESS | FAILURE | CLEAR (see 'man usplash_write' for all commands) # 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. # printed according to the usplash <command> definition.
# using the switch -n will allow echo to write multiple messages # using the switch -n will allow echo to write multiple messages
# to the same line # 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 () msg ()
{ {
if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then HAS_PLYMOUTH=0
usplash_write "TEXT-URGENT $@" 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 else
echo "$@" >&2 if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then
usplash_write "TEXT-URGENT $@"
else
echo "$@" >&2
fi
fi fi
return 0 return 0
} }
[ $DEBUG -eq $TRUE ] && msg "Executing crypto-usb-key.sh ..." [ $DEBUG -eq $TRUE ] && msg "Executing cryptosmartcard.sh ..."
# flag tracking key-file availability # flag tracking key-file availability
OPENED=$FALSE OPENED=$FALSE
@ -76,9 +103,14 @@ fi
if [ $OPENED -eq $FALSE ]; then if [ $OPENED -eq $FALSE ]; then
msg "SmartCard LUKS keyfile invalid or incorrect SmartCard inserted" msg "SmartCard LUKS keyfile invalid or incorrect SmartCard inserted"
msg "Try to enter the LUKS password: " if [ $HAS_PLYMOUTH -eq 1 ]; then
read -s -r A </dev/console plymouth ask-for-password --prompt="Please enter the LUKS password"
echo -n "$A" else
msg "Please enter the LUKS password: "
read -s -r A < /dev/console
echo -n "$A"
msg "Attempting to authenticate..."
fi
else else
msg "SmartCard authenticated and LUKS keyfile loaded" msg "SmartCard authenticated and LUKS keyfile loaded"
fi fi

Loading…
Cancel
Save