-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·263 lines (229 loc) · 10.1 KB
/
install
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/bin/bash
##########################################################################################################
# POP-Java installation script
# Date : 06/22/2010
# Author : Clement Valentin
# Updates (please write any modifications to this file in the following lines)
# Date Author Description
# 06/29/2010 clementval Modifying Java detection and adding rights when installing in default directory
##########################################################################################################
#POP-Java installation script
PREFIX="[POP-Java installation]:"
####################################################
# STEP 1 : Detecting Java executable
####################################################
echo "$PREFIX Detecting java executable ..."
JAVA_PROGRAM=$(which java)
if [ $JAVA_PROGRAM ]
then
echo "$PREFIX Java executable detected under $JAVA_PROGRAM"
else
echo "Java executable not found. If you have Java installed please give the path of java executable ..."
read JAVA_PROGRAM
if [ JAVA_PROGRAM ]
then
"Java executable under $JAVA_PROGRAM"
else
exit
fi
fi
####################################################
# STEP 2 : Get POP-Java installation directory
####################################################
if [ -z "$POPJAVA_LOCATION" ]; then
POPJAVA_LOCATION=/usr/local/popj
fi
#Installation directory
echo "$PREFIX Please enter the location of your desired POP-Java installation (default: $POPJAVA_LOCATION ) : "
read LOCATION
#Setting the default directory if no directory entered by the user
#Removing the last / if the user enter a specific directory
if [ "$LOCATION" == "" ]
then
LOCATION=$POPJAVA_LOCATION
else
LOCATION=${LOCATION%/}
fi
####################################################
# STEP 3 : Get user confirmation
####################################################
#Confirmation
CONFIRM=""
while [ "$CONFIRM" != "y" ] || [ "$CONFIRM" != "n" ]
do
echo "$PREFIX Installing POP-Java under $LOCATION ? (y/n)"
read CONFIRM
if [ "$CONFIRM" == "y" -o "$CONFIRM" == "n" ]
then
break
fi
done
if [ "$CONFIRM" == "n" ]
then
echo "$PREFIX Installation aborted by user"
exit
fi
####################################################
# STEP 4 : Check POP-C++ installation
####################################################
#check the popc installation
if [ "$POPC_LOCATION" == "" ]
then
POPC="/usr/local/popc"
if [ ! -d $POPC ]
then
echo "$PREFIX Installation cannot find the POP-C++ installation directry. You need POP-C++ installed to use POP-Java"
echo "$PREFIX If you have POP-C++ installed, please give your POP-C++ installation directory : "
read POPC
POPC=${POPC%/}
if [ ! -d $POPC ]
then
echo "$PREFIX Your POP-C++ installation directory does not exist. Installation aborted"
exit
fi
fi
else
POPC=$POPC_LOCATION
fi
####################################################
# STEP 5 : Copying files
####################################################
rm -rf $LOCATION
mkdir -p $LOCATION
if [ -w $LOCATION ]
then
#copying files
echo "$PREFIX Copying files ..."
cp -r -p release/* $LOCATION
chown -R root:root $LOCATION
chmod +x $LOCATION/testsuite/popc-obj/integer/*.obj
chmod +x $LOCATION/testsuite/popc-obj/jinteger/*.obj
####################################################
# STEP 6 : Generating XML files
####################################################
echo "$PREFIX Generating configuration files ..."
CONFIG_FILE=$LOCATION/etc/popj_config.xml
#generating config files
echo "<!-- POP-Java configuration file generated by the installation script. This file should not be modified after the installation of POP-Java on your computer -->" > $CONFIG_FILE
echo "<POPJConfig>" >> $CONFIG_FILE
echo "<item name='popj_location'>$LOCATION</item>" >> $CONFIG_FILE
echo "<item name='popj_plugin_location'>$LOCATION/plugin</item>" >> $CONFIG_FILE
echo "<item name='popc_appcoreservice_location'>$POPC/services/appservice</item>" >> $CONFIG_FILE
echo "<item name='popj_broker_command'>$JAVA_PROGRAM -javaagent:$LOCATION/JarFile/testsuite.jar -cp %s popjava.broker.Broker -codelocation=</item>" >> $CONFIG_FILE
echo "</POPJConfig>" >> $CONFIG_FILE
#genrating object map file for test suite
#generating platform name for object map
HARDWARE=$(uname -m)
OS=$(uname)
#PLATFORM="$HARDWARE-pc-$OS"
PLATFORM="*-*"
OBJECT_MAP=$LOCATION/etc/defaultobjectmap.xml
echo "$PREFIX Generating object map file for the test suite"
echo "<!-- POP-Java test suite object map generated by the installation script. This file sould not be modified -->" > $OBJECT_MAP
echo "<CodeInfoList>" >> $OBJECT_MAP
#Object map for POPC object test
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>Integer</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile>$LOCATION/testsuite/popc-obj/integer/integer.obj</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>$PLATFORM</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>Integer2</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile>$LOCATION/testsuite/popc-obj/jinteger/integer.obj</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>$PLATFORM</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.jinteger.Jinteger</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
#
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.barrier.Barrier</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.demo.Demopop</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.popjavatest.POPJParclass</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.barrier.Worker</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.jobmgr.ParClass</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.arg.MyPOPObject</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.callback.Titi</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.callback.Toto</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.integer.Integer</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.multiobj.MyObj1</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.multiobj.MyObj2</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.multiobj.MyObj3</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.multiobj.MyObj4</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.method.MethodObj</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "<CodeInfo>" >> $OBJECT_MAP
echo "<ObjectName>testsuite.od.ParObj</ObjectName>" >> $OBJECT_MAP
echo "<CodeFile Type='popjava'>$LOCATION/JarFile/testsuite.jar</CodeFile>" >> $OBJECT_MAP
echo "<PlatForm>*-*</PlatForm>" >> $OBJECT_MAP
echo "</CodeInfo>" >> $OBJECT_MAP
echo "</CodeInfoList>" >> $OBJECT_MAP
#Installation end. Displaying new environement variable to set in .bahsrc
echo "$PREFIX POP-Java has been installed under $LOCATION. Please copy the following lines into your .bashrc files or equivalent"
echo ""
echo "POPJAVA_LOCATION=$LOCATION"
echo "export POPJAVA_LOCATION"
echo "POPJAVA_JAVA=$JAVA_PROGRAM"
echo "export POPJAVA_JAVA"
echo "PATH=\$PATH:\$POPJAVA_LOCATION/bin"
echo ""
echo "$PREFIX Installation done."
else
echo "$PREFIX Installation aborted. You don't have the permission to write in the installation directory. Try to run the installation with the 'sudo -E' command"
fi