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

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

gsdlsite.cfg can always have quotes inserted to sandwich the value for GSDLHOME. It is setup.bat where the GSDLHOME must be inserted without quotes.

File size: 11.5 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 <rsr file="${installDir}/cgi-bin/gsdlsite.cfg" pattern="&quot;?\*\*GSDLHOME\*\*&quot;?" replacement="&quot;${installDir.local}&quot;"/>
129
130 <echo>Correcting perl shebangs in perl scripts</echo>
131 <!-- if linux|mac -->
132 <exec executable="which" outputproperty="perl.executable"><arg value="perl"/></exec>
133 <rsr file="${installDir}/cgi-bin/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
134 <!-- /if -->
135 <!-- if windows -->
136 <property name="perl.executable" value="${installDir.local}\bin\windows\perl\bin\perl.exe"/>
137 <rsr file="${installDir}/cgi-bin/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
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 <!-- if linux|mac -->
144 <echo>Set the installation locale in config files</echo>
145 <rsr file="${installDir}/setup.bash" pattern="^gsdllang=.*" replacement="gsdllang=${language}"/>
146 <rsr file="${installDir}/gli/gli.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
147 <rsr file="${installDir}/gli/gems.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
148 <!-- /if -->
149 <rsr
150 file="${installDir}/gli/classes/xml/config.xml"
151 pattern="(&lt;Argument name=&quot;general.locale&quot;&gt;).*(&lt;/Argument&gt;)"
152 replacement="$1${language}$2"/>
153
154 <echo file="${installDir}/etc/main.cfg" append="true"
155 >cgiarg shortname=l argdefault=${language}</echo>
156
157 <!-- if linux|mac -->
158 <echo>Setting up apache web server</echo>
159 <exec dir="${installDir}" executable="${installDir}/apache-httpd/${shell.name}/install-bindist.sh">
160 <arg value="${installDir}/apache-httpd/${shell.name}"/>
161 </exec>
162 <!-- /if -->
163
164 <echo message="Creating installation properties file"/>
165 <!-- if linux|mac -->
166 <echo file="${installDir}/etc/installation.properties">#this file is just a placeholder for now</echo>
167 <!-- /if -->
168 <!-- if windows -->
169 <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
170 <!-- /if -->
171
172 </target>
173
174 <!-- ImageMagick -->
175 <target name="Installing ImageMagick">
176 <echo>Installing ImageMagick</echo>
177 <!-- start web -->
178 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
179 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/><!-- /if -->
180 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec><!-- /if -->
181 <delete file="imagemagick.lzma"/>
182 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}"/>
183 <delete file="imagemagick.comp"/>
184 <!-- end web -->
185
186 <!-- start cdrom -->
187 <copy todir="${installDir}/bin/${shell.name}">
188 <fileset dir="${orig.dir}/Software/imagemagick/${rk.os}"/>
189 </copy>
190 <!-- end cdrom -->
191
192 <chmod dir="${installDir}/bin/${shell.name}/imagemagick/bin" includes="*" perm="775"/>
193
194 </target>
195
196 <!-- Ghostscript -->
197 <target name="Installing Ghostscript" depends="">
198 <echo message="Installing Ghostscript"/>
199 <!-- start web -->
200 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
201 <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/><!-- /if -->
202 <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec><!-- /if -->
203 <delete file="ghostscript.lzma"/>
204 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}" />
205 <delete file="ghostscript.comp"/>
206 <!-- end web -->
207
208 <!-- start cdrom -->
209 <copy todir="${installDir}/bin/${shell.name}">
210 <fileset dir="${orig.dir}/Software/ghostscript/${rk.os}"/>
211 </copy>
212 <!-- end cdrom -->
213
214 <chmod dir="${installDir}/bin/${shell.name}/ghostscript/bin" includes="*" perm="775"/>
215 </target>
216
217 <!-- Start menu shortcuts -->
218 <target name="Installing Start Menu Shortcuts">
219
220 <mkdir dir="${startmenu.path}\Documentation"/>
221
222 <shortcut
223 file="${startmenu.path}\Greenstone Server.lnk"
224 execute="${installDir}\server.exe"
225 workingDirectory="${installDir}"
226 iconFile="${installDir}\web\images\server.ico"
227 iconIndex="0" />
228
229 <shortcut
230 file="${startmenu.path}\Librarian Interface (GLI).lnk"
231 execute="${installDir}\gli\gli.bat"
232 workingDirectory="${installDir}\gli"
233 iconFile="${installDir}\web\images\librarian.ico"
234 iconIndex="0" />
235
236 <shortcut
237 file="${startmenu.path}\Librarian Interface for Remote Server (Client GLI).lnk"
238 execute="${installDir}\gli\client-gli.bat"
239 workingDirectory="${installDir}\gli"
240 iconFile="${installDir}\web\images\librarian.ico"
241 iconIndex="0" />
242
243 <shortcut
244 file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
245 execute="${installDir}\gli\gems.bat"
246 workingDirectory="${installDir}\gli"
247 iconFile="${installDir}\web\images\metadata.ico"
248 iconIndex="0" />
249
250 <shortcut
251 file="${startmenu.path}\Uninstall.lnk"
252 execute="${installDir}\Uninstall.bat"
253 workingDirectory="${installDir}"
254 iconFile="${installDir}\web\images\uninstall.ico"
255 iconIndex="0" />
256
257 <shortcut
258 file="${startmenu.path}\Documentation\READMEen.lnk"
259 execute="${installDir}\READMEen.txt" />
260
261 <shortcut
262 file="${startmenu.path}\Documentation\Greenstone Wiki.url"
263 url="http://wiki.greenstone.org" />
264
265 <shortcut
266 file="${startmenu.path}\Documentation\Greenstone Website.url"
267 url="http://www.greenstone.org" />
268
269 </target>
270
271 <target name="Configuring Administration Pages" if="enable.admin.pages">
272 <echo>Enabling Admin Pages</echo>
273 <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
274 <echo>Creating admin and demo users</echo>
275 <adduser txt2db="${installDir}/bin/${shell.name}/txt2db"
276 usersDb="${installDir}/etc/users.gdb"
277 username="admin"
278 password="${admin.password}"
279 groups="administrator,colbuilder,all-collections-editor"
280 comment="created at install time"/>
281 <adduser
282 txt2db="${installDir}/bin/${shell.name}/txt2db"
283 usersDb="${installDir}/etc/users.gdb"
284 username="demo"
285 password="demo"
286 groups="demo"
287 comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
288 </target>
289
290 <target name="Installing Documented Examples">
291 <copy todir="${installDir}/collect">
292 <fileset dir="${orig.dir}/Documented Examples" includes="documented-examples/**/*"/>
293 </copy>
294 </target>
295
296</project>
Note: See TracBrowser for help on using the repository browser.