root/release-kits/shared/greenstone3/installer/build.xml @ 19955

Revision 19955, 10.4 KB (checked in by oranfry, 11 years ago)

corrected slash direction in some config tweaks

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