root/other-projects/expeditee-release-kits/kits/rke/installer/build.xml @ 28717

Revision 28717, 10.5 KB (checked in by ak19, 6 years ago)

jts21 - Removed unused installer targets and variables, renamed some java variables, made installing a JRE an optional installation component

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    <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
32    <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
33    <typedef name="adduser" classname="org.greenstone.anttasks.AddGreenstoneUserToDatabase" classpathref="project.classpath"/>
34    <!-- if windows -->
35    <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
36    <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
37    <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
38    <!-- /if -->
39    <!-- if linux|mac -->
40    <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
41    <!-- /if -->
42
43    <!-- determine if a bundled java exists -->
44    <condition property="bundled.java.exists">
45        <or>
46            <available file="../@java.extracted@/bin/java"/>
47            <available file="../@java.extracted@/bin/java.exe"/>
48        </or>
49    </condition>
50
51    <!-- determine if there is an existing installation in the installDir-->
52    <available file="${installDir}\etc\installation.properties" property="is.overinstall"/>
53
54    <!-- create a local installDir String -->
55    <path id="installDir.path"><pathelement location="${installDir}"/></path>
56    <property name="installDir.local" refid="installDir.path"/>
57
58    <!-- if windows -->
59    <!-- load windows properties -->
60    <winprops/>
61    <!-- /if -->
62
63    <!-- load the properties of the previous installation if this is an overinstall -->
64    <target name="Looking For Previous Installation" if="is.overinstall">
65        <property file="${installDir}\etc\installation.properties"/>
66        <delete dir="${installed.startmenu.path}" failonerror="false"/>
67    </target>
68
69
70    <!-- core system -->
71    <target name="Installing Core System">
72
73        <!-- if windows -->
74        <!-- figure out the start menu path -->
75        <getfreepath path="${win32.personal.programs_menu}\${projectname}" property="startmenu.path"/>     
76        <path id="startmenu.path.path" path="${startmenu.path}"/>
77        <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
78
79        <!-- extract 7za tool -->
80        <unzip src="${antinstaller.jar}" dest="${basedir}">
81            <patternset><include name="7za.exe"/></patternset>
82        </unzip>
83        <!-- /if -->
84
85        <!-- start web -->
86        <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
87        <!-- if linux|mac --><sevenzip task="decode" input="${basedir}/core.lzma" output="${basedir}/core.comp"/><!-- /if -->
88        <!-- if windows --><exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec><!-- /if -->
89        <delete file="core.lzma"/>
90        <unzip src="${basedir}/core.comp" dest="${installDir}"/>
91        <delete file="core.comp"/>
92        <!-- end web -->
93
94        <echo>Setting Binaries to Executable</echo>
95        <chmod dir="${installDir}" includes="*.sh,*.bash" perm="775"/>
96        <!-- <chmod dir="${installDir}/bin" includes="*" perm="775"/>
97        <chmod dir="${installDir}/cgi-bin/${shell.name}" includes="*" perm="775"/>
98        <chmod dir="${installDir}/bin/script" includes="**/*" perm="775"/>
99        <chmod dir="${installDir}/gli" includes="*.sh" perm="775"/> -->
100        <!-- if linux|mac -->
101        <!-- <chmod dir="${installDir}/bin/${shell.name}" includes="**/*" perm="775"/> -->
102        <!-- /if -->
103
104        <!-- if linux|mac -->
105        <!--
106        <echo>Set the installation locale in config files</echo>
107        <rsr file="${installDir}/setup.bash" pattern="^gsdllang=.*" replacement="gsdllang=${language}"/>
108        <rsr file="${installDir}/gli/gli.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
109        <rsr file="${installDir}/gli/gems.sh" pattern="^glilang=.*" replacement="glilang=${language}"/>
110        -->
111        <!-- /if -->
112        <!--
113        <rsr
114            file="${installDir}/gli/classes/xml/config.xml"
115            pattern="(&lt;Argument name=&quot;general.locale&quot;&gt;).*(&lt;/Argument&gt;)"
116            replacement="$1${language}$2"/>
117
118        <echo file="${installDir}/etc/main.cfg" append="true"
119            >cgiarg          shortname=l argdefault=${language}</echo>
120
121        <echo message="Creating installation properties file"/>
122        -->
123        <!-- if linux|mac -->
124        <!-- <echo file="${installDir}/etc/installation.properties">#this file is just a placeholder for now</echo> -->
125        <!-- /if -->
126        <!-- if windows -->
127        <!-- <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo> -->
128        <!-- /if -->
129       
130        <!-- if mac -->
131        <!--
132        <copy file="${installDir}/gli.app/Contents/document.wflow.in" tofile="${installDir}/gli.app/Contents/document.wflow"/>
133        <rsr file="${installDir}/gli.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
134       
135        <copy file="${installDir}/gs2-server.app/Contents/document.wflow.in" tofile="${installDir}/gs2-server.app/Contents/document.wflow"/>
136        <rsr file="${installDir}/gs2-server.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
137       
138        <copy file="${installDir}/gems.app/Contents/document.wflow.in" tofile="${installDir}/gems.app/Contents/document.wflow"/>
139        <rsr file="${installDir}/gems.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
140       
141        <copy file="${installDir}/client-gli.app/Contents/document.wflow.in" tofile="${installDir}/client-gli.app/Contents/document.wflow"/>
142        <rsr file="${installDir}/client-gli.app/Contents/document.wflow" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
143
144        <chmod dir="${installDir}" includes="*.app" perm="755"/>
145        <chmod dir="${installDir}" includes="*.app/**/*" perm="755"/>
146        -->
147        <!-- /if -->
148    </target>
149
150    <!-- <target name="Initialising" if="bundled.java.exists"> -->
151    <!-- Java Runtime  -->
152    <target name="Installing Java Runtime">
153        <echo>Installing the Java Runtime</echo>
154        <mkdir dir="${installDir}/packages"/>
155        <copy todir="${installDir}/packages/jre" failonerror="false">
156            <fileset dir="../@java.extracted@"/>
157        </copy>
158        <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>       
159    </target>
160
161    <!-- Start menu shortcuts -->
162    <target name="Installing Start Menu Shortcuts">
163
164        <mkdir dir="${startmenu.path}\Documentation"/>
165
166        <!-- Server shortcut -->
167        <if><bool><available file="${installDir}/web/images/server.ico"/></bool>
168            <property name="servericon" value="${installDir}\web\images\server.ico"/>
169            <else>
170                <property name="servericon" value="${installDir}\web\images\serverico.ico"/>
171            </else>
172        </if>
173
174        <shortcut
175            file="${startmenu.path}\Greenstone Server.lnk"
176            execute="${installDir}\gs2-server.bat"
177            workingDirectory="${installDir}"
178            iconFile="${servericon}"
179            iconIndex="0" />
180
181        <!-- Librarian shortcut -->
182        <if><bool><available file="${installDir}/web/images/librarian.ico"/></bool>
183            <property name="libraryicon" value="${installDir}\web\images\librarian.ico"/>
184            <else>
185                <property name="libraryicon" value="${installDir}\web\images\icon.ico"/>
186            </else>
187        </if>
188
189        <shortcut
190            file="${startmenu.path}\Librarian Interface (GLI).lnk"
191            execute="${installDir}\gli\gli.bat"
192            workingDirectory="${installDir}\gli"
193            iconFile="${libraryicon}"
194            iconIndex="0" />
195           
196        <!-- Remote Server shortcut -->
197        <if><bool><available file="${installDir}/web/images/clientgli.ico"/></bool>
198            <property name="clientgliicon" value="${installDir}\web\images\clientgli.ico"/>
199            <else>
200                <property name="clientgliicon" value="${installDir}\web\images\icon.ico"/>
201            </else>
202        </if>
203
204        <shortcut
205            file="${startmenu.path}\Remote Librarian Interface (Client GLI).lnk"
206            execute="${installDir}\gli\client-gli.bat"
207            workingDirectory="${installDir}\gli"
208            iconFile="${clientgliicon}"
209            iconIndex="0" />
210
211        <!-- GEMS shortcut -->
212        <if><bool><available file="${installDir}/web/images/metadata.ico"/></bool>
213            <property name="gemsicon" value="${installDir}\web\images\metadata.ico"/>       
214            <else>
215                <property name="gemsicon" value="${installDir}\web\images\gems.ico"/>   
216            </else>
217        </if>
218
219        <shortcut
220            file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
221            execute="${installDir}\gli\gems.bat"
222            workingDirectory="${installDir}\gli"
223            iconFile="${gemsicon}"
224            iconIndex="0" />
225
226        <!-- Uninstall shortcut -->
227        <if><bool><available file="${installDir}/web/images/newuninstall.ico"/></bool>
228            <property name="uninstallicon" value="${installDir}\web\images\newuninstall.ico"/>     
229            <else>
230                <property name="uninstallicon" value="${installDir}\web\images\uninstall.ico"/>     
231            </else>
232        </if>
233       
234        <shortcut
235            file="${startmenu.path}\Uninstall.lnk"
236            execute="${installDir}\uninstall\Uninstall.bat"
237            workingDirectory="${installDir}\uninstall"
238            iconFile="${uninstallicon}"
239            iconIndex="0" />
240
241        <!-- Misc shortcuts -->
242        <shortcut
243            file="${startmenu.path}\Documentation\READMEen.lnk"
244            execute="${installDir}\READMEen.txt" />
245
246        <shortcut
247            file="${startmenu.path}\Documentation\Greenstone Wiki.url"
248            url="http://wiki.greenstone.org" />
249
250        <shortcut
251            file="${startmenu.path}\Documentation\Greenstone Website.url"
252            url="http://www.greenstone.org" />
253
254    </target>
255
256    <target name="Configuring Administration Pages" if="enable.admin.pages">
257        <echo>Enabling Admin Pages</echo>
258        <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
259        <echo>Creating admin and demo users</echo>
260        <adduser txt2db="${installDir}/bin/${shell.name}/txt2db"
261            usersDb="${installDir}/etc/users.gdb"
262            username="admin"
263            password="${admin.password}"
264            groups="administrator,colbuilder,all-collections-editor"
265            comment="created at install time"/>
266        <adduser
267            txt2db="${installDir}/bin/${shell.name}/txt2db"
268            usersDb="${installDir}/etc/users.gdb"
269            username="demo"
270            password="demo"
271            groups="demo"
272            comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
273    </target>
274
275    <target name="Installing Documented Examples">
276        <unzip src="${orig.dir}/documented-examples.zip" dest="${installDir}/collect"/>
277    </target>
278
279</project>
Note: See TracBrowser for help on using the browser.