summaryrefslogtreecommitdiffstats
path: root/testApp.sh
blob: fe9e7e62266d824a0e7831732dac434eb93e05a5 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/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
#               -c <path>,  --config=<path>   sets path to config file 
#               -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.
# Adapt these to your own system.
QT_VERSION=Qt-4.8.2
PATH_TO_FBGUI_BUILD=~/fbgui/build
#PATH_TO_FBGUI_BUILD=~/workspace/fbgui

# check if network discovery is activated and if running as root
for ARG in $*
do
if [ "x$ARG" = "x-n" ]; then
  if [ $(whoami) != "root" ]; then
    echo "Network Discovery activated, you need to be root."
    exit 1;
  fi
fi
done

# clean /tmp/fbgui
[ -d /tmp/fbgui ] && rm -rf /tmp/fbgui
[ -f /tmp/fbgui.log ] && rm /tmp/fbgui.log
[ -f /tmp/fbgui_trigger ] && rm /tmp/fbgui_trigger


# construct unique display_id based on user, needed for multi-user qvfb usage
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_VERSION/bin/qvfb -width 1156 -height 800 -qwsdisplay :$display_id &
# quick sleep to wait for qvfb loading
sleep 0.2
# Start fbgui connecting to QVFb with display_id from above.
$PATH_TO_FBGUI_BUILD/src/fbgui/fbgui -display QVFb:$display_id $@ -e $PATH_TO_FBGUI_BUILD/src/customdhcpcd/cdhcpcd
# kill qvfb since fbgui stopped
killall qvfb