source: release-kits/wirk2/installer/build.xml@ 19201

Last change on this file since 19201 was 19201, checked in by oranfry, 15 years ago

installer pages asking if the user wants to enable the admin pages and if so asking for a password, plus the necessary ant targets to make it happen

File size: 8.9 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 <!-- classpath -->
9 <path id="project.classpath"><pathelement path="${antinstaller.jar}"/></path>
10
11 <!-- custom tasks -->
12 <taskdef name="shortcut" classname="com.orangevolt.tools.ant.Win32ShortcutTask" classpathref="project.classpath"/>
13 <taskdef name="winprops" classname="com.orangevolt.tools.ant.Win32PropertiesTask" classpathref="project.classpath"/>
14 <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
15 <typedef name="getfreepath" classname="org.greenstone.anttasks.GetFreePath" classpathref="project.classpath"/>
16 <typedef name="adduser" classname="org.greenstone.anttasks.AddGreenstoneUserToDatabase" classpathref="project.classpath"/>
17
18 <!-- pick up the properties generated during the install pages -->
19 <property file="${basedir}/ant.install.properties"/>
20
21 <!-- determine if there is an existing installation in the installDir-->
22 <available file="${installDir}\etc\installation.properties" property="is.overinstall"/>
23
24 <!-- load windows properties -->
25 <winprops/>
26
27 <!-- create a local installDir String -->
28 <path id="installDir.path"><pathelement location="${installDir}"/></path>
29 <property name="installDir.local" refid="installDir.path"/>
30
31 <target name="Looking For Previous Installation" if="is.overinstall">
32 <property file="${installDir}\etc\installation.properties"/>
33 <delete dir="${installed.startmenu.path}" failonerror="false"/>
34 </target>
35
36 <target name="Installing Core System">
37
38 <!-- figure out the start menu path -->
39 <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
40 <path id="startmenu.path.path" path="${startmenu.path}"/>
41 <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
42
43 <echo>basedir: ${basedir}</echo>
44 <echo>installDir: ${installDir}</echo>
45 <echo>antinstaller.jar: ${antinstaller.jar}</echo>
46 <echo>startmenu.path: ${startmenu.path}</echo>
47
48 <!-- create the installation directory -->
49 <echo message="Creating Installation directory"/>
50 <mkdir dir="${installDir}"/>
51
52 <!-- extract 7za tool -->
53 <unzip src="${antinstaller.jar}" dest="${basedir}">
54 <patternset><include name="7za.exe"/></patternset>
55 </unzip>
56
57 <!-- install files -->
58 <echo message="Installing Core Component"/>
59 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="core.lzma"/></patternset></unzip>
60 <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x core.lzma"/></exec>
61 <!--<sevenzip task="decode" input="${basedir}/core.lzma" output="${basedir}/core.comp"/>-->
62 <delete file="core.lzma"/>
63 <unzip src="${basedir}/core.comp" dest="${installDir}"/>
64 <delete file="core.comp"/>
65
66 <!-- jre -->
67 <mkdir dir="${installDir}/packages"/>
68 <copy todir="${installDir}/packages/jre" failonerror="false">
69 <fileset dir="../@windows-java.extracted@"/>
70 </copy>
71
72 <echo>Correcting perl shebangs in perl scripts</echo>
73 <property name="perl.executable" value="${installDir.local}\bin\windows\perl\perl.exe"/>
74 <rsr file="${installDir}/cgi-bin/gliserver.pl" pattern="^#!.*" replacement="#!${perl.executable} -w" lines="1"/>
75
76 <echo>Creating the english dictionary</echo>
77 <copy file="${installDir}/gli/classes/dictionary.properties" tofile="${installDir}/gli/classes/dictionary_en.properties"/>
78 <echo/>
79
80 <echo message="Creating installation properties file"/>
81 <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
82
83 <echo message="Finished"/>
84
85 </target>
86
87 <target name="Installing ImageMagick">
88 <echo message="Installing ImageMagick"/>
89 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="imagemagick.lzma"/></patternset></unzip>
90 <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x imagemagick.lzma"/></exec>
91 <!--<sevenzip task="decode" input="${basedir}/imagemagick.lzma" output="${basedir}/imagemagick.comp"/>-->
92 <delete file="imagemagick.lzma"/>
93 <unzip src="${basedir}/imagemagick.comp" dest="${installDir}/bin/windows"/>
94 <delete file="imagemagick.comp"/>
95 </target>
96
97 <target name="Installing Ghostscript">
98 <echo message="Installing GhostScript"/>
99 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="ghostscript.lzma"/></patternset></unzip>
100 <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x ghostscript.lzma"/></exec>
101 <!--<sevenzip task="decode" input="${basedir}/ghostscript.lzma" output="${basedir}/ghostscript.comp"/>-->
102 <delete file="ghostscript.lzma"/>
103 <unzip src="${basedir}/ghostscript.comp" dest="${installDir}/bin/windows"/>
104 <delete file="ghostscript.comp"/>
105 </target>
106
107 <!-- Start menu shortcuts -->
108 <target name="Installing Start Menu Shortcuts">
109
110 <mkdir dir="${startmenu.path}\Documentation"/>
111
112 <shortcut
113 file="${startmenu.path}\Greenstone Server.lnk"
114 execute="${installDir}\server.exe"
115 workingDirectory="${installDir}"
116 iconFile="${installDir}\images\serverico.ico"
117 iconIndex="0" />
118
119 <shortcut
120 file="${startmenu.path}\Librarian Interface (GLI).lnk"
121 execute="${installDir}\gli\gli.bat"
122 workingDirectory="${installDir}\gli"
123 iconFile="${installDir}\images\icon.ico"
124 iconIndex="0" />
125
126 <shortcut
127 file="${startmenu.path}\Metadata Set Editor (GEMS).lnk"
128 execute="${installDir}\gli\gems.bat"
129 workingDirectory="${installDir}\gli"
130 iconFile="${installDir}\images\gems.ico"
131 iconIndex="0" />
132
133 <shortcut
134 file="${startmenu.path}\Uninstall.lnk"
135 execute="${installDir}\Uninstall.bat"
136 workingDirectory="${installDir}"
137 iconFile="${installDir}\images\uninstall.ico"
138 iconIndex="0" />
139
140 <shortcut
141 file="${startmenu.path}\Documentation\READMEen.lnk"
142 execute="${installDir}\READMEen.txt" />
143
144 <shortcut
145 file="${startmenu.path}\Documentation\Greenstone Wiki.url"
146 url="http://wiki.greenstone.org" />
147
148 <shortcut
149 file="${startmenu.path}\Documentation\Greenstone Website.url"
150 url="http://www.greenstone.org" />
151
152<!--
153 <shortcut
154 file="${startmenu.path}\Documentation\READMEes.lnk"
155 execute="${installDir}\READMEes.txt" />
156
157 <shortcut
158 file="${startmenu.path}\Documentation\READMEar.lnk"
159 execute="${installDir}\READMEar.txt" />
160
161 <shortcut
162 file="${startmenu.path}\Documentation\READMEfr.lnk"
163 execute="${installDir}\READMEfr.txt" />
164
165 <shortcut
166 file="${startmenu.path}\Documentation\READMEru.lnk"
167 execute="${installDir}\READMEru.txt" />
168 -->
169
170 </target>
171
172 <target name="Source Release" depends="">
173
174 <!-- create the installation directory -->
175 <echo message="Creating Installation directory"/>
176 <mkdir dir="${installDir}"/>
177
178 <!-- extract 7za tool -->
179 <unzip src="${antinstaller.jar}" dest="${basedir}">
180 <patternset><include name="7za.exe"/></patternset>
181 </unzip>
182
183 <echo>Installing Source Release</echo>
184 <unzip src="${antinstaller.jar}" dest="${basedir}"><patternset><include name="source-release.lzma"/></patternset></unzip>
185 <exec dir="${basedir}" executable="${basedir}/7za.exe"><arg line="x source-release.lzma"/></exec>
186 <delete file="source-release.lzma"/>
187 <unzip src="${basedir}/source-release.comp" dest="${installDir}"/>
188 <delete file="source-release.comp"/>
189
190 <!-- figure out the start menu path -->
191 <getfreepath path="${win32.personal.programs_menu}\Greenstone-@version@" property="startmenu.path"/>
192 <path id="startmenu.path.path" path="${startmenu.path}"/>
193 <pathconvert targetos="unix" property="startmenu.path.unix" refid="startmenu.path.path"/>
194
195 <echo message="Filling in concrete values in config files"/>
196 <rsr file="${installDir}/setup.bat" pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
197 <rsr file="${installDir}/cgi-bin/gsdlsite.cfg">
198 <job pattern="\*\*GSDLHOME\*\*" replacement="${installDir}"/>
199 <job pattern="^(#?httpprefix).*" replacement="$1 /gsdl"/>
200 <job pattern="^(#?httpimg).*" replacement="$1 /gsdl/images"/>
201 </rsr>
202
203 <echo>Create usage.txt</echo>
204 <echo file="${installDir}/etc/usage.txt"></echo>
205
206 <echo message="Creating installation properties file"/>
207 <echo file="${installDir}\etc\installation.properties">installed.startmenu.path:${startmenu.path.unix}</echo>
208
209 <echo message="Finished"/>
210
211 </target>
212
213 <target name="Configuring Administration Pages" if="enable.admin.pages">
214 <echo>Enabling Admin Pages</echo>
215 <rsr file="${installDir}/etc/main.cfg" pattern="^\s*status\s+.*" replacement="status enabled"/>
216 <echo message="Creating admin and demo users"/>
217 <adduser
218 txt2db="${installDir}/bin/windows/txt2db"
219 usersDb="${installDir}/etc/users.gdb"
220 username="admin"
221 password="${admin.password}"
222 groups="administrator,colbuilder"
223 comment="created at install time"/>
224 <adduser
225 txt2db="${installDir}/bin/windows/txt2db"
226 usersDb="${installDir}/etc/users.gdb"
227 username="demo"
228 password="demo"
229 groups="demo"
230 comment="Dummy 'demo' user with password 'demo' for authen-e collection"/>
231 </target>
232
233
234
235</project>
Note: See TracBrowser for help on using the repository browser.