source: main/tags/3.04flax1.0/release-kits/shared/greenstone3/installer/build.xml@ 21360

Last change on this file since 21360 was 21360, checked in by xiao, 14 years ago

various modifications specific to FLAX

File size: 11.7 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 <!-- if linux|mac -->
15 <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
16 <!-- /if -->
17 <!-- if windows -->
18 <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
19 <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
20 <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
21 <!-- /if -->
22
23 <!-- create a local and strictly unix installDir String -->
24 <path id="installDir.path"><pathelement location="${installDir}"/></path>
25 <property name="installDir.local" refid="installDir.path"/>
26 <pathconvert targetos="unix" property="installDir.unix" refid="installDir.path"/>
27
28 <!-- if windows -->
29 <!-- load windows properties -->
30 <winprops/>
31 <!-- /if -->
32
33 <!-- work out whether a jre is bundled with this installer -->
34 <available file="../jre/bin" property="bundled.java.exists"/>
35
36 <!-- determine if there is an existing installation in the installDir-->
37 <available file="${installDir}\installation.properties" property="is.overinstall"/>
38
39 <!-- target to copy the bundled jre into place -->
40 <target name="Initialising" if="bundled.java.exists">
41 <mkdir dir="${installDir}"/>
42 <copy todir="${installDir}/packages/jre" failonerror="false">
43 <fileset dir="../jre"/>
44 </copy>
45 <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>
46 </target>
47
48 <!-- target to load in the messages left by the last installation -->
49 <target name="Looking For Previous Installation" if="is.overinstall">
50 <property file="${installDir}\installation.properties"/>
51 <delete dir="${installed.startmenu.path}" failonerror="false"/>
52 </target>
53
54 <target name="Installing Core System">
55
56 <!-- rip out build.xml to the temp dir so we can fake and <antcall> with <ant> -->
57 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="build.xml"/></patternset></unzip>
58
59
60 <!-- if windows -->
61 <echo>Figuring out the start menu path</echo>
62 <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
63 <path id="startmenu.path.path" path="${startmenu.path}"/>
64 <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
65
66 <echo>Extracting 7za tool</echo>
67 <unzip src="${antinstaller.jar}" dest="${basedir}">
68 <patternset><include name="7za.exe"/></patternset>
69 </unzip>
70 <!-- /if -->
71
72 <echo>Extracting core component</echo>
73 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
74 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec><!-- /if -->
75 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/core.lzma" output="${basedir}/core.comp"/><!-- /if -->
76 <delete file="core.lzma"/>
77 <unzip src="${basedir}/core.comp" dest="${installDir}"/>
78 <delete file="core.comp"/>
79
80 <echo>Setting binaries to executable</echo>
81 <chmod dir="${installDir}" includes="*.sh" perm="775"/>
82 <chmod dir="${installDir}/bin/script" includes="*" perm="775"/>
83 <chmod dir="${installDir}/bin" includes="*" perm="775"/>
84 <!-- if linux -->
85 <chmod dir="${installDir}/gs2build/bin/linux" includes="*" perm="775"/>
86 <!-- /if -->
87 <!-- if mac -->
88 <chmod dir="${installDir}/gs2build/bin/darwin" includes="*" perm="775"/>
89 <!-- /if -->
90 <chmod dir="${installDir}/gs2build/bin/script" includes="**/*" perm="775"/>
91 <chmod dir="${installDir}/gli" includes="*.sh" perm="775"/>
92 <chmod file="${installDir}/packages/ant/bin/ant" perm="775"/>
93 <!--
94 source is not included for now
95 <chmod dir="${installDir}/gs2build" includes="**/configure" perm="775"/>
96 <chmod dir="${installDir}/gs2build/common-src/packages/gdbm/gdbm-1.8.3" includes="mkinstalldirs" perm="775"/>
97 <chmod file="${installDir}/src/packages/javagdbm/configure" perm="775"/>
98 -->
99
100 <echo>Setting up server.default.servlet, tomcat.server, and tomcat.port in build.properties</echo>
101 <rsr file="${installDir}/build.properties">
102 <job pattern="(server.default.servlet=).*" replacement="$1/flax" />
103 <job pattern="(tomcat.server[=:]).*" replacement="$1${tomcat.server}" />
104 <job pattern="(tomcat.port[=:]).*" replacement="$1${tomcat.port}" />
105 <job pattern="(tomcat.shutdown.port[=:]).*" replacement="$1${tomcat.shutdown.port}" />
106 </rsr>
107
108 <echo>Setting up global properties</echo>
109 <copy file="${installDir}/resources/java/global.properties.in" tofile="${installDir}/web/WEB-INF/classes/global.properties" overwrite="true"/>
110 <rsr file="${installDir}/web/WEB-INF/classes/global.properties">
111 <job pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
112 <!--This doesn't work - at this point, the pattern doesn't exist any more
113 <job pattern="@tomcat.server@" replacement="${tomcat.server}" />-->
114 <job pattern="^tomcat.server=.*" replacement="tomcat.server=${tomcat.server}" />
115 <job pattern="@tomcat.port@" replacement="${tomcat.port}" />
116 </rsr>
117
118 <echo>Modifying FlaxWebService.wsdl</echo>
119 <!-- Note: can't use the following here because the patterns @flaxpublicserver@:@flaxpublicport@
120 were already replaced with localhost:8080 by the target flax-copy-files during the initial prepare process.
121 Therefore, at this point the patterns don't exist any more.
122 <job pattern="@flaxpublicserver@" replacement="${tomcat.server}" />
123 <job pattern="@flaxpublicport@" replacement="${tomcat.port}" />
124 -->
125 <rsr
126 file="${installDir}/web/FlaxWebService.wsdl"
127 pattern="(&lt;wsdlsoap:address location=&quot;http://).*(/greenstone3/flax/FlaxWebService&quot;/&gt;)"
128 replacement="$1${tomcat.server}:${tomcat.port}$2"
129 />
130
131 <echo>Setting up log4j properties</echo>
132 <copy file="${installDir}/resources/java/log4j.properties.in" tofile="${installDir}/web/WEB-INF/classes/log4j.properties" overwrite="true"/>
133 <rsr file="${installDir}/web/WEB-INF/classes/log4j.properties" pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
134
135 <!-- if windows -->
136 <echo message="Setting GSDLHOME in gs2build\setup.bat"/>
137 <rsr file="${installDir}/gs2build/setup.bat" pattern="\*\*GSDLHOME\*\*" replacement="${installDir.local}\gs2build" />
138 <!-- /if -->
139
140 <echo>Creating the english dictionary</echo>
141 <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
142
143 <echo>Creating usage.txt</echo>
144 <echo file="${installDir}/gs2build/etc/usage.txt"></echo>
145
146 <echo>Creating installation properties file</echo>
147 <echo file="${installDir}\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
148
149 <echo>Finished</echo>
150
151 </target>
152
153 <target name="Installing ImageMagick">
154
155 <echo>Installing ImageMagick</echo>
156 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
157 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
158 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
159 <delete file="imagemagick.lzma"/>
160 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
161 <delete file="imagemagick.comp"/>
162
163 <echo>Setting binaries to executable</echo>
164 <!-- if linux -->
165 <chmod dir="${installDir}/gs2build/bin/linux/imagemagick/bin" includes="*" perm="775"/>
166 <!-- /if -->
167 <!-- if mac -->
168 <chmod dir="${installDir}/gs2build/bin/darwin/imagemagick/bin" includes="*" perm="775"/>
169 <!-- /if -->
170
171 </target>
172
173 <target name="Installing Ghostscript">
174
175 <echo>Installing Ghostscript</echo>
176 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
177 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
178 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
179 <delete file="ghostscript.lzma"/>
180 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}"/>
181 <delete file="ghostscript.comp"/>
182
183 <echo>Setting binaries to executable</echo>
184 <!-- if linux -->
185 <chmod dir="${installDir}/gs2build/bin/linux/ghostscript/bin" includes="*" perm="775"/>
186 <!-- /if -->
187 <!-- if mac -->
188 <chmod dir="${installDir}/gs2build/bin/darwin/ghostscript/bin" includes="*" perm="775"/>
189 <!-- /if -->
190
191 </target>
192
193 <target name="Installing Tomcat">
194
195 <echo>Installing Tomcat (packages/tomcat)</echo>
196 <mkdir dir="packages"/>
197 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="tomcat.lzma"/></patternset></unzip>
198 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x tomcat.lzma"/></exec><!-- /if -->
199 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/tomcat.lzma" output="${basedir}/tomcat.comp"/><!-- /if -->
200 <delete file="tomcat.lzma"/>
201 <unzip src="${basedir}/tomcat.comp" dest="${installDir}"/>
202 <delete file="tomcat.comp"/>
203
204
205 <echo>Changing tomcat ports tomcat's server.xml</echo>
206 <copy file="${installDir}/resources/tomcat/server_tomcat6.xml" tofile="${installDir}/packages/tomcat/conf/server.xml" overwrite="true"/>
207 <rsr file="${installDir}/packages/tomcat/conf/server.xml">
208 <job pattern="@port@" replacement="${tomcat.port}"/>
209 <job pattern="@shutdown-port@" replacement="${tomcat.shutdown.port}"/>
210 </rsr>
211
212 <echo>Copying greenstone3.xml to tomcat directory</echo>
213 <copy file="${installDir}/resources/tomcat/greenstone3.xml" tofile="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true"/>
214 <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@gsdl3webhome@" replacement="${installDir.local}${file.separator}web" />
215
216 <echo>Set binaries to executable</echo>
217 <chmod dir="${installDir}/packages/tomcat/bin" includes="*.sh" perm="775"/>
218
219 </target>
220
221 <target name="Installing Start Menu Shortcuts">
222
223 <echo>Installing Start Menu Shortcuts</echo>
224
225 <shortcut
226 file="${startmenu.path}\Start FLAX Server.lnk"
227 execute="${installDir}\gs3-server.bat"
228 workingDirectory="${installDir}"
229 iconFile="${installDir}\resources\images\serverico.ico"
230 iconIndex="0" />
231
232 <shortcut
233 file="${startmenu.path}\Uninstall FLAX.lnk"
234 execute="${installDir}\Uninstall.bat"
235 workingDirectory="${installDir}"
236 iconFile="${installDir}\resources\images\uninstall.ico"
237 iconIndex="0" />
238
239 </target>
240
241 <!-- util target to extract the given component -->
242 <!-- pass in ${component.name} as a param -->
243 <!-- unused at this time as causes display errors in installer gui!
244 <target name="extract-component">
245 <!- - extract the component into place - ->
246 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="${component.name}.lzma"/></patternset></unzip>
247 <!- - if windows - ->
248 <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ${component.name}.lzma"/></exec>
249 <!- - /if - ->
250 <!- - if linux|mac - ->
251 <sevenzip task="decode" input="${basedir}/${component.name}.lzma" output="${basedir}/${component.name}.comp"/>
252 <!- - /if - ->
253 <delete file="${component.name}.lzma"/>
254 <unzip src="${basedir}/${component.name}.comp" dest="${installDir}"/>
255 <delete file="${component.name}.comp"/>
256 </target>
257 -->
258
259</project>
Note: See TracBrowser for help on using the repository browser.