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

Last change on this file since 27335 was 27335, checked in by kjdon, 11 years ago

Attempting to get perl shebangs right for cgi scripts in GS3 (in web/WEB-INF/cgi) during GS3 installation. Need to still test the GS3 binary that gets generated thus, especially windows, where the shebangs are currently wrong.

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