git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smartcardauth@1254814 283d02a7-25f6-0310-bc7c-ecb5cbfe19dav3.5.13-sru
parent
08211e05a2
commit
214716561b
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /tmp/smartauthmon/
|
||||
ls /var/run/xdmctl > /tmp/smartauthmon/originalxdm
|
||||
|
||||
# Set loop separator to end of line
|
||||
BAKIFS=$IFS
|
||||
IFS=$(echo -en "\n\b")
|
||||
exec 3<&0
|
||||
exec 0</tmp/smartauthmon/originalxdm
|
||||
newdisplayfound=0
|
||||
newdisplay=-1
|
||||
while read -r line
|
||||
do
|
||||
# use $line variable to process lines
|
||||
line=$(echo $line | grep 'xdmctl-:' | sed -e 's/xdmctl-://')
|
||||
if [ "`expr $line - $line 2>/dev/null`" == "0" ]; then
|
||||
echo "Found active display on $line"
|
||||
if [[ $newdisplayfound -eq 0 ]]; then
|
||||
tempnewdisplay=$((newdisplay + 1))
|
||||
if [[ $line -eq $tempnewdisplay ]]; then
|
||||
echo "Sequential display $line found after display $newdisplay..."
|
||||
newdisplay=$line
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exec 0<&3
|
||||
newdisplay=$(($newdisplay + 1))
|
||||
rm -rf /tmp/smartauthmon/
|
Loading…
Reference in new issue