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

Revision 19964, 10.2 KB (checked in by oranfry, 11 years ago)

don't explicitly exclude sourcecode from core component as it will be excluded anyway, and don't change perms on sourcode as it wont be there

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/java" 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        <ant target="extract-component"><property name="component.name" value="core"/></ant>
74
75        <echo>Setting binaries to executable</echo>
76        <chmod dir="${installDir}" includes="*.sh" perm="775"/>
77        <chmod dir="${installDir}/bin/script" includes="*" perm="775"/>
78        <chmod dir="${installDir}/bin" includes="*" perm="775"/>
79        <!-- if linux -->
80        <chmod dir="${installDir}/gs2build/bin/linux" includes="*" perm="775"/>
81        <!-- /if -->
82        <!-- if mac -->
83        <chmod dir="${installDir}/gs2build/bin/darwin" includes="*" perm="775"/>
84        <!-- /if -->
85        <chmod dir="${installDir}/gs2build/bin/script" includes="**/*" perm="775"/>
86        <chmod dir="${installDir}/gli" includes="*.sh" perm="775"/>
87        <!--
88        source is not included for now
89        <chmod dir="${installDir}/gs2build" includes="**/configure" perm="775"/>
90        <chmod dir="${installDir}/gs2build/common-src/packages/gdbm/gdbm-1.8.3" includes="mkinstalldirs" perm="775"/>
91        <chmod file="${installDir}/src/packages/javagdbm/configure" perm="775"/>
92        -->
93
94        <echo>Setting tomcat ports</echo>
95        <rsr file="${installDir}/build.properties" pattern="(tomcat.port[=:]).*" replacement="$1${tomcat.port}" />
96        <rsr file="${installDir}/build.properties" pattern="(tomcat.shutdown.port[=:]).*" replacement="$1${tomcat.shutdown.port}" />
97
98        <echo>Setting up global properties</echo>
99        <copy file="${installDir}/resources/java/global.properties.in" tofile="${installDir}/web/WEB-INF/classes/global.properties" overwrite="true"/>
100        <rsr file="${installDir}/web/WEB-INF/classes/global.properties">
101            <job pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
102            <job pattern="@tomcat.server@" replacement="${tomcat.server}" />
103            <job pattern="@tomcat.port@" replacement="${tomcat.port}" />
104        </rsr>
105
106        <echo>Setting up log4j properties</echo>
107        <copy file="${installDir}/resources/java/log4j.properties.in" tofile="${installDir}/web/WEB-INF/classes/log4j.properties" overwrite="true"/>
108        <rsr file="${installDir}/web/WEB-INF/classes/log4j.properties" pattern="@gsdl3home@" replacement="${installDir.unix}/web" />
109
110        <!-- if windows -->
111        <echo message="Setting GSDLHOME in gs2build\setup.bat"/>
112        <rsr file="${installDir}/gs2build/setup.bat" pattern="\*\*GSDLHOME\*\*" replacement="${installDir.local}\gs2build" />
113        <!-- /if -->
114
115        <echo>Creating the english dictionary</echo>
116        <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
117
118        <echo>Creating usage.txt</echo>
119        <echo file="${installDir}/gs2build/etc/usage.txt"></echo>
120
121        <echo>Creating installation properties file</echo>
122        <echo file="${installDir}\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
123
124        <echo>Finished</echo>
125
126    </target>
127
128    <target name="Installing ImageMagick">
129
130        <echo>Installing ImageMagick</echo>
131        <ant target="extract-component"><property name="component.name" value="imagemagick"/></ant>
132
133        <echo>Setting binaries to executable</echo>
134        <!-- if linux -->
135        <chmod dir="${installDir}/gs2build/bin/linux/imagemagick/bin" includes="*" perm="775"/>
136        <!-- /if -->
137        <!-- if mac -->
138        <chmod dir="${installDir}/gs2build/bin/darwin/imagemagick/bin" includes="*" perm="775"/>
139        <!-- /if -->
140
141    </target>
142
143    <target name="Installing Ghostscript">
144
145        <echo>Installing Ghostscript</echo>
146        <ant target="extract-component"><property name="component.name" value="ghostscript"/></ant>
147
148        <echo>Setting binaries to executable</echo>
149        <!-- if linux -->
150        <chmod dir="${installDir}/gs2build/bin/linux/ghostscript/bin" includes="*" perm="775"/>
151        <!-- /if -->
152        <!-- if mac -->
153        <chmod dir="${installDir}/gs2build/bin/darwin/ghostscript/bin" includes="*" perm="775"/>
154        <!-- /if -->
155
156    </target>
157
158    <target name="Installing Tomcat">
159
160        <echo>Installing Tomcat (packages/tomcat)</echo>
161        <mkdir dir="packages"/>
162        <ant target="extract-component"><property name="component.name" value="tomcat"/></ant>
163
164        <echo>Changing tomcat ports tomcat's server.xml</echo>
165        <copy file="${installDir}/resources/tomcat/server.xml" tofile="${installDir}/packages/tomcat/conf/server.xml" overwrite="true"/>
166        <rsr file="${installDir}/packages/tomcat/conf/server.xml">
167            <job pattern="@port@" replacement="${tomcat.port}"/>
168            <job pattern="@shutdown-port@" replacement="${tomcat.shutdown.port}"/>
169        </rsr>
170
171        <echo>Copying greenstone3.xml to tomcat directory</echo>
172        <copy file="${installDir}/resources/tomcat/greenstone3.xml" tofile="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true"/>
173        <rsr file="${installDir}/packages/tomcat/conf/Catalina/localhost/greenstone3.xml" pattern="@gsdl3webhome@" replacement="${installDir.local}${file.separator}web" />
174
175        <echo>Set binaries to executable</echo>
176        <chmod dir="${installDir}/packages/tomcat/bin" includes="*.sh" perm="775"/>
177
178    </target>
179
180    <target name="Installing Ant">
181
182        <echo>Installing Ant (packages/ant)</echo>
183        <mkdir dir="packages"/>
184        <ant target="extract-component"><property name="component.name" value="ant"/></ant>
185
186        <echo>Set binaries to executable</echo>
187        <chmod dir="${installDir}/packages/ant/bin" includes="*" perm="775"/>
188
189    </target>
190
191
192    <target name="Installing Start Menu Shortcuts">
193
194        <echo>Installing Start Menu Shortcuts</echo>
195
196        <mkdir dir="${startmenu.path}\Documentation"/>
197       
198        <shortcut
199            file="${startmenu.path}\Greenstone3 Server.lnk"
200            execute="${installDir}\gs3-server.bat"
201            workingDirectory="${installDir}"
202            iconFile="${installDir}\resources\images\gs3.ico"
203            iconIndex="0" />
204
205        <shortcut
206            file="${startmenu.path}\Greenstone Librarian Interface (GLI).lnk"
207            execute="${installDir}\gli\gli.bat"
208            workingDirectory="${installDir}\gli"
209            iconFile="${installDir}\resources\images\gs3.ico"
210            iconIndex="0" />
211           
212        <shortcut
213            file="${startmenu.path}\Greenstone Editor for Metadata Sets (GEMS).lnk"
214            execute="${installDir}\gli\gems.bat"
215            workingDirectory="${installDir}\gli"
216            iconFile="${installDir}\resources\images\gs3.ico"
217            iconIndex="0" />
218
219        <shortcut
220            file="${startmenu.path}\Uninstall.lnk"
221            execute="${installDir}\Uninstall.bat"
222            workingDirectory="${installDir}"
223            iconFile="${installDir}\resources\images\gs3.ico"
224            iconIndex="0" />
225   
226        <shortcut
227            file="${startmenu.path}\Documentation\README.lnk"
228            execute="${installDir}\README.txt" />
229       
230        <shortcut
231            file="${startmenu.path}\Documentation\Greenstone3 Users' Guide.lnk"
232            execute="${installDir}\documentation\manual\manual.pdf" />
233       
234        <shortcut
235            file="${startmenu.path}\Documentation\Greenstone2 Users' Guide.lnk"
236            execute="${installDir}\documentation\manual\gs2_user_en.pdf" />
237       
238    </target>
239
240    <!-- util target to extract the given component -->
241    <!-- pass in ${component.name} as a param -->
242    <target name="extract-component">
243        <!-- extract the component into place -->
244        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="${component.name}.lzma"/></patternset></unzip>
245        <!-- if windows -->
246        <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ${component.name}.lzma"/></exec>
247        <!-- /if -->
248        <!-- if linux|mac -->
249        <sevenzip task="decode" input="${basedir}/${component.name}.lzma" output="${basedir}/${component.name}.comp"/>
250        <!-- /if -->
251        <delete file="${component.name}.lzma"/>
252        <unzip src="${basedir}/${component.name}.comp" dest="${installDir}"/>
253        <delete file="${component.name}.comp"/>
254    </target>
255
256</project>
Note: See TracBrowser for help on using the browser.