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