root/release-kits/wirk3/installer/build.xml @ 17652

Revision 17652, 12.6 KB (checked in by oranfry, 11 years ago)

started source releases

Line 
1<?xml version="1.0"?>
2<!--
3This is the build.xml run by AntInstaller for the installer
4-->
5
6<project name="Installation" default="" basedir="${basedir}">
7
8    <!-- this is required to pick up the properties generated during the install pages -->
9    <property file="${basedir}/ant.install.properties"/>
10
11    <path id="project.classpath">
12        <pathelement path="${antinstaller.jar}"/>
13    </path>
14
15    <!-- custom tasks -->
16    <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
17    <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
18    <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
19    <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
20   
21    <!-- create a local installDir String -->
22    <path id="installDir.path">
23        <pathelement location="${installDir}"/>
24    </path>
25    <property name="installDir.local" refid="installDir.path"/>
26    <pathconvert targetos="unix" property="installDir.unix" refid="installDir.path"/>
27       
28    <!-- load windows properties -->
29    <winprops/>
30
31    <!-- determine if there is an existing installation in the installDir-->
32    <available file="${installDir}\installation.properties" property="is.overinstall"/>
33
34    <target name="Looking For Previous Installation" if="is.overinstall">
35        <property file="${installDir}\installation.properties"/>
36        <delete dir="${installed.startmenu.path}" failonerror="false"/>
37    </target>
38   
39    <target name="Installing Core System">
40
41        <!-- figure out the start menu path  -->
42        <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
43        <path id="startmenu.path.path" path="${startmenu.path}"/>
44        <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
45               
46        <echo>basedir: ${basedir}</echo>
47        <echo>installDir: ${installDir}</echo>
48        <echo>antinstaller.jar: ${antinstaller.jar}</echo>
49        <echo>startmenu.path: ${startmenu.path}</echo>
50       
51        <!-- create the installation directory -->
52        <echo message="Creating Installation directory"/>
53        <mkdir dir="${installDir}"/>
54
55        <!-- extract 7za tool -->
56        <unzip src="${antinstaller.jar}" dest="${basedir}">
57            <patternset><include name="7za.exe"/></patternset>
58        </unzip>
59       
60        <!-- install files -->
61        <echo message="Installing Core Component"/>
62        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
63        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec>
64        <delete file="core.lzma"/>
65        <unzip src="${basedir}/core.comp" dest="${installDir}"/>
66        <delete file="core.comp"/>
67
68        <!-- jre -->
69        <mkdir dir="${installDir}/packages"/>
70        <copy todir="${installDir}/packages/jre" failonerror="false">
71            <fileset dir="../@windows-java.extracted@"/>
72        </copy>
73
74        <!-- change the tomcat ports in build.properties -->
75        <echo message="Changing tomcat ports in build.properties"/>
76        <rsr file="${installDir}/build.properties" pattern="(tomcat.port[=:]).*" replacement="$1${tomcat.port}" />
77        <rsr file="${installDir}/build.properties" pattern="(tomcat.shutdown.port[=:]).*" replacement="$1${tomcat.shutdown.port}" />
78        <echo message="Changing tomcat ports in resources/tomcat/server.xml"/>
79        <copy file="${installDir}/resources/tomcat/server.xml" tofile="${installDir.local}/packages/tomcat/conf/server.xml" overwrite="true"/>
80       
81        <!-- set gsdlhome in gs2build setup.bat -->
82        <echo message="Setting %GSDLHOME% in gs2build\setup.bat"/>
83        <rsr file="${installDir}/gs2build/setup.bat" pattern="\*\*GSDLHOME\*\*" replacement="${installDir.local}\gs2build" />
84        <!-- copy the greenstone3.xml file to tomcat -->
85        <echo message="Copying greenstone3.xml to tomcat directory"/>
86        <copy file="${installDir}/resources/tomcat/greenstone3.xml" tofile="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true"/>
87        <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@gsdl3webhome@" replacement="${installDir.local}\web" />
88
89        <!-- set up global properties -->
90        <echo message="Setting up global properties"/>
91        <copy file="${installDir}/resources/java/global.properties.in" tofile="${installDir}/web/WEB-INF/classes/global.properties" overwrite="true"/>
92        <rsr file="${installDir}/web/WEB-INF/classes/global.properties">
93            <job pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
94            <job pattern="@tomcat.server@" replacement="${tomcat.server}" />
95            <job pattern="@tomcat.port@" replacement="${tomcat.port}" />
96        </rsr>
97
98        <!-- set up log4j properties-->
99        <echo message="Setting up log4j properties"/>
100        <copy file="${installDir}/resources/java/log4j.properties.in" tofile="${installDir}/web/WEB-INF/classes/log4j.properties" overwrite="true"/>
101        <rsr file="${installDir}/web/WEB-INF/classes/log4j.properties" pattern="@gsdl3home@" replacement="${installDir.unix}/web"/>
102
103        <echo message="Creating installation properties file"/>
104        <echo file="${installDir}\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
105       
106    </target>
107
108    <target name="Installing Core System">
109
110        <!-- figure out the start menu path -->
111        <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
112        <path id="startmenu.path.path" path="${startmenu.path}"/>
113        <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
114               
115        <echo>basedir: ${basedir}</echo>
116        <echo>installDir: ${installDir}</echo>
117        <echo>antinstaller.jar: ${antinstaller.jar}</echo>
118        <echo>startmenu.path: ${startmenu.path}</echo>
119       
120        <!-- create the installation directory -->
121        <echo message="Creating Installation directory"/>
122        <mkdir dir="${installDir}"/>
123
124        <!-- extract 7za tool -->
125        <unzip src="${antinstaller.jar}" dest="${basedir}">
126            <patternset><include name="7za.exe"/></patternset>
127        </unzip>
128       
129        <!-- install files -->
130        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="sourcecode-core.lzma"/></patternset></unzip>
131        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x sourcecode-core.lzma"/></exec>
132        <delete file="sourcecode-core.lzma"/>
133        <unzip src="${basedir}/sourcecode-core.comp" dest="${installDir}"/>
134        <delete file="sourcecode-core.comp"/>
135
136        <!-- change the tomcat ports in build.properties -->
137        <echo message="Changing tomcat ports in build.properties"/>
138        <rsr file="${installDir}/build.properties" pattern="(tomcat.port[=:]).*" replacement="$1${tomcat.port}" />
139        <rsr file="${installDir}/build.properties" pattern="(tomcat.shutdown.port[=:]).*" replacement="$1${tomcat.shutdown.port}" />
140        <echo message="Changing tomcat ports in resources/tomcat/server.xml"/>
141        <copy file="${installDir}/resources/tomcat/server.xml" tofile="${installDir.local}/packages/tomcat/conf/server.xml" overwrite="true"/>
142       
143        <!-- set gsdlhome in gs2build setup.bat -->
144        <echo message="Setting %GSDLHOME% in gs2build\setup.bat"/>
145        <rsr file="${installDir}/gs2build/setup.bat" pattern="\*\*GSDLHOME\*\*" replacement="${installDir.local}\gs2build" />
146        <!-- copy the greenstone3.xml file to tomcat -->
147        <echo message="Copying greenstone3.xml to tomcat directory"/>
148        <copy file="${installDir}/resources/tomcat/greenstone3.xml" tofile="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true"/>
149        <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@gsdl3webhome@" replacement="${installDir.local}\web" />
150
151        <!-- set up global properties -->
152        <echo message="Setting up global properties"/>
153        <copy file="${installDir}/resources/java/global.properties.in" tofile="${installDir}/web/WEB-INF/classes/global.properties" overwrite="true"/>
154        <rsr file="${installDir}/web/WEB-INF/classes/global.properties">
155            <job pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
156            <job pattern="@tomcat.server@" replacement="${tomcat.server}" />
157            <job pattern="@tomcat.port@" replacement="${tomcat.port}" />
158        </rsr>
159
160        <!-- set up log4j properties-->
161        <echo message="Setting up log4j properties"/>
162        <copy file="${installDir}/resources/java/log4j.properties.in" tofile="${installDir}/web/WEB-INF/classes/log4j.properties" overwrite="true"/>
163        <rsr file="${installDir}/web/WEB-INF/classes/log4j.properties" pattern="@gsdl3home@" replacement="${installDir.unix}/web"/>
164
165        <!-- delete unneeded files -->     
166        <delete dir="${installDir}/resources/icons"/>
167        <delete file="${installDir}/resources/*.png"/>
168       
169        <echo message="Creating installation properties file"/>
170        <echo file="${installDir}\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
171       
172    </target>
173
174
175    <!-- Source -->
176    <target name="Installing Source Code">
177        <echo message="Installing Source Code (src)"/>
178        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="sourcecode.lzma"/></patternset></unzip>
179        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x sourcecode.lzma"/></exec>
180        <delete file="sourcecode.lzma"/>
181        <unzip src="${basedir}/sourcecode.comp" dest="${installDir}"/>
182        <delete file="sourcecode.comp"/>
183    </target>
184
185    <target name="Installing Tomcat">
186       
187        <echo message="Installing Apache Tomcat"/>
188        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="tomcat.lzma"/></patternset></unzip>
189        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x tomcat.lzma"/></exec>
190        <delete file="tomcat.lzma"/>
191        <unzip src="${basedir}/tomcat.comp" dest="${installDir}/packages"/>
192        <delete file="tomcat.comp"/>
193       
194        <!-- change the tomcat ports in tomcats server.xml -->
195        <rsr file="${installDir}/packages/tomcat/conf/server.xml" pattern="@server@" replacement="${tomcat.server}" />
196        <rsr file="${installDir}/packages/tomcat/conf/server.xml" pattern="@port@" replacement="${tomcat.port}" />
197        <rsr file="${installDir}/packages/tomcat/conf/server.xml" pattern="@shutdown-port@" replacement="${tomcat.shutdown.port}" />
198
199    </target>
200
201    <target name="Installing Ant">
202        <echo message="Installing Apache Ant"/>
203        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ant.lzma"/></patternset></unzip>
204        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ant.lzma"/></exec>
205        <delete file="ant.lzma"/>
206        <unzip src="${basedir}/ant.comp" dest="${installDir}/packages"/>
207        <delete file="ant.comp"/>
208    </target>
209
210    <target name="Installing ImageMagick">
211        <echo message="Installing ImageMagick"/>
212        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
213        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec>
214        <delete file="imagemagick.lzma"/>
215        <unzip src="${basedir}/imagemagick.comp" dest="${installDir}/gs2build/bin/windows"/>
216        <delete file="imagemagick.comp"/>
217    </target>
218
219    <target name="Installing Ghostscript">
220        <echo message="Installing GhostScript"/>
221        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
222        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec>
223        <delete file="ghostscript.lzma"/>
224        <unzip src="${basedir}/ghostscript.comp" dest="${installDir}/gs2build/bin/windows"/>
225        <delete file="ghostscript.comp"/>
226    </target>
227   
228    <target name="Installing Start Menu Shortcuts">
229
230        <mkdir dir="${startmenu.path}\Documentation"/>
231       
232        <shortcut
233            file="${startmenu.path}\Greenstone3 Server.lnk"
234            execute="${installDir}\gs3-server.bat"
235            workingDirectory="${installDir}"
236            iconFile="${installDir}\resources\images\gs3.ico"
237            iconIndex="0" />
238
239        <shortcut
240            file="${startmenu.path}\Greenstone Librarian Interface (GLI).lnk"
241            execute="${installDir}\gli\gli.bat"
242            workingDirectory="${installDir}\gli"
243            iconFile="${installDir}\resources\images\gs3.ico"
244            iconIndex="0" />
245           
246        <shortcut
247            file="${startmenu.path}\Greenstone Editor for Metadata Sets (GEMS).lnk"
248            execute="${installDir}\gli\gems.bat"
249            workingDirectory="${installDir}\gli"
250            iconFile="${installDir}\resources\images\gs3.ico"
251            iconIndex="0" />
252
253        <shortcut
254            file="${startmenu.path}\Uninstall.lnk"
255            execute="${installDir}\Uninstall.bat"
256            workingDirectory="${installDir}"
257            iconFile="${installDir}\resources\images\gs3.ico"
258            iconIndex="0" />
259   
260        <shortcut
261            file="${startmenu.path}\Documentation\README.lnk"
262            execute="${installDir}\README.txt" />
263       
264        <shortcut
265            file="${startmenu.path}\Documentation\Greenstone3 Users' Guide.lnk"
266            execute="${installDir}\documentation\manual\manual.pdf" />
267       
268        <shortcut
269            file="${startmenu.path}\Documentation\Greenstone2 Users' Guide.lnk"
270            execute="${installDir}\documentation\manual\gs2_user_en.pdf" />
271       
272    </target>
273   
274</project>
Note: See TracBrowser for help on using the browser.