root/main/trunk/release-kits/kits/rk3/installer/build.xml @ 32975

Revision 32975, 18.8 KB (checked in by sjm84, 10 months ago)

Related to commit 32971. No longer grabbing prebuilt 32 bit wvWare. We now use the one release-kit was already locally building, now that the libpng dependency is resolved. So 64 bit wvWare binary on 64 bit linux and 32 bit on 32 bit linux.

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        <delete dir="${installDir}/gs3-server.app"/>
179        <delete dir="${installDir}/gli.app"/>
180        <delete dir="${installDir}/client-gli.app"/>
181        <delete dir="${installDir}/gems.app"/>
182        <!-- /if -->       
183       
184        <!-- if mac -->
185        <echo>Installing Mac Shortcuts</echo>
186        <ant dir="${installDir}" antfile="build.xml" target="gen-mac-shortcuts" inheritAll="false" />
187        <!-- need to give executable permissions to the Mac shortcuts -->
188        <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-->
189        <chmod file="${installDir}/gli.app/Contents/MacOS/gli" perm="775"/>
190        <chmod file="${installDir}/client-gli.app/Contents/MacOS/client-gli" perm="775"/>
191        <chmod file="${installDir}/gems.app/Contents/MacOS/gems" perm="775"/>
192
193        <!--<chmod dir="${installDir}" includes="*.app" perm="755"/>
194        <chmod dir="${installDir}" includes="*.app/**/*" perm="755"/>-->
195
196        <!-- /if -->
197
198        <!-- GLI START -->
199        <echo>Creating the english dictionary</echo>
200        <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
201        <!-- GLI END -->
202
203        <echo>Creating usage.txt</echo>
204        <echo file="${installDir}/gs2build/etc/usage.txt"></echo>
205
206        <echo>Creating installation properties file</echo>
207        <echo file="${installDir}\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
208
209        <echo>Finished</echo>
210
211    </target>
212
213    <!-- Dummy target to redirect display of subtargets resulting from ant calls to the gen-mac-shortcuts
214         and set-perl-shebangs to this dummy target instead of to the Installing ImageMagick target below -->
215    <target name="Adjusting Permissions" />
216   
217    <target name="Installing ImageMagick">
218
219        <echo>Installing ImageMagick</echo>
220        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
221        <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
222        <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
223        <delete file="imagemagick.lzma"/>
224        <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
225        <delete file="imagemagick.comp"/>
226
227        <echo>Setting binaries to executable</echo>
228        <!-- if linux -->
229        <chmod dir="${installDir}/gs2build/bin/linux/imagemagick/bin" includes="*" perm="775"/>
230        <!-- /if -->
231        <!-- if mac -->
232        <chmod dir="${installDir}/gs2build/bin/darwin/imagemagick/bin" includes="*" perm="775"/>
233        <!-- /if -->
234
235    </target>
236
237    <!-- NO FLAX START -->
238
239    <target name="Installing Ghostscript">
240
241        <echo>Installing Ghostscript</echo>
242        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
243        <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
244        <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
245        <delete file="ghostscript.lzma"/>
246        <unzip src="${basedir}/ghostscript.comp" dest="${installDir}"/>
247        <delete file="ghostscript.comp"/>
248
249        <echo>Setting binaries to executable</echo>
250        <!-- if linux -->
251        <chmod dir="${installDir}/gs2build/bin/linux/ghostscript/bin" includes="*" perm="775"/>
252        <!-- /if -->
253        <!-- if mac -->
254        <chmod dir="${installDir}/gs2build/bin/darwin/ghostscript/bin" includes="*" perm="775"/>
255        <!-- /if -->
256
257    </target>
258
259    <!-- NO FLAX END -->
260
261    <!-- start amp -->
262
263    <target name="Installing AMP">
264      <echo>Installing Apache, MySQL and PHP</echo>
265      <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="amp.lzma"/></patternset></unzip>
266      <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x amp.lzma"/></exec><!-- /if -->
267      <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/amp.lzma" output="${basedir}/amp.comp"/><!-- /if -->
268      <delete file="amp.lzma"/>
269      <unzip src="${basedir}/amp.comp" dest="${installDir}/ext/amp"/>
270      <delete file="amp.comp"/>
271     
272      <!-- if linux|mac -->
273      <echo>Setting binaries to executable</echo>
274      <chmod dir="${installDir}/ext/amp" includes="*" perm="775"/>
275      <!-- /if -->
276    </target>
277
278    <!-- end amp -->
279
280    <target name="Installing Tomcat">
281
282        <echo>Installing Tomcat (packages/tomcat)</echo>
283        <mkdir dir="packages"/>
284        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="tomcat.lzma"/></patternset></unzip>
285        <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x tomcat.lzma"/></exec><!-- /if -->
286        <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/tomcat.lzma" output="${basedir}/tomcat.comp"/><!-- /if -->
287        <delete file="tomcat.lzma"/>
288        <unzip src="${basedir}/tomcat.comp" dest="${installDir}"/>
289        <delete file="tomcat.comp"/>
290
291
292        <echo>Changing tomcat ports tomcat's server.xml</echo>
293        <copy file="${installDir}/resources/tomcat/server_tomcat8.xml.in" tofile="${installDir}/packages/tomcat/conf/server.xml" overwrite="true"/>
294        <rsr file="${installDir}/packages/tomcat/conf/server.xml">
295            <job pattern="@port@" replacement="${tomcat.port}"/>
296            <job pattern="@shutdown-port@" replacement="${tomcat.shutdown.port}"/>
297        </rsr>
298
299        <echo>Copying greenstone3.xml to tomcat directory</echo>
300        <copy file="${installDir}/resources/tomcat/greenstone3.xml.in" tofile="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true"/>
301        <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@gsdl3webhome@" replacement="${installDir.local}${file.separator}web" />
302        <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@privilegedattribute@" replacement="privileged='true'" />
303
304        <!-- FLAX START -->
305        <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="localsite" replacement="flax" />
306        <!-- FLAX END -->
307
308        <echo>Set binaries to executable</echo>
309        <chmod dir="${installDir}/packages/tomcat/bin" includes="*.sh" perm="775"/>
310
311    </target>
312
313    <target name="Installing Start Menu Shortcuts">
314
315        <echo>Installing Start Menu Shortcuts</echo>
316
317        <!-- NO FLAX START -->
318
319        <mkdir dir="${startmenu.path}\Documentation"/>
320
321        <shortcut
322            file="${startmenu.path}\Greenstone3 Server.lnk"
323            execute="${installDir}\gs3-server.bat"
324            workingDirectory="${installDir}"
325            iconFile="${installDir}\resources\images\server.ico"
326            iconIndex="0" />
327
328        <shortcut
329            file="${startmenu.path}\Greenstone Librarian Interface (GLI).lnk"
330            execute="${installDir}\gli\gli.bat"
331            workingDirectory="${installDir}\gli"
332            iconFile="${installDir}\resources\images\librarian.ico"
333            iconIndex="0" />
334
335        <shortcut
336            file="${startmenu.path}\Remote Greenstone Librarian Interface (Client GLI).lnk"
337            execute="${installDir}\gli\client-gli.bat"
338            workingDirectory="${installDir}\gli"
339            iconFile="${installDir}\resources\images\clientgli.ico"
340            iconIndex="0" />
341           
342        <shortcut
343            file="${startmenu.path}\Greenstone Editor for Metadata Sets (GEMS).lnk"
344            execute="${installDir}\gli\gems.bat"
345            workingDirectory="${installDir}\gli"
346            iconFile="${installDir}\resources\images\metadata.ico"
347            iconIndex="0" />
348
349        <shortcut
350            file="${startmenu.path}\Uninstall.lnk"
351            execute="${installDir}\uninstall\Uninstall.bat"
352            workingDirectory="${installDir}"
353            iconFile="${installDir}\resources\images\uninstall.ico"
354            iconIndex="0" />
355   
356        <shortcut
357            file="${startmenu.path}\Documentation\README.lnk"
358            execute="${installDir}\README.txt" />
359       
360        <shortcut
361            file="${startmenu.path}\Documentation\Greenstone3 Users' Guide.lnk"
362            execute="${installDir}\documentation\manual\manual.pdf" />
363       
364        <shortcut
365            file="${startmenu.path}\Documentation\Greenstone2 Users' Guide.lnk"
366            execute="${installDir}\documentation\manual\gs2_user_en.pdf" />
367
368        <shortcut
369            file="${startmenu.path}\Documentation\Greenstone Wiki.url"
370            url="http://wiki.greenstone.org" />
371
372        <shortcut
373            file="${startmenu.path}\Documentation\Greenstone Website.url"
374            url="http://www.greenstone.org" />
375       
376        <!-- NO FLAX END -->
377
378        <!-- FLAX START -->
379
380        <shortcut
381            file="${startmenu.path}\Start FLAX Server.lnk"
382            execute="${installDir}\gs3-server.bat"
383            workingDirectory="${installDir}"
384            iconFile="${installDir}\resources\images\server.ico"
385            iconIndex="0" />
386
387        <shortcut
388            file="${startmenu.path}\Uninstall.lnk"
389            execute="${installDir}\uninstall\Uninstall.bat"
390            workingDirectory="${installDir}"
391            iconFile="${installDir}\resources\images\uninstall.ico"
392            iconIndex="0" />
393
394        <!-- FLAX END -->
395    </target>
396   
397    <target name="Configuring Administration Pages" if="set.admin.pwd">
398        <echo>Enabling Admin Pages</echo>
399        <rsr file="${installDir}/web/sites/localsite/siteConfig.xml" pattern="&lt;!--&lt;serviceRack name='Authentication'/&gt;--&gt;" replacement="&lt;serviceRack name='Authentication'/&gt;"/>
400        <echo>Creating admin user</echo>
401        <!--<echo>Creating admin and demo users</echo>-->
402        <ant dir="${installDir}" antfile="build.xml" target="config-admin" inheritAll="false">
403          <property name="admin.password" value="${admin.password}"/>         
404        </ant>
405        <!--<adduser txt2db="org.greenstone.gsdl3.util.ChangePwdUsersDB"
406            usersDb="${installDir}/web/sites/localsite/etc/usersDB"
407            username="admin"
408            password="${admin.password}"
409            groups="administrator,colbuilder,all-collections-editor"
410            comment="created at install time"
411            email=""/>
412        <adduser
413            txt2db="org.greenstone.gsdl3.util.ChangePwdUsersDB"
414            usersDb="${installDir}/web/sites/localsite/etc/usersDB"
415            username="demo"
416            password="demo"
417            groups="demo"
418            comment="Dummy 'demo' user with password 'demo' for authen-e collection"
419            email=""/>-->
420    </target>
421   
422    <!-- util target to extract the given component -->
423    <!-- pass in ${component.name} as a param -->
424    <!-- unused at this time as causes display errors in installer gui!
425    <target name="extract-component">
426        <!- - extract the component into place - ->
427        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="${component.name}.lzma"/></patternset></unzip>
428        <!- - if windows - ->
429        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ${component.name}.lzma"/></exec>
430        <!- - /if - ->
431        <!- - if linux|mac - ->
432        <sevenzip task="decode" input="${basedir}/${component.name}.lzma" output="${basedir}/${component.name}.comp"/>
433        <!- - /if - ->
434        <delete file="${component.name}.lzma"/>
435        <unzip src="${basedir}/${component.name}.comp" dest="${installDir}"/>
436        <delete file="${component.name}.comp"/>
437    </target>
438    -->
439
440</project>
Note: See TracBrowser for help on using the browser.