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

Last change on this file since 30131 was 30131, checked in by ak19, 7 years ago

Changes specific to 64 bit MacOS with which we now bundle a JRE.

File size: 16.8 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 </target>
212
213 <!-- Apache HTTPD -->
214 <target name="Installing Apache Web Server">
215 <echo>Installing the Apache Web Server</echo>
216
217 <!-- start web -->
218 <unzip src="${antinstaller.jar}" dest="${basedir}">
219 <patternset>
220 <include name="apachehttpd.lzma"/>
221 </patternset>
222 </unzip>
223
224 <!-- if linux|mac -->
225 <sevenzip task="decode" input="${basedir}/apachehttpd.lzma" output="${basedir}/apachehttpd.comp"/>
226 <!-- /if -->
227 <!-- if windows -->
228 <exec dir="${basedir}" executable="${basedir}/7za.exe">
229 <arg line="x apachehttpd.lzma"/>
230 </exec>
231 <!-- /if -->
232 <unzip src="${basedir}/apachehttpd.comp" dest="${installDir}"/>
233 <delete file="apachehttpd.comp"/>
234 <!-- end web -->
235
236 <!-- start cdrom -->
237 <mkdir dir="${installDir}/apache-httpd"/>
238 <mkdir dir="${installDir}/apache-httpd/${shell.name}"/>
239 <copy todir="${installDir}/apache-httpd/${shell.name}">
240 <fileset dir="${orig.dir}/Software/apache-httpd/${shell.name}"/>
241 </copy>
242 <!-- end cdrom -->
243
244 <!-- if linux|mac -->
245 <chmod dir="${installDir}/apache-httpd/${shell.name}/bin" includes="*" perm="775"/>
246 <chmod dir="${installDir}/apache-httpd/${shell.name}" includes="*.sh" perm="775"/>
247 <echo>Setting up apache web server</echo>
248 <exec dir="${installDir}" executable="${installDir}/apache-httpd/${shell.name}/install-bindist.sh">
249 <arg value="${installDir}/apache-httpd/${shell.name}"/>
250 </exec>
251 <!-- /if -->
252 </target>
253
254 <!-- ImageMagick -->
255 <target name="Installing ImageMagick">
256 <echo>Installing ImageMagick</echo>
257 <!-- start web -->
258 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
259 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
260 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
261 <delete file="imagemagick.lzma"/>
262 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
263 <delete file="imagemagick.comp"/>
264 <!-- end web -->
265
266 <!-- start cdrom -->
267 <copy todir="${installDir}">
268 <fileset dir="${orig.dir}/Software/imagemagick/${rk.os}"/>
269 </copy>
270 <!-- end cdrom -->
271
272 <if><bool><available file="${installDir}/bin/${shell.name}/imagemagick" type="dir"/></bool>
273 <chmod dir="${installDir}/bin/${shell.name}/imagemagick/bin" includes="*" perm="775"/>
274 <else>
275 <chmod dir="${installDir}/ext/imagemagick/${shell.name}/bin" includes="*" perm="775"/>
276 </else>
277 </if>
278
279 </target>
280
281 <!-- Ghostscript -->
282 <target name="Installing Ghostscript" depends="">
283 <echo message="Installing Ghostscript"/>
284 <!-- start web -->
285 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
286 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
287 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
288 <delete file="ghostscript.lzma"/>
289 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}" />
290 <delete file="ghostscript.comp"/>
291 <!-- end web -->
292
293 <!-- start cdrom -->
294 <copy todir="${installDir}">
295 <fileset dir="${orig.dir}/Software/ghostscript/${rk.os}"/>
296 </copy>
297 <!-- end cdrom -->
298
299 <chmod dir="${installDir}/bin/${shell.name}/ghostscript/bin" includes="*" perm="775"/>
300 </target>
301
302 <!-- Start menu shortcuts -->
303 <target name="Installing Start Menu Shortcuts">
304
305 <mkdir dir="${startmenu.path}\Documentation"/>
306
307 <!-- Server shortcut -->
308 <if><bool><available file="${installDir}/web/images/server.ico"/></bool>
309 <property name="servericon" value="${installDir}\web\images\server.ico"/>
310 <else>
311 <property name="servericon" value="${installDir}\web\images\serverico.ico"/>
312 </else>
313 </if>
314
315 <shortcut
316 file="${startmenu.path}\Greenstone Server.lnk"
317 execute="${installDir}\gs2-server.bat"
318 workingDirectory="${installDir}"
319 iconFile="${servericon}"
320 iconIndex="0" />
321
322 <!-- Librarian shortcut -->
323 <if><bool><available file="${installDir}/web/images/librarian.ico"/></bool>
324 <property name="libraryicon" value="${installDir}\web\images\librarian.ico"/>
325 <else>
326 <property name="libraryicon" value="${installDir}\web\images\icon.ico"/>
327 </else>
328 </if>
329
330 <shortcut
331 file="${startmenu.path}\Librarian Interface (GLI).lnk"
332 execute="${installDir}\gli\gli.bat"
333 workingDirectory="${installDir}\gli"
334 iconFile="${libraryicon}"
335 iconIndex="0" />
336
337 <!-- Remote Server shortcut -->
338 <if><bool><available file="${installDir}/web/images/clientgli.ico"/></bool>
339 <property name="clientgliicon" value="${installDir}\web\images\clientgli.ico"/>
340 <else>
341 <property name="clientgliicon" value="${installDir}\web\images\icon.ico"/>
342 </else>
343 </if>
344
345 <shortcut
346 file="${startmenu.path}\Remote Librarian Interface (Client GLI).lnk"
347 execute="${installDir}\gli\client-gli.bat"
348 workingDirectory="${installDir}\gli"
349 iconFile="${clientgliicon}"
350 iconIndex="0" />
351
352 <!-- GEMS shortcut -->
353 <if><bool><available file="${installDir}/web/images/metadata.ico"/></bool>
354 <property name="gemsicon" value="${installDir}\web\images\metadata.ico"/>
355 <else>
356 <property name="gemsicon" value="${installDir}\web\images\gems.ico"/>
357 </else>
358 </if>
359
360 <shortcut
361 file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
362 execute="${installDir}\gli\gems.bat"
363 workingDirectory="${installDir}\gli"
364 iconFile="${gemsicon}"
365 iconIndex="0" />
366
367 <!-- Uninstall shortcut -->
368 <if><bool><available file="${installDir}/web/images/newuninstall.ico"/></bool>
369 <property name="uninstallicon" value="${installDir}\web\images\newuninstall.ico"/>
370 <else>
371 <property name="uninstallicon" value="${installDir}\web\images\uninstall.ico"/>
372 </else>
373 </if>
374
375 <shortcut
376 file="${startmenu.path}\Uninstall.lnk"
377 execute="${installDir}\uninstall\Uninstall.bat"
378 workingDirectory="${installDir}\uninstall"
379 iconFile="${uninstallicon}"
380 iconIndex="0" />
381
382 <!-- Misc shortcuts -->
383 <shortcut
384 file="${startmenu.path}\Documentation\READMEen.lnk"
385 execute="${installDir}\READMEen.txt" />
386
387 <shortcut
388 file="${startmenu.path}\Documentation\Greenstone Wiki.url"
389 url="http://wiki.greenstone.org" />
390
391 <shortcut
392 file="${startmenu.path}\Documentation\Greenstone Website.url"
393 url="http://www.greenstone.org" />
394
395 </target>
396
397 <target name="Configuring Administration Pages" if="enable.admin.pages">
398 <echo>Enabling Admin Pages</echo>
399 <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
400 <echo>Creating admin and demo users</echo>
401 <adduser txt2db="${installDir}/bin/${shell.name}/txt2db"
402 usersDb="${installDir}/etc/users.gdb"
403 username="admin"
404 password="${admin.password}"
405 groups="administrator,colbuilder,all-collections-editor"
406 comment="created at install time"/>
407 <adduser
408 txt2db="${installDir}/bin/${shell.name}/txt2db"
409 usersDb="${installDir}/etc/users.gdb"
410 username="demo"
411 password="demo"
412 groups="demo"
413 comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
414 </target>
415
416 <target name="Installing Documented Examples">
417 <unzip src="${orig.dir}/documented-examples.zip" dest="${installDir}/collect"/>
418 </target>
419
420</project>
Note: See TracBrowser for help on using the repository browser.