source: main/trunk/release-kits/kits/rk3/installer/build.xml@ 34607

Last change on this file since 34607 was 34607, checked in by anupama, 20 months ago

Shifting remaining rk3 (GS3) related release-kits files over to using ant exec wget from ant get to allow downloading from the new HTTPS://www.greenstone.org. Still testing rk2/GS2 binary goes through before committing rk2 specific release-kits scripts.

File size: 19.7 KB
Line 
1<?xml version="1.0"?>
2<!--
3This is the build.xml run by AntInstaller for the installer
4-->
5<project name="Installation">
6
7 <!-- this is required to pick up the properties generated during the install pages -->
8 <property file="${basedir}/ant.install.properties"/>
9
10 <!-- custom tasks -->
11 <path id="project.classpath"><pathelement path="${antinstaller.jar}"/></path>
12
13 <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
14 <!--<typedef name="adduser" classname="org.greenstone.anttasks.AddGreenstone3UserToDatabase" classpathref="project.classpath"/>-->
15 <!-- if linux|mac -->
16 <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
17 <!-- /if -->
18 <!-- if windows -->
19 <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
20 <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
21 <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
22 <!-- /if -->
23
24 <!-- set some properties to keep track of the OS -->
25 <!-- if windows -->
26 <property name="rk.os" value="windows"/>
27 <property name="shell.name" value="windows"/>
28 <!-- /if -->
29 <!-- if linux -->
30 <property name="rk.os" value="linux"/>
31 <property name="shell.name" value="linux"/>
32 <!-- /if -->
33 <!-- if mac -->
34 <property name="rk.os" value="mac"/>
35 <property name="shell.name" value="darwin"/>
36 <!-- /if -->
37
38
39 <!-- create a local and strictly unix installDir String -->
40 <path id="installDir.path"><pathelement location="${installDir}"/></path>
41 <property name="installDir.local" refid="installDir.path"/>
42 <pathconvert targetos="unix" property="installDir.unix" refid="installDir.path"/>
43
44 <!-- if windows -->
45 <!-- load windows properties -->
46 <winprops/>
47 <!-- /if -->
48
49 <!-- determine if there is an existing installation in the installDir-->
50 <available file="${installDir}\installation.properties" property="is.overinstall"/>
51
52 <!-- work out whether a jre was bundled with this installer. If it was, then for a Mac, it would live in /tmp -->
53 <!-- if mac -->
54 <available file="/tmp/jre/bin" property="bundled.java.exists"/>
55 <property name="extracted.jre.path" location="/tmp/jre" relative="false" />
56 <!-- /if -->
57 <!-- if windows|linux -->
58 <available file="../jre/bin" property="bundled.java.exists"/>
59 <property name="extracted.jre.path" location="../jre" relative="true" basedir="${basedir}" />
60 <!-- /if -->
61
62 <!-- target to copy the bundled jre into place -->
63 <target name="Initialising" if="bundled.java.exists">
64 <mkdir dir="${installDir}"/>
65 <copy todir="${installDir}/packages/jre" failonerror="false">
66 <fileset dir="${extracted.jre.path}"/>
67 </copy>
68 <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>
69 <!-- if mac -->
70 <chmod dir="${installDir}/packages/jre/lib" includes="**/*" perm="a+rx"/>
71 <!-- /if -->
72 </target>
73
74 <!-- target to load in the messages left by the last installation -->
75 <target name="Looking For Previous Installation" if="is.overinstall">
76 <property file="${installDir}\installation.properties"/>
77 <delete dir="${installed.startmenu.path}" failonerror="false"/>
78 </target>
79
80 <target name="Installing Core System">
81
82 <!-- rip out build.xml to the temp dir so we can fake and <antcall> with <ant> -->
83 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="build.xml"/></patternset></unzip>
84
85
86 <!-- if windows -->
87 <echo>Figuring out the start menu path</echo>
88 <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
89 <path id="startmenu.path.path" path="${startmenu.path}"/>
90 <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
91
92 <echo>Extracting 7za tool</echo>
93 <unzip src="${antinstaller.jar}" dest="${basedir}">
94 <patternset><include name="7za.exe"/></patternset>
95 </unzip>
96 <!-- /if -->
97
98 <echo>Extracting core component</echo>
99 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
100 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec><!-- /if -->
101 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/core.lzma" output="${basedir}/core.comp"/><!-- /if -->
102 <delete file="core.lzma"/>
103 <unzip src="${basedir}/core.comp" dest="${installDir}"/>
104 <delete file="core.comp"/>
105
106 <echo>Setting binaries to executable</echo>
107 <chmod dir="${installDir}" includes="*.sh" perm="775"/>
108 <chmod dir="${installDir}/bin/script" includes="*" perm="775"/>
109 <chmod dir="${installDir}/bin" includes="*" perm="775"/>
110 <chmod dir="${installDir}/ext/solr/bin/script" includes="*" perm="775"/>
111 <chmod dir="${installDir}/web/WEB-INF/cgi/" includes="*.pl" perm="775"/>
112 <!-- if linux -->
113 <chmod dir="${installDir}/gs2build/bin/linux" includes="*" perm="775"/>
114 <!-- No longer grabbing prebuilt 32 bit wvWare. We now use the one release-kit was already locally building,
115 now that the libpng dependency is resolved. So 64 bit wvWare binary on 64 bit linux and 32 bit on 32 bit linux. -->
116 <!--<chmod dir="${installDir}/gs2build/bin/linux/wv/bin" includes="*" perm="775"/>-->
117 <chmod dir="${installDir}/gs2build/bin/linux/xpdf-tools/bin" includes="*" perm="775"/>
118 <chmod dir="${installDir}/bin/linux" includes="*" perm="775"/>
119 <chmod dir="${installDir}/bin/linux/openssl/bin" includes="*" perm="775"/>
120 <!-- /if -->
121 <!-- if mac -->
122 <chmod dir="${installDir}/gs2build/bin/darwin" includes="**/*" excludes="ghostscript/** imagemagick/**" perm="775"/>
123 <chmod dir="${installDir}/bin/darwin" includes="*" perm="775"/>
124 <chmod dir="${installDir}/bin/darwin/openssl/bin" includes="*" perm="775"/>
125 <!-- /if -->
126 <chmod dir="${installDir}/gs2build/bin/script" includes="**/*" perm="775"/>
127 <!-- GLI START -->
128 <chmod dir="${installDir}/gli" includes="*.sh" perm="775"/>
129 <!-- GLI END -->
130
131 <chmod file="${installDir}/packages/ant/bin/ant" perm="775"/>
132 <!--
133 source is not included for now
134 <chmod dir="${installDir}/gs2build" includes="**/configure" perm="775"/>
135 <chmod dir="${installDir}/gs2build/common-src/packages/gdbm/gdbm-1.8.3" includes="mkinstalldirs" perm="775"/>
136 <chmod file="${installDir}/src/packages/javagdbm/configure" perm="775"/>
137 -->
138
139
140 <echo>Correcting perl shebangs in perl scripts</echo>
141 <ant dir="${installDir}" antfile="build.xml" target="set-perl-shebangs" inheritAll="false">
142 <!-- if windows -->
143 <property name="perl.path" value="${installDir}\gs2build\bin\windows\perl\bin\"/>
144 <!-- /if -->
145 </ant>
146
147
148 <echo>Setting tomcat ports</echo>
149 <property name="tomcat.server" value="localhost"/>
150 <property name="tomcat.port" value="8383"/>
151 <property name="tomcat.shutdown.port" value="8305"/>
152 <rsr file="${installDir}/build.properties">
153 <job pattern="^(tomcat\.server[=:]).*" replacement="$1${tomcat.server}" />
154 <job pattern="^(tomcat\.port[=:]).*" replacement="$1${tomcat.port}" />
155 <job pattern="^(tomcat\.shutdown.port[=:]).*" replacement="$1${tomcat.shutdown.port}" />
156 </rsr>
157
158 <echo>Setting up global properties</echo>
159 <copy file="${installDir}/resources/web/global.properties.in" tofile="${installDir}/web/WEB-INF/classes/global.properties" overwrite="true"/>
160 <rsr file="${installDir}/web/WEB-INF/classes/global.properties">
161 <job pattern="^(gsdl3\.home[:=]).*" replacement="$1${installDir.unix}/web" />
162 <job pattern="^(tomcat.server[:=]).*" replacement="$1${tomcat.server}" />
163 <job pattern="^(tomcat\.port[:=]).*" replacement="$1${tomcat.port}" />
164 </rsr>
165
166 <echo>Setting up log4j properties</echo>
167 <copy file="${installDir}/resources/web/log4j.properties.in" tofile="${installDir}/web/WEB-INF/classes/log4j.properties" overwrite="true"/>
168 <rsr file="${installDir}/web/WEB-INF/classes/log4j.properties" pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
169
170 <!-- if windows -->
171 <echo message="Setting GSDLHOME in gs2build\setup.bat"/>
172 <!-- No quotes around GSDLHOME filepath in setup.bat. since the set operations of batchfiles don't want spaces in their assignments, and where quotes are needed in setup.bat, setup.bat handles this itself -->
173 <rsr file="${installDir}/gs2build/setup.bat" pattern="&quot;?\*\*GSDLHOME\*\*&quot;?" replacement="${installDir.local}\gs2build" />
174 <!-- /if -->
175
176 <!-- if windows|linux -->
177 <echo>Deleting mac shortcuts</echo>
178
179 <!-- from now on, we have 64 bit .app as well as 32 bit .app files in their own separate folders.
180 One or more of these folders or .app files won't exist, so don't fail on error if they can't be deleted for that reason -->
181 <delete failonerror="false" dir="${installDir}/MacShortcuts64bit"/>
182 <delete failonerror="false" dir="${installDir}/MacShortcuts32bit"/>
183 <!-- /if -->
184
185 <!-- if mac -->
186 <echo>Installing Mac Shortcuts</echo>
187 <!-- convert template document.wflow.in files inside the .app mac shortcuts into their live files -->
188 <ant dir="${installDir}" antfile="build.xml" target="gen-mac-shortcuts" inheritAll="false" />
189
190 <!-- need to give executable permissions to the Mac shortcuts -->
191 <chmod file="${installDir}/gs3-server.app/Contents/MacOS/gs2-server" perm="775"/><!--called gs2-server, since the gs3-server.app is a copy of the one generated for gs2-->
192 <chmod file="${installDir}/gli.app/Contents/MacOS/gli" perm="775"/>
193 <chmod file="${installDir}/client-gli.app/Contents/MacOS/client-gli" perm="775"/>
194 <chmod file="${installDir}/gems.app/Contents/MacOS/gems" perm="775"/>
195
196 <!-- From Catalina (Darwin kernel version 19.x onwards) the executables are called: Application Stub -->
197 <chmod file="${installDir}/gs3-server.app/Contents/MacOS/Application Stub" perm="775"/>
198 <chmod file="${installDir}/gli.app/Contents/MacOS/Application Stub" perm="775"/>
199 <chmod file="${installDir}/client-gli.app/Contents/MacOS/Application Stub" perm="775"/>
200 <chmod file="${installDir}/gems.app/Contents/MacOS/Application Stub" perm="775"/>
201
202 <!--<chmod dir="${installDir}" includes="*.app" perm="755"/>
203 <chmod dir="${installDir}" includes="*.app/**/*" perm="755"/>-->
204
205 <!-- can get rid of the shortcuts folders -->
206 <delete failonerror="false" dir="${installDir}/MacShortcuts64bit"/>
207 <delete failonerror="false" dir="${installDir}/MacShortcuts32bit"/>
208 <!-- /if -->
209
210 <!-- GLI START -->
211 <echo>Creating the english dictionary</echo>
212 <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
213 <!-- GLI END -->
214
215 <echo>Creating usage.txt</echo>
216 <echo file="${installDir}/gs2build/etc/usage.txt"></echo>
217
218 <echo>Creating installation properties file</echo>
219 <echo file="${installDir}\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
220
221 <echo>Finished</echo>
222
223 </target>
224
225 <!-- Dummy target to redirect display of subtargets resulting from ant calls to the gen-mac-shortcuts
226 and set-perl-shebangs to this dummy target instead of to the Installing ImageMagick target below -->
227 <target name="Adjusting Permissions" />
228
229 <target name="Installing ImageMagick">
230
231 <echo>Installing ImageMagick</echo>
232 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
233 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
234 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
235 <delete file="imagemagick.lzma"/>
236 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
237 <delete file="imagemagick.comp"/>
238
239 <echo>Setting binaries to executable</echo>
240 <!-- if linux -->
241 <chmod dir="${installDir}/gs2build/bin/linux/imagemagick/bin" includes="*" perm="775"/>
242 <!-- /if -->
243 <!-- if mac -->
244 <chmod dir="${installDir}/gs2build/bin/darwin/imagemagick/bin" includes="*" perm="775"/>
245 <!-- /if -->
246
247 </target>
248
249 <!-- NO FLAX START -->
250
251 <target name="Installing Ghostscript">
252
253 <echo>Installing Ghostscript</echo>
254 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
255 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
256 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
257 <delete file="ghostscript.lzma"/>
258 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}"/>
259 <delete file="ghostscript.comp"/>
260
261 <echo>Setting binaries to executable</echo>
262 <!-- if linux -->
263 <chmod dir="${installDir}/gs2build/bin/linux/ghostscript/bin" includes="*" perm="775"/>
264 <!-- /if -->
265 <!-- if mac -->
266 <chmod dir="${installDir}/gs2build/bin/darwin/ghostscript/bin" includes="*" perm="775"/>
267 <!-- /if -->
268
269 </target>
270
271 <!-- NO FLAX END -->
272
273 <!-- start amp -->
274
275 <target name="Installing AMP">
276 <echo>Installing Apache, MySQL and PHP</echo>
277 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="amp.lzma"/></patternset></unzip>
278 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x amp.lzma"/></exec><!-- /if -->
279 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/amp.lzma" output="${basedir}/amp.comp"/><!-- /if -->
280 <delete file="amp.lzma"/>
281 <unzip src="${basedir}/amp.comp" dest="${installDir}/ext/amp"/>
282 <delete file="amp.comp"/>
283
284 <!-- if linux|mac -->
285 <echo>Setting binaries to executable</echo>
286 <chmod dir="${installDir}/ext/amp" includes="*" perm="775"/>
287 <!-- /if -->
288 </target>
289
290 <!-- end amp -->
291
292 <target name="Installing Tomcat">
293
294 <echo>Installing Tomcat (packages/tomcat)</echo>
295 <mkdir dir="packages"/>
296 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="tomcat.lzma"/></patternset></unzip>
297 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x tomcat.lzma"/></exec><!-- /if -->
298 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/tomcat.lzma" output="${basedir}/tomcat.comp"/><!-- /if -->
299 <delete file="tomcat.lzma"/>
300 <unzip src="${basedir}/tomcat.comp" dest="${installDir}"/>
301 <delete file="tomcat.comp"/>
302
303
304 <echo>Changing tomcat ports tomcat's server.xml</echo>
305 <copy file="${installDir}/resources/tomcat/server_tomcat8.xml.in" tofile="${installDir}/packages/tomcat/conf/server.xml" overwrite="true"/>
306 <rsr file="${installDir}/packages/tomcat/conf/server.xml">
307 <job pattern="@port@" replacement="${tomcat.port}"/>
308 <job pattern="@shutdown-port@" replacement="${tomcat.shutdown.port}"/>
309 </rsr>
310
311 <echo>Copying greenstone3.xml to tomcat directory</echo>
312 <copy file="${installDir}/resources/tomcat/greenstone3.xml.in" tofile="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true"/>
313 <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@gsdl3webhome@" replacement="${installDir.local}${file.separator}web" />
314 <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@privilegedattribute@" replacement="privileged='true'" />
315
316 <!-- FLAX START -->
317 <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="localsite" replacement="flax" />
318 <!-- FLAX END -->
319
320 <echo>Set binaries to executable</echo>
321 <chmod dir="${installDir}/packages/tomcat/bin" includes="*.sh" perm="775"/>
322
323 </target>
324
325 <target name="Installing Start Menu Shortcuts">
326
327 <echo>Installing Start Menu Shortcuts</echo>
328
329 <!-- NO FLAX START -->
330
331 <mkdir dir="${startmenu.path}\Documentation"/>
332
333 <shortcut
334 file="${startmenu.path}\Greenstone3 Server.lnk"
335 execute="${installDir}\gs3-server.bat"
336 workingDirectory="${installDir}"
337 iconFile="${installDir}\resources\images\server.ico"
338 iconIndex="0" />
339
340 <shortcut
341 file="${startmenu.path}\Greenstone Librarian Interface (GLI).lnk"
342 execute="${installDir}\gli\gli.bat"
343 workingDirectory="${installDir}\gli"
344 iconFile="${installDir}\resources\images\librarian.ico"
345 iconIndex="0" />
346
347 <shortcut
348 file="${startmenu.path}\Remote Greenstone Librarian Interface (Client GLI).lnk"
349 execute="${installDir}\gli\client-gli.bat"
350 workingDirectory="${installDir}\gli"
351 iconFile="${installDir}\resources\images\clientgli.ico"
352 iconIndex="0" />
353
354 <shortcut
355 file="${startmenu.path}\Greenstone Editor for Metadata Sets (GEMS).lnk"
356 execute="${installDir}\gli\gems.bat"
357 workingDirectory="${installDir}\gli"
358 iconFile="${installDir}\resources\images\metadata.ico"
359 iconIndex="0" />
360
361 <shortcut
362 file="${startmenu.path}\Uninstall.lnk"
363 execute="${installDir}\uninstall\Uninstall.bat"
364 workingDirectory="${installDir}"
365 iconFile="${installDir}\resources\images\uninstall.ico"
366 iconIndex="0" />
367
368 <shortcut
369 file="${startmenu.path}\Documentation\README.lnk"
370 execute="${installDir}\README.txt" />
371
372 <shortcut
373 file="${startmenu.path}\Documentation\Greenstone3 Users' Guide.lnk"
374 execute="${installDir}\documentation\manual\manual.pdf" />
375
376 <shortcut
377 file="${startmenu.path}\Documentation\Greenstone2 Users' Guide.lnk"
378 execute="${installDir}\documentation\manual\gs2_user_en.pdf" />
379
380 <shortcut
381 file="${startmenu.path}\Documentation\Greenstone Wiki.url"
382 url="http://wiki.greenstone.org" />
383
384 <shortcut
385 file="${startmenu.path}\Documentation\Greenstone Website.url"
386 url="https://www.greenstone.org" />
387
388 <!-- NO FLAX END -->
389
390 <!-- FLAX START -->
391
392 <shortcut
393 file="${startmenu.path}\Start FLAX Server.lnk"
394 execute="${installDir}\gs3-server.bat"
395 workingDirectory="${installDir}"
396 iconFile="${installDir}\resources\images\server.ico"
397 iconIndex="0" />
398
399 <shortcut
400 file="${startmenu.path}\Uninstall.lnk"
401 execute="${installDir}\uninstall\Uninstall.bat"
402 workingDirectory="${installDir}"
403 iconFile="${installDir}\resources\images\uninstall.ico"
404 iconIndex="0" />
405
406 <!-- FLAX END -->
407 </target>
408
409 <target name="Configuring Administration Pages" if="set.admin.pwd">
410 <echo>Enabling Admin Pages</echo>
411 <rsr file="${installDir}/web/sites/localsite/siteConfig.xml" pattern="&lt;!--&lt;serviceRack name='Authentication'/&gt;--&gt;" replacement="&lt;serviceRack name='Authentication'/&gt;"/>
412 <echo>Creating admin user</echo>
413 <!--<echo>Creating admin and demo users</echo>-->
414 <ant dir="${installDir}" antfile="build.xml" target="config-admin" inheritAll="false">
415 <property name="admin.password" value="${admin.password}"/>
416 </ant>
417 <!--<adduser txt2db="org.greenstone.gsdl3.util.ChangePwdUsersDB"
418 usersDb="${installDir}/web/sites/localsite/etc/usersDB"
419 username="admin"
420 password="${admin.password}"
421 groups="administrator,colbuilder,all-collections-editor"
422 comment="created at install time"
423 email=""/>
424 <adduser
425 txt2db="org.greenstone.gsdl3.util.ChangePwdUsersDB"
426 usersDb="${installDir}/web/sites/localsite/etc/usersDB"
427 username="demo"
428 password="demo"
429 groups="demo"
430 comment="Dummy 'demo' user with password 'demo' for authen-e collection"
431 email=""/>-->
432 </target>
433
434 <!-- util target to extract the given component -->
435 <!-- pass in ${component.name} as a param -->
436 <!-- unused at this time as causes display errors in installer gui!
437 <target name="extract-component">
438 <!- - extract the component into place - ->
439 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="${component.name}.lzma"/></patternset></unzip>
440 <!- - if windows - ->
441 <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ${component.name}.lzma"/></exec>
442 <!- - /if - ->
443 <!- - if linux|mac - ->
444 <sevenzip task="decode" input="${basedir}/${component.name}.lzma" output="${basedir}/${component.name}.comp"/>
445 <!- - /if - ->
446 <delete file="${component.name}.lzma"/>
447 <unzip src="${basedir}/${component.name}.comp" dest="${installDir}"/>
448 <delete file="${component.name}.comp"/>
449 </target>
450 -->
451
452</project>
Note: See TracBrowser for help on using the repository browser.