source: main/trunk/release-kits/kits/rk3/installer/build.xml@ 29335

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