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

Revision 30138, 18.3 KB (checked in by sjm84, 4 years ago)

Important correction to typo in command that targets linux machines.

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