-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-gui.sh
105 lines (92 loc) · 2.42 KB
/
run-gui.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
function usage() {
echo "$0 [-d] (-r <propfile> | -m <masterip>) [-p port] target"
}
function genPropFile() {
file="$1"
master="$2"
port="$3"
echo "rainbow.master.location.host = $master" > $1
echo "rainbow.master.location.port = $port" >> $1
echo "rainbow.deployment.environment = linux" >> $1
echo "rainbow.deployment.factory.class = org.sa.rainbow.core.ports.eseb.ESEBRainbowPortFactory" >> $1
}
TARGET=znews-ss
DEBUG=""
PROP=""
master=""
port="1100"
HEADLESS=""
while getopts :dhr:m:p: opt; do
case $opt in
d)
DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044"
;;
r)
PROP="$OPTARG"
;;
m)
master="$OPTARG"
;;
p)
port="$OPTARG"
;;
h)
HEADLESS="y"
;;
esac
done
shift $((OPTIND-1))
if [[ "$#" == 1 ]]; then
TARGET=$1
else
echo "Warniing: target not passed as a parameter; using $TARGET as target"
fi
#Check if rainbow properties file exists
TARGET_DIR="targets/$TARGET"
if [ ! -d "$TARGET_DIR" ]; then
echo "Error: target directory ''$TARGET_DIR'' does not exist"
exit 1
fi
echo $DEBUG $PROP $master $port $TARGET
#Check to see if we should generate a properties file
if [ "$master" == "" ]; then
if [ "$PROP" == "" ]; then
echo "Error: -r or -m params required"
usage
exit 1;
fi
else
if [ "$PROP" == "" ]; then
PROP="rainbow-gui-generated.properties"
DELETE="true"
else
if [ -e "$TARGET_DIR/$PROP" ]; then
echo -n "$TARGET_DIR/$PROP exists. Overwrite? [y/N]"
read answer
if [ "$answer" != "y" ]; then
$master=""
fi
fi
fi
if [ "$master" != "" ]; then
genPropFile "$TARGET_DIR/$PROP" "$master" "$port"
fi
fi
if [ "$(uname)" == "Darwin" ]; then
delim=":"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
delim=":"
elif [ "$(expr substr $(uname -o) 1 6)" == "Cygwin" ]; then
delim=";"
fi
if [ "$HEADLESS" != "y" ]; then
echo "java -classpath .${delim}lib/* -Drainbow.target=$TARGET -Drainbow.propfile=$PROP $DEBUG org.sa.rainbow.gui.RainbowGUI"
java -classpath ".${delim}lib/*" -Drainbow.target=$TARGET -Drainbow.propfile=$PROP $DEBUG org.sa.rainbow.gui.RainbowGUI
else
echo "java -classpath .${delim}lib/* -Drainbow.target=$TARGET -Drainbow.propfile=$PROP $DEBUG org.sa.rainbow.gui.CommandLineUI"
java -classpath ".${delim}lib/*" -Drainbow.target=$TARGET -Drainbow.propfile=$PROP $DEBUG org.sa.rainbow.gui.CommandLineUI
fi
if [ "$DELETE" == "true" ]; then
rm -f "$TARGET_DIR/$PROP"
fi