root/main/trunk/release-kits/kits/rk2/installer/build.xml @ 24113

Revision 24113, 14.5 KB (checked in by ak19, 8 years ago)

Changes to do with the CDROM. Sam updated the release-kit build.xml with fileset patterns to copy subdirectories and contents

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}\Greenstone-@version@" 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}"/>
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" 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/gsdlsite.cfg.in" tofile="${installDir}/cgi-bin/gsdlsite.cfg"/>
126        <rsr file="${installDir}/cgi-bin/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/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
132        <!-- /if -->
133        <!-- if windows -->
134        <property name="perl.executable" value="${installDir.local}\bin\windows\perl\bin\perl.exe"/>
135        <rsr file="${installDir}/cgi-bin/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
136        <!-- /if -->
137
138        <echo>Creating the english dictionary</echo>
139        <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
140
141        <!-- if linux|mac -->
142        <echo>Set the installation locale in config files</echo>
143        <rsr file="${installDir}/setup.bash" pattern="^gsdllang=.*" replacement="gsdllang=${language}"/>
144        <rsr file="${installDir}/gli/gli.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
145        <rsr file="${installDir}/gli/gems.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
146        <!-- /if -->
147        <rsr
148            file="${installDir}/gli/classes/xml/config.xml"
149            pattern="(&lt;Argument name=&quot;general.locale&quot;&gt;).*(&lt;/Argument&gt;)"
150            replacement="$1${language}$2"/>
151
152        <echo file="${installDir}/etc/main.cfg" append="true"
153            >cgiarg          shortname=l argdefault=${language}</echo>
154
155        <echo message="Creating installation properties file"/>
156        <!-- if linux|mac -->
157        <echo file="${installDir}/etc/installation.properties">#this file is just a placeholder for now</echo>
158        <!-- /if -->
159        <!-- if windows -->
160        <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
161        <!-- /if -->
162       
163        <!-- if mac -->
164        <rsr file="${installDir}/gli.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
165        <rsr file="${installDir}/gs2-server.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
166        <rsr file="${installDir}/gems.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
167        <rsr file="${installDir}/client-gli.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
168
169        <chmod dir="${installDir}" includes="*.app" perm="755"/>
170        <chmod dir="${installDir}" includes="*.app/**/*" perm="755"/>
171        <!-- /if -->
172    </target>
173
174    <!-- Apache HTTPD  -->
175    <target name="Installing Apache Web Server">
176        <echo>Installing the Apache Web Server</echo>
177
178        <!-- start web -->
179        <unzip src="${antinstaller.jar}" dest="${basedir}">
180            <patternset>
181                <include name="apachehttpd.lzma"/>
182            </patternset>
183        </unzip>
184
185        <!-- if linux|mac -->
186        <sevenzip task="decode" input="${basedir}/apachehttpd.lzma" output="${basedir}/apachehttpd.comp"/>
187        <!-- /if -->
188        <!-- if windows -->
189        <exec dir="${basedir}" executable="${basedir}/7za.exe">
190            <arg line="x apachehttpd.lzma"/>
191        </exec>
192        <!-- /if -->
193        <unzip src="${basedir}/apachehttpd.comp" dest="${installDir}"/>
194        <delete file="apachehttpd.comp"/>
195        <!-- end web -->
196
197        <!-- start cdrom -->
198        <mkdir dir="${installDir}/apache-httpd" />
199        <copy todir="${installDir}/apache-httpd">
200            <fileset dir="${orig.dir}/Software/apache-httpd/${rk.os}"/>
201        </copy>
202        <!-- end cdrom -->
203
204        <!-- if linux|mac -->
205        <chmod dir="${installDir}/apache-httpd/${shell.name}/bin" includes="*" perm="775"/>
206        <chmod dir="${installDir}/apache-httpd/${shell.name}" includes="*.sh" perm="775"/>
207        <echo>Setting up apache web server</echo>
208        <exec dir="${installDir}" executable="${installDir}/apache-httpd/${shell.name}/install-bindist.sh">
209            <arg value="${installDir}/apache-httpd/${shell.name}"/>
210        </exec>
211        <!-- /if -->
212    </target>
213
214    <!-- ImageMagick -->
215    <target name="Installing ImageMagick">
216        <echo>Installing ImageMagick</echo>
217        <!-- start web -->
218        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
219        <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
220        <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
221        <delete file="imagemagick.lzma"/>
222        <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
223        <delete file="imagemagick.comp"/>
224        <!-- end web -->
225
226        <!-- start cdrom -->
227        <copy todir="${installDir}">
228            <fileset dir="${orig.dir}/Software/imagemagick/${rk.os}"/>
229        </copy>
230        <!-- end cdrom -->
231
232        <if><bool><available file="${installDir}/bin/${shell.name}/imagemagick" type="dir"/></bool>
233            <chmod dir="${installDir}/bin/${shell.name}/imagemagick/bin" includes="*" perm="775"/>
234        <else>
235            <chmod dir="${installDir}/ext/imagemagick/${shell.name}/bin" includes="*" perm="775"/>
236        </else>
237        </if>
238
239    </target>
240
241    <!-- Ghostscript -->
242    <target name="Installing Ghostscript" depends="">
243        <echo message="Installing Ghostscript"/>
244        <!-- start web -->
245        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
246        <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
247        <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
248        <delete file="ghostscript.lzma"/>
249        <unzip src="${basedir}/ghostscript.comp" dest="${installDir}" />
250        <delete file="ghostscript.comp"/>
251        <!-- end web -->
252
253        <!-- start cdrom -->
254        <copy todir="${installDir}">
255            <fileset dir="${orig.dir}/Software/ghostscript/${rk.os}"/>
256        </copy>
257        <!-- end cdrom -->
258
259        <chmod dir="${installDir}/bin/${shell.name}/ghostscript/bin" includes="*" perm="775"/>
260    </target>   
261
262    <!-- Start menu shortcuts -->
263    <target name="Installing Start Menu Shortcuts">
264
265        <mkdir dir="${startmenu.path}\Documentation"/>
266
267        <!-- Server shortcut -->
268        <if><bool><available file="${installDir}/web/images/server.ico"/></bool>
269            <property name="servericon" value="${installDir}\web\images\server.ico"/>
270            <else>
271                <property name="servericon" value="${installDir}\web\images\serverico.ico"/>
272            </else>
273        </if>
274
275        <shortcut
276            file="${startmenu.path}\Greenstone Server.lnk"
277            execute="${installDir}\gs2-server.bat"
278            workingDirectory="${installDir}"
279            iconFile="${servericon}"
280            iconIndex="0" />
281
282        <!-- Librarian shortcut -->
283        <if><bool><available file="${installDir}/web/images/librarian.ico"/></bool>
284            <property name="libraryicon" value="${installDir}\web\images\librarian.ico"/>
285            <else>
286                <property name="libraryicon" value="${installDir}\web\images\icon.ico"/>
287            </else>
288        </if>
289
290        <shortcut
291            file="${startmenu.path}\Librarian Interface (GLI).lnk"
292            execute="${installDir}\gli\gli.bat"
293            workingDirectory="${installDir}\gli"
294            iconFile="${libraryicon}"
295            iconIndex="0" />
296           
297        <!-- Remote Server shortcut -->
298        <if><bool><available file="${installDir}/web/images/clientgli.ico"/></bool>
299            <property name="clientgliicon" value="${installDir}\web\images\clientgli.ico"/>
300            <else>
301                <property name="clientgliicon" value="${installDir}\web\images\icon.ico"/>
302            </else>
303        </if>
304
305        <shortcut
306            file="${startmenu.path}\Remote Librarian Interface (Client GLI).lnk"
307            execute="${installDir}\gli\client-gli.bat"
308            workingDirectory="${installDir}\gli"
309            iconFile="${clientgliicon}"
310            iconIndex="0" />
311
312        <!-- GEMS shortcut -->
313        <if><bool><available file="${installDir}/web/images/metadata.ico"/></bool>
314            <property name="gemsicon" value="${installDir}\web\images\metadata.ico"/>       
315            <else>
316                <property name="gemsicon" value="${installDir}\web\images\gems.ico"/>   
317            </else>
318        </if>
319
320        <shortcut
321            file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
322            execute="${installDir}\gli\gems.bat"
323            workingDirectory="${installDir}\gli"
324            iconFile="${gemsicon}"
325            iconIndex="0" />
326
327        <!-- Uninstall shortcut -->
328        <if><bool><available file="${installDir}/web/images/newuninstall.ico"/></bool>
329            <property name="uninstallicon" value="${installDir}\web\images\newuninstall.ico"/>     
330            <else>
331                <property name="uninstallicon" value="${installDir}\web\images\uninstall.ico"/>     
332            </else>
333        </if>
334       
335        <shortcut
336            file="${startmenu.path}\Uninstall.lnk"
337            execute="${installDir}\uninstall\Uninstall.bat"
338            workingDirectory="${installDir}\uninstall"
339            iconFile="${uninstallicon}"
340            iconIndex="0" />
341
342        <!-- Misc shortcuts -->
343        <shortcut
344            file="${startmenu.path}\Documentation\READMEen.lnk"
345            execute="${installDir}\READMEen.txt" />
346
347        <shortcut
348            file="${startmenu.path}\Documentation\Greenstone Wiki.url"
349            url="http://wiki.greenstone.org" />
350
351        <shortcut
352            file="${startmenu.path}\Documentation\Greenstone Website.url"
353            url="http://www.greenstone.org" />
354
355    </target>
356
357    <target name="Configuring Administration Pages" if="enable.admin.pages">
358        <echo>Enabling Admin Pages</echo>
359        <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
360        <echo>Creating admin and demo users</echo>
361        <adduser txt2db="${installDir}/bin/${shell.name}/txt2db"
362            usersDb="${installDir}/etc/users.gdb"
363            username="admin"
364            password="${admin.password}"
365            groups="administrator,colbuilder,all-collections-editor"
366            comment="created at install time"/>
367        <adduser
368            txt2db="${installDir}/bin/${shell.name}/txt2db"
369            usersDb="${installDir}/etc/users.gdb"
370            username="demo"
371            password="demo"
372            groups="demo"
373            comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
374    </target>
375
376    <target name="Installing Documented Examples">
377        <copy todir="${installDir}/collect">
378            <fileset dir="${orig.dir}/Documented Examples" includes="documented-examples/**/*"/>
379        </copy>
380    </target>
381
382</project>
Note: See TracBrowser for help on using the browser.