source: other-projects/expeditee-release-kits/kits/rke/installer/build.xml@ 28695

Last change on this file since 28695 was 28695, checked in by ak19, 10 years ago

Expeditee team (Jeremy, jts21). Preliminary versions of the release-kits files for generating an installer containing the executable expeditee jar file. The installer is still tattoed with Greenstone and fails, but will leave a working jar behind on the file system.

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