forked from AndreyLevchenko/test-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maven-with-vnc.sh
55 lines (40 loc) · 1.11 KB
/
maven-with-vnc.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
#!/bin/bash -x
OPTS="$*"
vncdisplay=""
killvnc() {
if ! test -z "${vncdisplay}"; then
echo stopping vncserver on $DISPLAY
vncserver -kill $vncdisplay 2>&1
fi
}
displayEnv() {
echo "---------------------------------------------"
echo "Displaying Environment Variables"
echo "---------------------------------------------"
env
echo "---------------------------------------------"
}
echo starting vncserver
vncdisplay=$(vncserver -geometry 1600x1200 2>&1 | tee vnc.log | perl -ne '/^New .* desktop is (.*)$/ && print"$1\n"')
sleep 1
if [ -z "$vncdisplay" ]; then
echo "failed to create a vncserver or get its display identifier"
exit 2
fi
export DISPLAY=$vncdisplay
echo vncserver started on ${DISPLAY}, resolution 1600x1200
displayEnv
# Move the mouse pointer out of the way
# echo Moving mouse pointer to 10 10.
# xwarppointer abspos 10 10
#Make sure the VNC server is killed always. Why wont you just die!
trap killvnc INT TERM EXIT
if [ -f "${M2_HOME}/bin/mvn" ]; then
MVN=${M2_HOME}/bin/mvn
else
MVN=mvn
fi
echo Starting $MVN $OPTS
$MVN $OPTS
MVN_STATUS=$?
exit $MVN_STATUS