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
# 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

Loading…
Cancel
Save