source: main/trunk/release-kits/kits/rk2/installer/build.xml@ 21885

Last change on this file since 21885 was 21885, checked in by ak19, 14 years ago

GSDLHOME in gsdlsite.cfg only to be embedded in quotes there are spaces in the filepath.

File size: 11.8 KB
Line 
1<?xml version="1.0"?>
2<!--
3This is the build.xml run by AntInstaller for the installer
4-->
5
6<project name="Installation">
7
8 <!-- this is required to pick up the properties generated during the install pages -->
9 <property file="${basedir}/ant.install.properties"/>
10
11 <!-- set some properties to keep track of the OS -->
12 <!-- if windows -->
13 <property name="rk.os" value="windows"/>
14 <property name="shell.name" value="windows"/>
15 <!-- /if -->
16 <!-- if linux -->
17 <property name="rk.os" value="linux"/>
18 <property name="shell.name" value="linux"/>
19 <!-- /if -->
20 <!-- if mac -->
21 <property name="rk.os" value="mac"/>
22 <property name="shell.name" value="darwin"/>
23 <!-- /if -->
24
25 <!-- classpath -->
26 <path id="project.classpath">
27 <pathelement path="${antinstaller.jar}"/>
28 </path>
29
30 <!-- custom tasks -->
31 <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
32 <typedef name="adduser" classname="org.greenstone.anttasks.AddGreenstoneUserToDatabase" classpathref="project.classpath"/>
33 <!-- if windows -->
34 <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
35 <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
36 <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
37 <!-- /if -->
38 <!-- if linux|mac -->
39 <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
40 <!-- /if -->
41
42 <!-- determine if a bundled java exists -->
43 <condition property="bundled.java.exists">
44 <or>
45 <available file="../@java.extracted@/bin/java"/>
46 <available file="../@java.extracted@/bin/java.exe"/>
47 </or>
48 </condition>
49
50 <!-- determine if there is an existing installation in the installDir-->
51 <available file="${installDir}\etc\installation.properties" property="is.overinstall"/>
52
53 <!-- create a local installDir String -->
54 <path id="installDir.path"><pathelement location="${installDir}"/></path>
55 <property name="installDir.local" refid="installDir.path"/>
56
57 <!-- if windows -->
58 <!-- load windows properties -->
59 <winprops/>
60 <!-- /if -->
61
62 <!-- load the properties of the previous installation if this is an overinstall -->
63 <target name="Looking For Previous Installation" if="is.overinstall">
64 <property file="${installDir}\etc\installation.properties"/>
65 <delete dir="${installed.startmenu.path}" failonerror="false"/>
66 </target>
67
68 <!-- copy jre -->
69 <target name="Initialising" if="bundled.java.exists">
70 <mkdir dir="${installDir}/packages"/>
71 <copy todir="${installDir}/packages/jre" failonerror="false">
72 <fileset dir="../@java.extracted@"/>
73 </copy>
74 <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>
75 </target>
76
77 <!-- core system -->
78 <target name="Installing Core System">
79
80 <!-- if windows -->
81 <!-- figure out the start menu path -->
82 <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
83 <path id="startmenu.path.path" path="${startmenu.path}"/>
84 <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
85
86 <!-- extract 7za tool -->
87 <unzip src="${antinstaller.jar}" dest="${basedir}">
88 <patternset><include name="7za.exe"/></patternset>
89 </unzip>
90 <!-- /if -->
91
92 <!-- start web -->
93 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
94 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/core.lzma" output="${basedir}/core.comp"/><!-- /if -->
95 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec><!-- /if -->
96 <delete file="core.lzma"/>
97 <unzip src="${basedir}/core.comp" dest="${installDir}"/>
98 <delete file="core.comp"/>
99 <!-- end web -->
100
101 <!-- start cdrom -->
102 <copy todir="${installDir}">
103 <fileset dir="${orig.dir}/Software/core/all"/>
104 <fileset dir="${orig.dir}/Software/core/${rk.os}"/><!-- /if -->
105 </copy>
106 <!-- if windows -->
107 <copy todir="${installDir}/packages/jre" failonerror="false">
108 <fileset dir="${orig.dir}/Java/Windows/jre"/>
109 </copy>
110 <!-- /if -->
111 <!-- end cdrom -->
112
113 <echo>Setting Binaries to Executable</echo>
114 <chmod dir="${installDir}" includes="*.sh,*.bash" perm="775"/>
115 <chmod dir="${installDir}/bin" includes="*" perm="775"/>
116 <chmod dir="${installDir}/cgi-bin" includes="*" perm="775"/>
117 <chmod dir="${installDir}/bin/script" includes="**/*" perm="775"/>
118 <chmod dir="${installDir}/gli" includes="*.sh" perm="775"/>
119 <!-- if linux|mac -->
120 <chmod dir="${installDir}/bin/${shell.name}" includes="**/*" perm="775"/>
121 <chmod dir="${installDir}/apache-httpd/${shell.name}/bin" includes="*" perm="775"/>
122 <chmod dir="${installDir}/apache-httpd/${shell.name}" includes="*.sh" perm="775"/>
123 <!-- /if -->
124
125 <echo>Filling in concrete values in config files</echo>
126 <copy file="${installDir}/cgi-bin/gsdlsite.cfg.in" tofile="${installDir}/cgi-bin/gsdlsite.cfg"/>
127 <!-- spaces around GSDLHOME filepath only if needed -->
128 <if><bool><contains string="${installDir.local}" substring=" "/></bool>
129 <rsr file="${installDir}/cgi-bin/gsdlsite.cfg" pattern="&quot;?\*\*GSDLHOME\*\*&quot;?" replacement="&quot;${installDir.local}&quot;"/>
130 <else>
131 <rsr file="${installDir}/cgi-bin/gsdlsite.cfg" pattern="&quot;?\*\*GSDLHOME\*\*&quot;?" replacement="${installDir.local}"/>
132 </else>
133 </if>
134
135 <echo>Correcting perl shebangs in perl scripts</echo>
136 <!-- if linux|mac -->
137 <exec executable="which" outputproperty="perl.executable"><arg value="perl"/></exec>
138 <rsr file="${installDir}/cgi-bin/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
139 <!-- /if -->
140 <!-- if windows -->
141 <property name="perl.executable" value="${installDir.local}\bin\windows\perl\bin\perl.exe"/>
142 <rsr file="${installDir}/cgi-bin/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
143 <!-- /if -->
144
145 <echo>Creating the english dictionary</echo>
146 <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
147
148 <!-- if linux|mac -->
149 <echo>Set the installation locale in config files</echo>
150 <rsr file="${installDir}/setup.bash" pattern="^gsdllang=.*" replacement="gsdllang=${language}"/>
151 <rsr file="${installDir}/gli/gli.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
152 <rsr file="${installDir}/gli/gems.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
153 <!-- /if -->
154 <rsr
155 file="${installDir}/gli/classes/xml/config.xml"
156 pattern="(&lt;Argument name=&quot;general.locale&quot;&gt;).*(&lt;/Argument&gt;)"
157 replacement="$1${language}$2"/>
158
159 <echo file="${installDir}/etc/main.cfg" append="true"
160 >cgiarg shortname=l argdefault=${language}</echo>
161
162 <!-- if linux|mac -->
163 <echo>Setting up apache web server</echo>
164 <exec dir="${installDir}" executable="${installDir}/apache-httpd/${shell.name}/install-bindist.sh">
165 <arg value="${installDir}/apache-httpd/${shell.name}"/>
166 </exec>
167 <!-- /if -->
168
169 <echo message="Creating installation properties file"/>
170 <!-- if linux|mac -->
171 <echo file="${installDir}/etc/installation.properties">#this file is just a placeholder for now</echo>
172 <!-- /if -->
173 <!-- if windows -->
174 <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
175 <!-- /if -->
176
177 </target>
178
179 <!-- ImageMagick -->
180 <target name="Installing ImageMagick">
181 <echo>Installing ImageMagick</echo>
182 <!-- start web -->
183 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
184 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
185 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
186 <delete file="imagemagick.lzma"/>
187 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
188 <delete file="imagemagick.comp"/>
189 <!-- end web -->
190
191 <!-- start cdrom -->
192 <copy todir="${installDir}/bin/${shell.name}">
193 <fileset dir="${orig.dir}/Software/imagemagick/${rk.os}"/>
194 </copy>
195 <!-- end cdrom -->
196
197 <chmod dir="${installDir}/bin/${shell.name}/imagemagick/bin" includes="*" perm="775"/>
198
199 </target>
200
201 <!-- Ghostscript -->
202 <target name="Installing Ghostscript" depends="">
203 <echo message="Installing Ghostscript"/>
204 <!-- start web -->
205 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
206 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
207 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
208 <delete file="ghostscript.lzma"/>
209 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}" />
210 <delete file="ghostscript.comp"/>
211 <!-- end web -->
212
213 <!-- start cdrom -->
214 <copy todir="${installDir}/bin/${shell.name}">
215 <fileset dir="${orig.dir}/Software/ghostscript/${rk.os}"/>
216 </copy>
217 <!-- end cdrom -->
218
219 <chmod dir="${installDir}/bin/${shell.name}/ghostscript/bin" includes="*" perm="775"/>
220 </target>
221
222 <!-- Start menu shortcuts -->
223 <target name="Installing Start Menu Shortcuts">
224
225 <mkdir dir="${startmenu.path}\Documentation"/>
226
227 <shortcut
228 file="${startmenu.path}\Greenstone Server.lnk"
229 execute="${installDir}\server.exe"
230 workingDirectory="${installDir}"
231 iconFile="${installDir}\web\images\server.ico"
232 iconIndex="0" />
233
234 <shortcut
235 file="${startmenu.path}\Librarian Interface (GLI).lnk"
236 execute="${installDir}\gli\gli.bat"
237 workingDirectory="${installDir}\gli"
238 iconFile="${installDir}\web\images\librarian.ico"
239 iconIndex="0" />
240
241 <shortcut
242 file="${startmenu.path}\Librarian Interface for Remote Server (Client GLI).lnk"
243 execute="${installDir}\gli\client-gli.bat"
244 workingDirectory="${installDir}\gli"
245 iconFile="${installDir}\web\images\librarian.ico"
246 iconIndex="0" />
247
248 <shortcut
249 file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
250 execute="${installDir}\gli\gems.bat"
251 workingDirectory="${installDir}\gli"
252 iconFile="${installDir}\web\images\metadata.ico"
253 iconIndex="0" />
254
255 <shortcut
256 file="${startmenu.path}\Uninstall.lnk"
257 execute="${installDir}\Uninstall.bat"
258 workingDirectory="${installDir}"
259 iconFile="${installDir}\web\images\uninstall.ico"
260 iconIndex="0" />
261
262 <shortcut
263 file="${startmenu.path}\Documentation\READMEen.lnk"
264 execute="${installDir}\READMEen.txt" />
265
266 <shortcut
267 file="${startmenu.path}\Documentation\Greenstone Wiki.url"
268 url="http://wiki.greenstone.org" />
269
270 <shortcut
271 file="${startmenu.path}\Documentation\Greenstone Website.url"
272 url="http://www.greenstone.org" />
273
274 </target>
275
276 <target name="Configuring Administration Pages" if="enable.admin.pages">
277 <echo>Enabling Admin Pages</echo>
278 <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
279 <echo>Creating admin and demo users</echo>
280 <adduser txt2db="${installDir}/bin/${shell.name}/txt2db"
281 usersDb="${installDir}/etc/users.gdb"
282 username="admin"
283 password="${admin.password}"
284 groups="administrator,colbuilder,all-collections-editor"
285 comment="created at install time"/>
286 <adduser
287 txt2db="${installDir}/bin/${shell.name}/txt2db"
288 usersDb="${installDir}/etc/users.gdb"
289 username="demo"
290 password="demo"
291 groups="demo"
292 comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
293 </target>
294
295 <target name="Installing Documented Examples">
296 <copy todir="${installDir}/collect">
297 <fileset dir="${orig.dir}/Documented Examples" includes="documented-examples/**/*"/>
298 </copy>
299 </target>
300
301</project>
Note: See TracBrowser for help on using the repository browser.