-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_demo.sh
executable file
·75 lines (71 loc) · 1.51 KB
/
run_demo.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
vcan_exist=`lsmod |grep -ni vcan`
prog_run=0
PWD=$(pwd)
INSTALL_PATH=$PWD/build/exe/
if [ "$vcan_exist" != "" ]
then
echo "VCAN module already installed and loaded"
prog_run=1
else
modprobe vcan >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "vcan kernel module installed successfully"
prog_run=1
else
echo "couldn't install module, please check"
prog_run=2
fi
fi
echo "check if there's a valid vCan0 interface"
ifconfig vcan0 >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "interface vcan0 already exists"
prog_run=1
else
echo "creating a new interface vcan0 of type vcan"
ip link add dev vcan0 type vcan >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "vcan0 interface created successfully"
prog_run=1
else
echo "Cannot create new interface vcan0 of type vcan"
prog_run=2
fi
fi
echo "Checking VCan Network interface Status (Up or Down)"
if [ $prog_run -eq 1 ]
then
vcan_stat=`cat /sys/class/net/vcan0/operstate`
if [ "$vcan_stat" != "down" ]
then
echo "vcan interface already running"
prog_run=3
else
echo "setting up vcna0 interface"
ip link set up vcan0 >/dev/null 2>&1
if [ $? -eq 0 ]
then
prog_run=3
else
echo "couldn't set up vcan0 inf"
prog_run=2
fi
fi
fi
echo "If all checkings are OK, launch Main App"
if [ $prog_run -eq 3 ]
then
echo "Launching Main App"
echo "export needed DLL to be able to launch the Main App"
echo $PWD
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_PATH
$INSTALL_PATH/HelloWorld
exit #?
else
echo "couldn't launch Main App"
exit 1
fi