Index: /gs3-extensions/fedora/build.xml
===================================================================
--- /gs3-extensions/fedora/build.xml	(revision 26377)
+++ /gs3-extensions/fedora/build.xml	(revision 26377)
@@ -0,0 +1,147 @@
+<?xml version="1.0"?>
+<!-- ====================================================================== 
+     Oct 2012
+
+     Script to install Fedora and Fedora GSearch as extensions within Greenstone3
+     (using Greenstone's tomcat)
+     ak19                                                                
+     ====================================================================== -->
+
+<project name="fedora_for_gs3" default="usage" basedir=".">
+  <echo>
+    Tested for Linux. 
+    Your os.name: ${os.name}
+  </echo>
+
+  <!-- PROPERTIES -->
+
+  <!--<property name="gsdl3src.home" value="../..${basedir}"/>-->
+  <!--<property name="gsdl3src.home" location="." relative="true" basedir="../.."/>-->
+  <!--<property name="gsdl3src.home" value="/full/path/to/GS3" />-->
+
+  <!-- load the Greenstone properties file to have access to tomcat and fedora properties. 
+    This assumes they have Greenstone installed (build.properties must exist). -->
+  <property file="${gsdl3src.home}/build.properties"/>
+
+  <available file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/FgsConfig/build.xml" property="fedoragsearch.deployed"/>   
+
+
+  <!-- TARGETS -->
+  <target name="usage" description="Print a help message">
+    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
+    <echo message="  Execute 'ant -help' for Ant help."/>
+    
+    <echo>
+      *********************************************************
+      1. ant -Dgsdl3src.home=&lt;Full-Path-To-GS3&gt; start-fedora-install
+
+      2. start tomcat by going into ${gsdl3src.home} and running: ant start
+
+      3. ant -Dgsdl3src.home=&lt;Full-Path-To-GS3&gt; continue-fedora-install
+
+      4. stop tomcat by going back into ${gsdl3src.home} and running: ant stop
+      
+      5. ant -Dgsdl3src.home=&lt;Full-Path-To-GS3&gt; finish-fedora-install
+      
+      The README.txt file will have more information about the Greenstone 
+      Fedora extension's installation process.
+      *********************************************************
+    </echo>
+  </target>
+
+
+
+  <target name="start-fedora-install" description="Prepares the fedora war files and puts them into tomcat">
+
+    <!-- adjust template files -->
+    <filter token="GSDL3SRCHOME" value="${gsdl3src.home}"/>
+    <filter token="FEDORA_HOME" value="${gsdl3src.home}/ext/fedora3"/>
+    <filter token="tomcatserver" value="${tomcat.server}"/>
+    <filter token="tomcatport" value="${tomcat.port}"/>
+    <filter token="tomcatshutdownport" value="${tomcat.shutdown.port}"/>
+    <filter token="fedorapassw" value="${fedora.password}"/>
+    
+    <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/fgsconfig-basic.properties.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/fgsconfig-basic.properties" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/install/install.properties.in" tofile="${basedir}/install/install.properties" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/server/config/fedora.fcfg.in" tofile="${basedir}/server/config/fedora.fcfg" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/server/config/fedora-users.xml.in" tofile="${basedir}/server/config/fedora-users.xml" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/server/config/spring/akubra-llstore.xml.in" tofile="${basedir}/server/config/spring/akubra-llstore.xml" filtering="true" overwrite="true"/>
+
+    <!-- zip up fedoragsearch, rename as .war file and put it in the install folder-->
+    <zip destfile="${basedir}/install/fedoragsearch.war"
+	 basedir="${basedir}/adjust_war_files/fedoragsearch"	 
+	 />
+
+    <!-- move fedora.xml and war files into tomcat -->
+    <copy file="${basedir}/adjust_war_files/fedora.xml.in" tofile="${gsdl3src.home}/packages/tomcat/conf/Catalina/localhost/fedora.xml" filtering="true" overwrite="true"/>
+
+    <copy todir="${gsdl3src.home}/packages/tomcat/webapps">
+      <fileset dir="${basedir}/install">
+	<include name="**/*.war"/>
+      </fileset>
+    </copy>
+
+    <!-- copy jar files needed by tomcat to run fedora from greenstone/web/WEB-INF/lib -->
+    <copy todir="${gsdl3src.home}/packages/tomcat/lib">
+      <filelist dir="${gsdl3src.home}/web/WEB-INF/lib">
+	<file name="xalan.jar"/>
+	<file name="serializer.jar"/>
+	<file name="xsltc.jar"/>
+      </filelist>
+    </copy>
+
+    <echo>
+      *********************************************************
+      1. Adjust ${gsdl3src.home}/build.properties to set up Fedora.
+      2. Then restart the Greenstone tomcat. Once it's started up, 
+      3. Return to this extension directory and run: ant continue-fedora-install
+      *********************************************************
+    </echo>
+ </target>
+
+
+
+  <!-- Only if fedoragsearch exists inside tomcat/webapps -->
+  <target name="continue-fedora-install" 
+	  description="When tomcat is running and has deployed the fedora war files, this stage configures Fedora GSearch" 
+	  if="fedoragsearch.deployed">
+
+    <!-- call the fgsconfig-basic.xml buildfile in GS3/packages/tomcat/webapps/fedoragsearch/FgsConfig's 
+	 ant -f fgsconfig-basic.xml -->
+    <ant dir="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/FgsConfig" antfile="fgsconfig-basic.xml"/>
+    
+    <!-- give read execute permissions to all (755) for the fedoragsearch files -->
+    <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh" perm="755"/>
+    <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runSOAPClient.sh" perm="755"/>
+    
+    <echo>
+      *********************************************************
+      1. Stop the Greenstone Tomcat. (Check it's stopped: ps aux | grep tomcat)
+      2. Then to complete fedora installation, return to this extension directory and run: ant finish-fedora-install.
+      This will clear the war files since they have already been deployed.
+      *********************************************************
+    </echo>
+    
+  </target>
+
+
+  
+  <target name="finish-fedora-install" 
+	  description="Removes Fedora and GSearch war files from ${basedir}/tomcat/packages/webapps after deployment. Tomcat must not be running.">
+    <!-- clean up the war files -->
+    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedora.war"/>
+    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedora-demo.war"/>
+    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fop.war"/>
+    <delete file="${gsdl3src.home}/packages/tomcat/webapps/imagemanip.war"/>
+    <delete file="${gsdl3src.home}/packages/tomcat/webapps/saxon.war"/>
+    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch.war"/>
+    
+    <echo>
+      *********************************************************
+      Fedora installation complete. Try running FLI.
+      *********************************************************
+   </echo>
+    
+  </target>
+  
+</project>
