-
Notifications
You must be signed in to change notification settings - Fork 9
/
zap-webswing.sh
executable file
·67 lines (62 loc) · 1.84 KB
/
zap-webswing.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
#!/bin/sh
#
# Startup script for the Webswing
#
# Customised for ZAP running in Docker - just call with no parameters for webswing to start and leave
# the docker container running
#
# Set environment.
export HOME=/zap/webswing
export OPTS="-h 0.0.0.0 -j $HOME/jetty.properties -c $HOME/webswing.config"
export JAVA_OPTS="-Xmx128M"
export LOG=$HOME/webswing.out
export PID_PATH_NAME=$HOME/webswing.pid
if [ -z `command -v $0` ]; then
CURRENTDIR=`pwd`
cd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`/
cd $CURRENTDIR
else
SCRIPTPATH=""
fi
if [ ! -f $HOME/webswing-server.war ]; then
echo "Webswing executable not found in $HOME folder"
exit 1
fi
if [ ! -f $JAVA_HOME/bin/java ]; then
echo "Java installation not found in $JAVA_HOME folder"
exit 1
fi
if [ -z `command -v xvfb-run` ]; then
echo "Unable to locate xvfb-run command. Please install Xvfb before starting Webswing."
exit 1
fi
if [ ! -z `command -v ldconfig` ]; then
if [ `ldconfig -p | grep -i libXext | wc -l` -lt 1 ]; then
echo "Missing dependent library libXext."
exit 1
fi
if [ `ldconfig -p | grep -i libxi | wc -l` -lt 1 ]; then
echo "Missing dependent library libXi."
exit 1
fi
if [ `ldconfig -p | grep -i libxtst | wc -l` -lt 1 ]; then
echo "Missing dependent library libXtst"
exit 1
fi
if [ `ldconfig -p | grep -i libxrender | wc -l` -lt 1 ]; then
echo "Missing dependent library libXrender."
exit 1
fi
fi
# See how we were called - customised for ZAP running in Docker
case "$1" in
run)
# Run Webswing server- expects X Server to be running
# dont put into the background otherwise docker will exit
$JAVA_HOME/bin/java $JAVA_OPTS -jar $HOME/webswing-server.war $OPTS 2>> $LOG >> $LOG
;;
*)
xvfb-run $SCRIPTPATH$0 run
esac
exit 0