summaryrefslogtreecommitdiffstats
path: root/src/testApp.sh
blob: 0ae691e66da983c1faf37b94cdbed708f4191706 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
# Script now simply passes all arguments to the fbgui call.
# Use: ./testApp.sh [OPTIONS] 
# OPTIONS:	
#               -h, --help                    prints help
#               -D <level>, --debug=<level>   sets debug level [0,1]
#               -u <url>,   --url=<url>       sets URL to load
#               -d <dir>,   --download=<dir>  sets download directory (absolute)
#               -c <path>,  --config=<path>   sets path to config file (absolute)
#               -t <path>,  --trigger=<path>  sets path to file triggering URL load
#               -s <path>,  --serial=<path>   sets path to serial number file
#
# Note: all path are expected to be absolute.
#
rm -rf /tmp/fbgui
script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
# to get the path only - not the script name - add
working_path=`dirname "$script_path"`
display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}')

# Start QT's virtual framebuffer with proper display_id
/usr/local/Trolltech/Qt-4.7.2/bin/qvfb -width 1024 -height 768 -qwsdisplay :$display_id &
sleep 0.2
# Start fbgui connecting to QVFb with display_id from above.
$working_path/fbgui -display QVFb:$display_id $@
# Check if fbbrowser is not running, if so kill the qvfb.
if [ $(ps aux | grep -v grep | grep -c fbgui) -eq 1 ]
then
	echo "fbgui is still running ..."
else
	echo "fbgui stopped running, killing qvfb ..."
	killall qvfb
fi