source: main/trunk/release-kits/kits/rk2/installer/build.xml@ 32733

Last change on this file since 32733 was 32733, checked in by ak19, 5 years ago

For GS2, GLI won't work after PDFPlugin restructed into PDFv1 and PDFv2 plugins, since PDFv2Plugin fails unless PDFBoxConverter is installed. So now the GS2 installer renames PDFv2Plugin's extension (.pm to .tmp) to allow GLI to run.

File size: 17.1 KB
Line 
1<?xml version="1.0"?>
2<!--
3This is the build.xml run by AntInstaller for the installer
4-->
5
6<project name="Installation">
7
8 <!-- this is required to pick up the properties generated during the install pages -->
9 <property file="${basedir}/ant.install.properties"/>
10
11 <!-- set some properties to keep track of the OS -->
12 <!-- if windows -->
13 <property name="rk.os" value="windows"/>
14 <property name="shell.name" value="windows"/>
15 <!-- /if -->
16 <!-- if linux -->
17 <property name="rk.os" value="linux"/>
18 <property name="shell.name" value="linux"/>
19 <!-- /if -->
20 <!-- if mac -->
21 <property name="rk.os" value="mac"/>
22 <property name="shell.name" value="darwin"/>
23 <!-- /if -->
24
25 <!-- classpath -->
26 <path id="project.classpath">
27 <pathelement path="${antinstaller.jar}"/>
28 </path>
29
30 <!-- custom tasks -->
31 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
32 <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
33 <typedef name="adduser" classname="org.greenstone.anttasks.AddGreenstoneUserToDatabase" classpathref="project.classpath"/>
34 <!-- if windows -->
35 <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
36 <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
37 <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
38 <!-- /if -->
39 <!-- if linux|mac -->
40 <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
41 <!-- /if -->
42
43 <!-- determine if a bundled java exists -->
44 <condition property="bundled.java.exists">
45 <or>
46 <available file="../@java.extracted@/bin/java"/>
47 <available file="../@java.extracted@/bin/java.exe"/>
48 <available file="/tmp/jre/bin/java"/>
49 </or>
50 </condition>
51
52 <!-- determine if there is an existing installation in the installDir-->
53 <available file="${installDir}\etc\installation.properties" property="is.overinstall"/>
54
55 <!-- create a local installDir String -->
56 <path id="installDir.path"><pathelement location="${installDir}"/></path>
57 <property name="installDir.local" refid="installDir.path"/>
58
59 <!-- if windows -->
60 <!-- load windows properties -->
61 <winprops/>
62 <!-- /if -->
63
64 <!-- load the properties of the previous installation if this is an overinstall -->
65 <target name="Looking For Previous Installation" if="is.overinstall">
66 <property file="${installDir}\etc\installation.properties"/>
67 <delete dir="${installed.startmenu.path}" failonerror="false"/>
68 </target>
69
70 <!-- copy jre -->
71 <target name="Initialising" if="bundled.java.exists">
72 <!-- work out whether a jre was bundled with this installer. If it was, then for a Mac, it would live in /tmp -->
73 <!-- if mac -->
74 <property name="extracted.jre.path" location="/tmp/jre" relative="false" />
75 <!-- /if -->
76 <!-- if windows|linux -->
77 <property name="extracted.jre.path" location="../@java.extracted@" relative="true" basedir="${basedir}" />
78 <!-- /if -->
79
80 <mkdir dir="${installDir}/packages"/>
81 <copy todir="${installDir}/packages/jre" failonerror="false">
82 <fileset dir="${extracted.jre.path}"/>
83 </copy>
84 <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>
85 <!-- if mac -->
86 <chmod dir="${installDir}/packages/jre/lib" includes="**/*" perm="a+rx"/>
87 <!-- /if -->
88 </target>
89
90 <!-- copy jre -->
91 <!--
92 <target name="Initialising" if="bundled.java.exists">
93 <mkdir dir="${installDir}/packages"/>
94 <copy todir="${installDir}/packages/jre" failonerror="false">
95 <fileset dir="../@java.extracted@"/>
96 </copy>
97 <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>
98 </target>
99 -->
100
101
102 <!-- core system -->
103 <target name="Installing Core System">
104
105 <!-- if windows -->
106 <!-- figure out the start menu path -->
107 <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
108 <path id="startmenu.path.path" path="${startmenu.path}"/>
109 <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
110
111 <!-- extract 7za tool -->
112 <unzip src="${antinstaller.jar}" dest="${basedir}">
113 <patternset><include name="7za.exe"/></patternset>
114 </unzip>
115 <!-- /if -->
116
117 <!-- start web -->
118 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
119 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/core.lzma" output="${basedir}/core.comp"/><!-- /if -->
120 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec><!-- /if -->
121 <delete file="core.lzma"/>
122 <unzip src="${basedir}/core.comp" dest="${installDir}"/>
123 <delete file="core.comp"/>
124 <!-- end web -->
125
126 <!-- start cdrom -->
127 <copy todir="${installDir}">
128 <fileset dir="${orig.dir}/Software/core/all"/>
129 <fileset dir="${orig.dir}/Software/core/${rk.os}"/><!-- /if -->
130 </copy>
131 <!-- if windows -->
132 <copy todir="${installDir}/packages/jre" failonerror="false">
133 <fileset dir="${orig.dir}/Java/Windows/jre"/>
134 </copy>
135 <!-- /if -->
136 <!-- end cdrom -->
137
138 <echo>Setting Binaries to Executable</echo>
139 <chmod dir="${installDir}" includes="*.sh,*.bash" perm="775"/>
140 <chmod dir="${installDir}/bin" includes="*" perm="775"/>
141 <!-- to circumvent the Shellshock Bash bug vulnerability,
142 do not give execute permissions to bash files (*.*sh, or no file extension)
143 At present, the "getior" file is the only bash script here.
144 The other executables here have *.cgi, *.pl extensions.-->
145 <chmod dir="${installDir}/cgi-bin/${shell.name}" includes="*.cgi,*.pl" perm="775"/>
146 <chmod dir="${installDir}/bin/script" includes="**/*" perm="775"/>
147 <chmod dir="${installDir}/gli" includes="*.sh" perm="775"/>
148 <!-- if linux|mac -->
149 <chmod dir="${installDir}/bin/${shell.name}" includes="**/*" perm="775"/>
150 <!-- /if -->
151
152 <echo>Filling in concrete values in config files</echo>
153 <copy file="${installDir}/cgi-bin/${shell.name}/gsdlsite.cfg.in" tofile="${installDir}/cgi-bin/${shell.name}/gsdlsite.cfg"/>
154 <rsr file="${installDir}/cgi-bin/${shell.name}/gsdlsite.cfg" pattern="&quot;?\*\*GSDLHOME\*\*&quot;?" replacement="&quot;${installDir.local}&quot;"/>
155
156 <echo>Correcting perl shebangs in perl scripts</echo>
157 <!-- if linux|mac -->
158 <exec executable="which" outputproperty="perl.executable"><arg value="perl"/></exec>
159 <rsr file="${installDir}/cgi-bin/${shell.name}/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
160 <rsr file="${installDir}/cgi-bin/${shell.name}/metadata-server.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
161 <rsr file="${installDir}/cgi-bin/${shell.name}/checksum.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
162 <!-- /if -->
163 <!-- if windows -->
164 <property name="perl.executable" value="${installDir.local}\bin\windows\perl\bin\perl.exe"/>
165 <rsr file="${installDir}/cgi-bin/${shell.name}/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
166 <rsr file="${installDir}/cgi-bin/${shell.name}/metadata-server.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
167 <rsr file="${installDir}/cgi-bin/${shell.name}/checksum.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
168 <!-- /if -->
169
170 <echo>Creating the english dictionary</echo>
171 <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
172
173 <!-- if linux|mac -->
174 <echo>Set the installation locale in config files</echo>
175 <rsr file="${installDir}/setup.bash" pattern="^gsdllang=.*" replacement="gsdllang=${language}"/>
176 <rsr file="${installDir}/gli/gli.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
177 <rsr file="${installDir}/gli/gems.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
178 <!-- /if -->
179 <rsr
180 file="${installDir}/gli/classes/xml/config.xml"
181 pattern="(&lt;Argument name=&quot;general.locale&quot;&gt;).*(&lt;/Argument&gt;)"
182 replacement="$1${language}$2"/>
183
184 <echo file="${installDir}/etc/main.cfg" append="true"
185 >cgiarg shortname=l argdefault=${language}</echo>
186
187 <echo message="Creating installation properties file"/>
188 <!-- if linux|mac -->
189 <echo file="${installDir}/etc/installation.properties">#this file is just a placeholder for now</echo>
190 <!-- /if -->
191 <!-- if windows -->
192 <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
193 <!-- /if -->
194
195 <!-- if mac -->
196 <copy file="${installDir}/gli.app/Contents/document.wflow.in" tofile="${installDir}/gli.app/Contents/document.wflow"/>
197 <rsr file="${installDir}/gli.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
198
199 <copy file="${installDir}/gs2-server.app/Contents/document.wflow.in" tofile="${installDir}/gs2-server.app/Contents/document.wflow"/>
200 <rsr file="${installDir}/gs2-server.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
201
202 <copy file="${installDir}/gems.app/Contents/document.wflow.in" tofile="${installDir}/gems.app/Contents/document.wflow"/>
203 <rsr file="${installDir}/gems.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
204
205 <copy file="${installDir}/client-gli.app/Contents/document.wflow.in" tofile="${installDir}/client-gli.app/Contents/document.wflow"/>
206 <rsr file="${installDir}/client-gli.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
207
208 <chmod dir="${installDir}" includes="*.app" perm="755"/>
209 <chmod dir="${installDir}" includes="*.app/**/*" perm="755"/>
210 <!-- /if -->
211
212 <echo message="Renaming PDFv2Plugin to make it unfunctional. To make it functional, install the PDFBoxConverter extension for Greenstone and then rename the PDFv2Plugin.tmp file to to PDFv2Plugin.pm"/>
213 <move file="${installDir}/perllib/plugins/PDFv2Plugin.pm" tofile="${installDir}/perllib/plugins/PDFv2Plugin.tmp"/>
214 </target>
215
216 <!-- Apache HTTPD -->
217 <target name="Installing Apache Web Server">
218 <echo>Installing the Apache Web Server</echo>
219
220 <!-- start web -->
221 <unzip src="${antinstaller.jar}" dest="${basedir}">
222 <patternset>
223 <include name="apachehttpd.lzma"/>
224 </patternset>
225 </unzip>
226
227 <!-- if linux|mac -->
228 <sevenzip task="decode" input="${basedir}/apachehttpd.lzma" output="${basedir}/apachehttpd.comp"/>
229 <!-- /if -->
230 <!-- if windows -->
231 <exec dir="${basedir}" executable="${basedir}/7za.exe">
232 <arg line="x apachehttpd.lzma"/>
233 </exec>
234 <!-- /if -->
235 <unzip src="${basedir}/apachehttpd.comp" dest="${installDir}"/>
236 <delete file="apachehttpd.comp"/>
237 <!-- end web -->
238
239 <!-- start cdrom -->
240 <mkdir dir="${installDir}/apache-httpd"/>
241 <mkdir dir="${installDir}/apache-httpd/${shell.name}"/>
242 <copy todir="${installDir}/apache-httpd/${shell.name}">
243 <fileset dir="${orig.dir}/Software/apache-httpd/${shell.name}"/>
244 </copy>
245 <!-- end cdrom -->
246
247 <!-- if linux|mac -->
248 <chmod dir="${installDir}/apache-httpd/${shell.name}/bin" includes="*" perm="775"/>
249 <chmod dir="${installDir}/apache-httpd/${shell.name}" includes="*.sh" perm="775"/>
250 <echo>Setting up apache web server</echo>
251 <exec dir="${installDir}" executable="${installDir}/apache-httpd/${shell.name}/install-bindist.sh">
252 <arg value="${installDir}/apache-httpd/${shell.name}"/>
253 </exec>
254 <!-- /if -->
255 </target>
256
257 <!-- ImageMagick -->
258 <target name="Installing ImageMagick">
259 <echo>Installing ImageMagick</echo>
260 <!-- start web -->
261 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
262 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
263 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
264 <delete file="imagemagick.lzma"/>
265 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
266 <delete file="imagemagick.comp"/>
267 <!-- end web -->
268
269 <!-- start cdrom -->
270 <copy todir="${installDir}">
271 <fileset dir="${orig.dir}/Software/imagemagick/${rk.os}"/>
272 </copy>
273 <!-- end cdrom -->
274
275 <if><bool><available file="${installDir}/bin/${shell.name}/imagemagick" type="dir"/></bool>
276 <chmod dir="${installDir}/bin/${shell.name}/imagemagick/bin" includes="*" perm="775"/>
277 <else>
278 <chmod dir="${installDir}/ext/imagemagick/${shell.name}/bin" includes="*" perm="775"/>
279 </else>
280 </if>
281
282 </target>
283
284 <!-- Ghostscript -->
285 <target name="Installing Ghostscript" depends="">
286 <echo message="Installing Ghostscript"/>
287 <!-- start web -->
288 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
289 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
290 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
291 <delete file="ghostscript.lzma"/>
292 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}" />
293 <delete file="ghostscript.comp"/>
294 <!-- end web -->
295
296 <!-- start cdrom -->
297 <copy todir="${installDir}">
298 <fileset dir="${orig.dir}/Software/ghostscript/${rk.os}"/>
299 </copy>
300 <!-- end cdrom -->
301
302 <chmod dir="${installDir}/bin/${shell.name}/ghostscript/bin" includes="*" perm="775"/>
303 </target>
304
305 <!-- Start menu shortcuts -->
306 <target name="Installing Start Menu Shortcuts">
307
308 <mkdir dir="${startmenu.path}\Documentation"/>
309
310 <!-- Server shortcut -->
311 <if><bool><available file="${installDir}/web/images/server.ico"/></bool>
312 <property name="servericon" value="${installDir}\web\images\server.ico"/>
313 <else>
314 <property name="servericon" value="${installDir}\web\images\serverico.ico"/>
315 </else>
316 </if>
317
318 <shortcut
319 file="${startmenu.path}\Greenstone Server.lnk"
320 execute="${installDir}\gs2-server.bat"
321 workingDirectory="${installDir}"
322 iconFile="${servericon}"
323 iconIndex="0" />
324
325 <!-- Librarian shortcut -->
326 <if><bool><available file="${installDir}/web/images/librarian.ico"/></bool>
327 <property name="libraryicon" value="${installDir}\web\images\librarian.ico"/>
328 <else>
329 <property name="libraryicon" value="${installDir}\web\images\icon.ico"/>
330 </else>
331 </if>
332
333 <shortcut
334 file="${startmenu.path}\Librarian Interface (GLI).lnk"
335 execute="${installDir}\gli\gli.bat"
336 workingDirectory="${installDir}\gli"
337 iconFile="${libraryicon}"
338 iconIndex="0" />
339
340 <!-- Remote Server shortcut -->
341 <if><bool><available file="${installDir}/web/images/clientgli.ico"/></bool>
342 <property name="clientgliicon" value="${installDir}\web\images\clientgli.ico"/>
343 <else>
344 <property name="clientgliicon" value="${installDir}\web\images\icon.ico"/>
345 </else>
346 </if>
347
348 <shortcut
349 file="${startmenu.path}\Remote Librarian Interface (Client GLI).lnk"
350 execute="${installDir}\gli\client-gli.bat"
351 workingDirectory="${installDir}\gli"
352 iconFile="${clientgliicon}"
353 iconIndex="0" />
354
355 <!-- GEMS shortcut -->
356 <if><bool><available file="${installDir}/web/images/metadata.ico"/></bool>
357 <property name="gemsicon" value="${installDir}\web\images\metadata.ico"/>
358 <else>
359 <property name="gemsicon" value="${installDir}\web\images\gems.ico"/>
360 </else>
361 </if>
362
363 <shortcut
364 file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
365 execute="${installDir}\gli\gems.bat"
366 workingDirectory="${installDir}\gli"
367 iconFile="${gemsicon}"
368 iconIndex="0" />
369
370 <!-- Uninstall shortcut -->
371 <if><bool><available file="${installDir}/web/images/newuninstall.ico"/></bool>
372 <property name="uninstallicon" value="${installDir}\web\images\newuninstall.ico"/>
373 <else>
374 <property name="uninstallicon" value="${installDir}\web\images\uninstall.ico"/>
375 </else>
376 </if>
377
378 <shortcut
379 file="${startmenu.path}\Uninstall.lnk"
380 execute="${installDir}\uninstall\Uninstall.bat"
381 workingDirectory="${installDir}\uninstall"
382 iconFile="${uninstallicon}"
383 iconIndex="0" />
384
385 <!-- Misc shortcuts -->
386 <shortcut
387 file="${startmenu.path}\Documentation\READMEen.lnk"
388 execute="${installDir}\READMEen.txt" />
389
390 <shortcut
391 file="${startmenu.path}\Documentation\Greenstone Wiki.url"
392 url="http://wiki.greenstone.org" />
393
394 <shortcut
395 file="${startmenu.path}\Documentation\Greenstone Website.url"
396 url="http://www.greenstone.org" />
397
398 </target>
399
400 <target name="Configuring Administration Pages" if="enable.admin.pages">
401 <echo>Enabling Admin Pages</echo>
402 <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
403 <echo>Creating admin and demo users</echo>
404 <adduser txt2db="${installDir}/bin/${shell.name}/txt2db"
405 usersDb="${installDir}/etc/users.gdb"
406 username="admin"
407 password="${admin.password}"
408 groups="administrator,colbuilder,all-collections-editor"
409 comment="created at install time"/>
410 <adduser
411 txt2db="${installDir}/bin/${shell.name}/txt2db"
412 usersDb="${installDir}/etc/users.gdb"
413 username="demo"
414 password="demo"
415 groups="demo"
416 comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
417 </target>
418
419 <target name="Installing Documented Examples">
420 <unzip src="${orig.dir}/documented-examples.zip" dest="${installDir}/collect"/>
421 </target>
422
423</project>
Note: See TracBrowser for help on using the repository browser.