Changeset 15142

Show
Ignore:
Timestamp:
28.03.2008 12:43:46 (11 years ago)
Author:
oranfry
Message:

changes to the wrapper and installer logic, and a few changes to init and compile stuff

Location:
release-kits/lirk3
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • release-kits/lirk3/ant-scripts/compile.xml

    r14982 r15142  
    199199    <target name="rtftohtml-add-static"> 
    200200        <if><bool><istrue value="${execute}"/></bool> 
    201             <rsr file="greenstone3/gs2build/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml.{2}EXEEXT.{1}" replacement="-o rtftohtml\$(EXEEXT) -static" /> 
     201            <rsr file="greenstone3/gs2build/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" /> 
    202202        </if> 
    203203    </target> 
  • release-kits/lirk3/ant-scripts/create-installer.xml

    r14982 r15142  
    1212 
    1313    <target name="create-installer"> 
     14        <addressedcall target="setup-for-installer-creation"/> 
     15        <addressedcall target="compile-installer"/> 
     16        <addressedcall target="clean-up-after-installer-creation"/> 
     17    </target> 
     18 
     19    <target name="setup-for-installer-creation"> 
    1420        <if><bool><istrue value="${execute}"/></bool> 
    1521 
    16             <echo>Project Path: ${project.path}</echo> 
     22            <echo>Project Path: ${basedir}/distribution/greenstone3</echo> 
    1723            <mkdir dir="${basedir}/installer"/> 
     24            <copy todir="${basedir}/installer" file="${lirk3.home}/installer/antinstall-config.xml"/> 
     25            <copy todir="${basedir}/installer" file="${lirk3.home}/installer/build.xml"/> 
     26            <rsr file="${basedir}/installer/antinstall-config.xml" pattern="@version@" replacement="${version}"/> 
     27            <rsr file="${basedir}/installer/build.xml" pattern="@java.extracted@" replacement="${java.extracted}"/> 
     28             
     29        </if> 
     30    </target> 
     31 
     32    <target name="compile-installer"> 
     33        <if><bool><istrue value="${execute}"/></bool> 
     34 
    1835            <installer file="${basedir}/installer/greenstone3.jar" 
    1936                    compress="true" 
    2037                    extractType="NonExtractor" 
    21                     installConfig="${project.installer.path}/antinstall-config.xml" 
    22                     buildFile="${project.installer.path}/build.xml" 
    23                     antInstallLib="${ant.installer.home}/lib" 
    24                     antLib="${ant.installer.home}/antlib" 
     38                    installConfig="${basedir}/installer/antinstall-config.xml" 
     39                    buildFile="${basedir}/installer/build.xml" 
     40                    antInstallLib="${lirk3.home}/bin/ant-installer/lib" 
     41                    antLib="${lirk3.home}/bin/ant-installer/antlib" 
    2542                    validateConfig="true" 
    2643                    icons="bluecurve"> 
    2744 
    2845                <!-- copy all the important files into the archive to be extracted for install --> 
    29                 <zipfileset dir="${project.installer.path}/cp" includes="resources/*"/> 
     46                <zipfileset dir="${lirk3.home}/installer/cp" includes="resources/*"/> 
    3047                <zipfileset dir="${lirk3.home}/ant-scripts/tasks/orans"><include name="RegexSearchReplace.class"/></zipfileset> 
    3148 
    32                 <zipfileset dir="${project.path}" includes="*"/> 
    33                 <zipfileset dir="${project.path}/bin" prefix="bin"><include name="**/*"/></zipfileset> 
    34                 <zipfileset dir="${project.path}/docs" prefix="docs"><include name="**/*"/></zipfileset> 
    35                 <zipfileset dir="${project.path}/gli" prefix="gli"><include name="**/*"/></zipfileset> 
    36                 <zipfileset dir="${project.path}/gs2build" prefix="gs2build"><include name="**/*"/></zipfileset> 
    37                 <zipfileset dir="${project.path}/lib" prefix="lib"><include name="**/*"/></zipfileset> 
    38                 <zipfileset dir="${project.path}/web" prefix="web"><include name="**/*"/></zipfileset> 
    39                 <zipfileset dir="${project.path}/packages" prefix="packages"><include name="**/*"/></zipfileset> 
    40                 <zipfileset dir="${project.path}/resources" prefix="resources"><include name="**/*"/></zipfileset> 
    41                 <zipfileset dir="${project.path}/src" prefix="src"><include name="**/*"/></zipfileset> 
     49                <zipfileset dir="${basedir}/distribution/greenstone3" includes="*"/> 
     50                <zipfileset dir="${basedir}/distribution/greenstone3/bin" prefix="bin"><include name="**/*"/></zipfileset> 
     51                <zipfileset dir="${basedir}/distribution/greenstone3/docs" prefix="docs"><include name="**/*"/></zipfileset> 
     52                <zipfileset dir="${basedir}/distribution/greenstone3/gli" prefix="gli"><include name="**/*"/></zipfileset> 
     53                <zipfileset dir="${basedir}/distribution/greenstone3/gs2build" prefix="gs2build"><include name="**/*"/></zipfileset> 
     54                <zipfileset dir="${basedir}/distribution/greenstone3/lib" prefix="lib"><include name="**/*"/></zipfileset> 
     55                <zipfileset dir="${basedir}/distribution/greenstone3/web" prefix="web"><include name="**/*"/></zipfileset> 
     56                <zipfileset dir="${basedir}/distribution/greenstone3/packages" prefix="packages"><include name="**/*"/></zipfileset> 
     57                <zipfileset dir="${basedir}/distribution/greenstone3/resources" prefix="resources"><include name="**/*"/></zipfileset> 
     58                <zipfileset dir="${basedir}/distribution/greenstone3/src" prefix="src"><include name="**/*"/></zipfileset> 
    4259            </installer> 
    4360 
     
    4562    </target> 
    4663 
     64    <target name="clean-up-after-installer-creation"> 
     65        <if><bool><istrue value="${execute}"/></bool> 
     66            <delete file="${basedir}/installer/antinstall-config.xml"/> 
     67            <delete file="${basedir}/installer/build.xml"/> 
     68        </if> 
     69    </target> 
     70 
     71 
    4772</project> 
  • release-kits/lirk3/ant-scripts/init.xml

    r14982 r15142  
    3838    <property file="build.properties" /> 
    3939 
    40     <!-- project details (for ant-installer) --> 
    41     <property name="project.name"                   value="Greenstone3"/> 
    42     <property name="project.short.name"         value="greenstone3"/> 
    43     <property name="project.path"                   value="${basedir}/distribution/greenstone3"/> 
    44     <property name="project.installer.path" value="${lirk3.home}/installer"/> 
    45     <property name="project.version"                value="${version}"/> 
    46     <property name="ant.installer.home"         value="${lirk3.home}/bin/ant-installer"/> 
    47  
    4840    <!-- somewhere to store temporary text --> 
    4941    <tempfile property="temp.file" destdir="${java.io.tmpdir}" prefix="delete" suffix=".tmp"/> 
     42 
     43    <!-- bundled java strings --> 
     44    <!-- java.installer: use a filename which has only letters numbers and underscores --> 
     45    <property name="java.installer" value="jre_6u5_linux_i586"/> 
     46    <property name="java.extracted" value="jre1.6.0_05"/> 
     47    <property name="java.min.version" value="1.5.0_00"/> 
     48 
    5049 
    5150    <!-- stuff to do before all tasks --> 
  • release-kits/lirk3/ant-scripts/wrap.xml

    r15104 r15142  
    33<!-- 
    44        ..........................................................  
    5         September 2007 
    6         Greenstone3 'release maker' script 
    7         Oran Fry 
     5         September 2007 
     6         Greenstone3 'release maker' script 
     7         Oran Fry 
    88        .......................................................... 
    99--> 
    1010 
    1111<project name="lirk3-wrap" default="wrap"> 
    12  
    1312 
    1413    <target name="wrap"> 
     
    2524            <mkdir dir="${basedir}/wrapped-installer/build"/> 
    2625            <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/wrapper/mywrapper.c"/> 
     26 
     27            <!-- copy bundled files --> 
     28            <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/search4j/search4j"/> 
     29            <copy todir="${basedir}/wrapped-installer/build" file="${lirk3.home}/wrapper/${java.installer}"/> 
    2730            <copy todir="${basedir}/wrapped-installer/build" file="${basedir}/installer/greenstone3.jar"/> 
     31 
     32            <!-- substitute the real java installer filename and min version into various files --> 
     33            <rsr file="${basedir}/wrapped-installer/build/mywrapper.c" pattern="@java.installer@" replacement="${java.installer}"/> 
     34            <rsr file="${basedir}/wrapped-installer/build/mywrapper.c" pattern="@java.extracted@" replacement="${java.extracted}"/> 
     35            <rsr file="${basedir}/wrapped-installer/build/mywrapper.c" pattern="@java.min.version@" replacement="${java.min.version}"/> 
    2836 
    2937        </if> 
     
    3745                <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_jar_start=greenstone3jar --readonly-text greenstone3.jar greenstone3.jar.o"/> 
    3846            </exec> 
     47            <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build"> 
     48                <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_search4j_start=search4j --readonly-text search4j search4j.o"/> 
     49            </exec> 
     50            <exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build"> 
     51                <arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_${java.installer}_start=java --readonly-text ${java.installer} java.o"/> 
     52            </exec> 
    3953 
    40             <echo level="info">create a header file declaring the bundled files and their sizes</echo> 
     54 
     55            <echo level="info">create a header file declaring bundled greenstone.jar and search4j</echo> 
    4156            <delete file="mywrapper.h"/> 
    4257 
    4358            <!-- greenstone.jar --> 
    44             <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3.jar.ls"> 
    45                 <arg line="-l greenstone3.jar"/> 
    46             </exec> 
    47             <!--<echo level="info">ls: ${greenstone3.jar.ls}</echo>--> 
    48             <exec executable="sed" inputstring="${greenstone3.jar.ls}" outputproperty="greenstone3.jar.size"> 
    49                 <arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/> 
    50             </exec> 
    51             <!--<echo level="info">size: ${greenstone3.jar.size}</echo>--> 
    52             <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h"> 
    53                 <arg line="extern const char greenstone3jar[${greenstone3.jar.size}];"/> 
    54             </exec> 
     59            <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3.jar.ls"><arg line="-l greenstone3.jar"/></exec> 
     60            <exec executable="sed" inputstring="${greenstone3.jar.ls}" outputproperty="greenstone3.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec> 
     61            <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h"><arg line="extern const char greenstone3jar[${greenstone3.jar.size}];"/></exec> 
     62 
     63            <!-- search4j --> 
     64            <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="search4j.ls"><arg line="-l search4j"/></exec> 
     65            <exec executable="sed" inputstring="${search4j.ls}" outputproperty="search4j.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec> 
     66            <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="extern const char search4j[${search4j.size}];"/></exec> 
     67 
    5568 
    5669            <echo level="info">compile the wrapper program</echo> 
     
    6174            <echo level="info">link, bundling the files to be bundled</echo> 
    6275            <exec executable="g++" dir="${basedir}/wrapped-installer/build"> 
    63                 <arg line="-static -static-libgcc -o  ../greenstone-${version}-linux.bin mywrapper.o greenstone3.jar.o"/> 
     76                <arg line="-static -static-libgcc -o  ../greenstone-${version}-linux.bin mywrapper.o greenstone3.jar.o search4j.o"/> 
    6477            </exec> 
     78 
     79 
     80            <echo level="info">add java to the header file</echo> 
     81            <!-- java --> 
     82            <exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${java.installer}"/></exec> 
     83            <exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec> 
     84            <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="extern const char java[${java.size}];"/></exec> 
     85            <exec executable="echo" output="${basedir}/wrapped-installer/build/mywrapper.h" append="true"><arg line="#define java_is_bundled yes"/></exec> 
     86 
     87            <echo level="info">recompile the wrapper program</echo> 
     88            <exec executable="g++" dir="${basedir}/wrapped-installer/build"> 
     89                <arg line="-Wall -static -static-libgcc -c -o mywrapper.o mywrapper.c"/> 
     90            </exec> 
     91 
     92            <echo level="info">relink, bundling the files to be bundled</echo> 
     93            <exec executable="g++" dir="${basedir}/wrapped-installer/build"> 
     94                <arg line="-static -static-libgcc -o  ../greenstone-${version}-linux-with-jre.bin mywrapper.o greenstone3.jar.o search4j.o java.o"/> 
     95            </exec> 
     96 
     97 
    6598 
    6699        </if> 
  • release-kits/lirk3/bin/lirk3

    r15097 r15142  
    8484 
    8585#echo $toexec 
    86 echo "LiRK3" 
     86echo "O---------------------------------------O" 
     87echo "|                                       |" 
     88echo "|   LiRK3                               |" 
     89echo "|   Linux Release Kit for Greenstone3   |" 
     90echo "|                                       |" 
     91echo "O---------------------------------------O" 
    8792echo "  Ant Script: $LIRK3_HOME/ant-scripts/build.xml" 
    8893echo "  Basedir:    `pwd`" 
  • release-kits/lirk3/installer/antinstall-config.xml

    r15097 r15142  
    1515            type="input" 
    1616            name="intro" 
    17             displayText="绿宝石蜯件"> 
     17            displayText="Welcome to the Greenstone3 installer"> 
    1818    </page> 
    1919 
     
    3434        <directory 
    3535                property="installDir" 
    36                 defaultValue="/research/oranfry/sandbox/Greenstone3.03a" 
    37                 defaultValueWin="${env.ProgramFiles}\Greenstone3" 
     36                defaultValue="/usr/local/Greenstone-@version@" 
     37                defaultValueWin="${env.ProgramFiles}\Greenstone-@version@" 
    3838                displayText="Select an installation directory" 
    3939                create="true"/> 
     
    4545        <comment name="tomcatportsdescription" displayText="Please select the ports which the web server (Apache Tomcat) will use  will use. It is usually safe to accept the defaults by just clicking Next. The exception is when you are running other services on these ports - if this is the case, select some free ports and click Next."/> 
    4646 
     47        <text property="tomcat.server" defaultValue="localhost" displayText="Tomcat Server"/> 
    4748        <text property="tomcat.port" defaultValue="8080" displayText="Tomcat Port"/> 
    4849        <text property="tomcat.shutdown.port" defaultValue="8005" displayText="Tomcat Shutdown Port"/> 
     50 
    4951    </page> 
    5052 
     
    5456            name="selector" 
    5557            displayText="Components to install"> 
    56         <comment 
    57                 name="choosecomponents" 
    58                 displayText="Choose the components you want to install" 
    59                 bold="true"/> 
    60         <target 
    61             displayText="Core components" 
    62             target="default" 
    63             defaultValue="true" 
    64             force="true"/> 
    65          
    66         <target 
    67             displayText="Source code" 
    68             target="tgsrc" 
    69             defaultValue="false"/> 
    70          
     58 
     59        <comment name="choosecomponents" displayText="Choose the components you want to install" bold="true"/> 
     60        <target displayText="Core components" target="default" defaultValue="true" force="true"/> 
     61        <target displayText="Source code" target="tgsrc" defaultValue="false"/> 
     62 
    7163    </page> 
    7264 
  • release-kits/lirk3/installer/build.xml

    r14982 r15142  
    44--> 
    55 
    6 <project name="Installation" default="" basedir="${basedir}"> 
     6<project name="Installation" default=""> 
    77 
    88    <!-- this is required to pick up the properties generated during the install pages --> 
     
    1515    <!-- custom tasks --> 
    1616    <typedef name="rsr" classname="RegexSearchReplace" classpathref="project.classpath"/> 
     17 
     18    <condition property="bundled.java.exists"> 
     19        <available file="../@java.extracted@/bin/java"/> 
     20    </condition> 
     21 
    1722 
    1823    <target name="default" depends=""> 
     
    7681        <chmod dir="${installDir}" includes="*.sh" perm="775"/> 
    7782        <chmod dir="${installDir}/bin/script" includes="*" perm="775"/> 
     83        <chmod dir="${installDir}/bin" includes="*" perm="775"/> 
    7884        <chmod dir="${installDir}/packages/tomcat/bin" includes="*.sh" perm="775"/> 
     85        <chmod dir="${installDir}/packages/ant/bin" includes="*" perm="775"/> 
    7986        <chmod dir="${installDir}/gs2build/bin/linux" includes="*" perm="775"/> 
    8087        <chmod dir="${installDir}/gs2build/bin/script" includes="**/*" perm="775"/> 
     
    110117        <rsr file="${installDir}/web/WEB-INF/classes/log4j.properties" pattern="(.*)@gsdl3home@(.*)" replacement="$1${installDir}/web$2" /> 
    111118 
    112         <!-- in the gs3-setup.sh file, set ANT_HOME and put it in PATH --> 
    113         <echo>In the gs3-setup.sh file, set ANT_HOME and put it in PATH</echo> 
     119 
     120        <!-- in the gs3-setup.sh file, set ANT_HOME and put it in PATH (no need anymore)--> 
     121        <!--<echo>In the gs3-setup.sh file, set ANT_HOME and put it in PATH</echo> 
    114122        <exec executable="echo" output="${installDir}/gs3-setup.sh" append="true"> 
    115123            <arg line="export ANT_HOME=${installDir}/packages/ant; export PATH=$ANT_HOME/bin:$PATH;"/> 
    116         </exec> 
     124        </exec>--> 
    117125 
    118126        <!-- delete unneeded files -->       
     127        <echo message="Deleting some extraneous files"/> 
    119128        <delete dir="${installDir}/resources/icons"/> 
    120129        <delete file="${installDir}/resources/*.png"/> 
     130 
     131        <echo message="Finished"/> 
    121132 
    122133    </target> 
     
    133144    </target> 
    134145 
    135     <target name="cleanuptarget"> 
     146    <target name="install-bundled-java" depends="" if="bundled.java.exists"> 
     147        <echo message="Installing bundled java"/> 
     148        <copy todir="${installDir}/packages/jre"> 
     149            <fileset dir="../@java.extracted@"/> 
     150        </copy> 
     151        <chmod dir="${installDir}/packages/jre/bin" includes="*" perm="775"/>        
     152    </target> 
     153 
     154    <target name="cleanuptarget" depends="install-bundled-java"> 
    136155    </target> 
    137156     
  • release-kits/lirk3/wrapper/mywrapper.c

    r14982 r15142  
    22#include <fstream> 
    33#include <iomanip> 
     4 
    45using namespace std; 
    56 
    67#include "mywrapper.h" 
    78 
    8 bool extract_bundled_file( const char[], int, char* ); 
     9bool extract_bundled_file( const char[], int, char*, bool ); 
    910 
    1011int main(int argc, char** argv) { 
     
    1213    string tempdir = (string)argv[0] + ".tmp"; //temporary directory where we will store extracted files 
    1314    string jarfile = tempdir + "/greenstone3.jar"; //where we will store the jar file 
     15    string search4jfile = tempdir + "/search4j"; //where we will store the jar file 
    1416    bool succeeded = false; 
    1517 
     
    2527 
    2628    //extract files 
    27     cout << "Extracting JAR file..." << endl; 
    28     succeeded = extract_bundled_file( greenstone3jar, sizeof(greenstone3jar), (char*)jarfile.c_str() ); 
     29    cout << "Extracting installer jar..." << endl; 
     30    succeeded = extract_bundled_file( greenstone3jar, sizeof(greenstone3jar), (char*)jarfile.c_str(), false); 
    2931    if ( !succeeded ) { 
    3032        cout << "failed" << endl; 
    3133        cout << "Failed to extract the JAR file to '" << jarfile << "'" << endl; 
    32         cout << "The JAR file may have been bundled with this executable incorrectly" << endl; 
    33         cout << "Or this program may not have sufficient file permissions to write it to disk" << endl; 
     34        cout << "The file may be corrupt or missing" << endl; 
     35        cout << "Or this installer may not have sufficient file permissions to write it to disk" << endl; 
    3436        cout << "Exiting" << endl; 
    3537        return 1; 
    3638    } 
    3739 
    38     //run the jar 
    39     cout << "Running the jar" << endl; 
    40     system( ("java -jar " + jarfile).c_str() ); 
     40    cout << "Extracting search4j tool..." << endl; 
     41    succeeded = extract_bundled_file( search4j, sizeof(search4j), (char*)search4jfile.c_str(), true ); 
     42    if ( !succeeded ) { 
     43        cout << "failed" << endl; 
     44        cout << "Failed to extract the search4j tool to '" << jarfile << "'" << endl; 
     45        cout << "The file may be corrupt or missing" << endl; 
     46        cout << "Or this installer may not have sufficient file permissions to write it to disk" << endl; 
     47        cout << "Exiting" << endl; 
     48        return 1; 
     49    } 
     50 
     51 
     52    //change to the temp directory 
     53    chdir( tempdir.c_str() ); 
     54 
     55 
     56    //check if an appropriate java is found 
     57    bool jvmFound = (system( "./search4j -m @java.min.version@ -h ./@java.extracted@" ) == 0); 
     58 
     59    //if the jvm was not found, try to fix it and find it 
     60    if ( !jvmFound ) { 
     61        //did not find a good java 
     62        cout << "Greenstone requires java @java.min.version@ or greater" << endl; 
     63         
     64        //tell them if java is absent or just too old 
     65        if ( system( "./search4j -h ./@java.extracted@" ) == 0 ) { 
     66            cout << "Your java is too old." << endl; 
     67        } else { 
     68            cout << "Could not find java." << endl; 
     69        } 
     70         
     71        //is this an installer with the bundled JRE? 
     72         
     73        #ifdef java_is_bundled 
     74            //yes, JRE is bundled 
     75            cout 
     76                << "This installer comes bundled with a suitible version of java: " << endl 
     77                << "   @java.installer@" << endl 
     78                << "Do you want to install this java? (y/n)" << endl; 
     79            char r[1024]; cin >> r; 
     80            if ( strcmp( r, "y" ) == 0 || strcmp( r, "Y" ) == 0) { 
     81                extract_bundled_file( java, sizeof(java), (char*)"@java.installer@", true ); 
     82                system( "./@java.installer@" ); 
     83                jvmFound = true; //assume the java installation went well 
     84            } 
     85        #endif 
     86 
     87        #ifndef java_is_bundled 
     88            //no, JRE is not bundled 
     89            cout << "Install java (@java.min.version@ or greater) and set JAVA_HOME or JRE_HOME, and try again" << endl; 
     90            cout << "Or, download a greentsone3 installer with bundled java and use that instead of this one" << endl; 
     91        #endif 
     92    } 
     93 
     94    //if we have found it by now, launch the installer 
     95    if ( jvmFound ) { 
     96        cout << "Launching Installer ..." << endl; 
     97        int launch_exit_code = 0; 
     98        launch_exit_code = system("./search4j -m @java.min.version@ -l greenstone3.jar -h ./@java.extracted@"); 
     99 
     100        //report how it went 
     101        if ( launch_exit_code == 0 ) { 
     102            cout << "Setup complete" << endl; 
     103        } else { 
     104            cout << "Still could not find a suitible version of java" << endl; 
     105            cout << "Please install java, set JAVA_HOME or JRE_HOME, and try again" << endl; 
     106        } 
     107 
     108    } 
     109 
     110    //change back to the original directory 
     111    chdir(".."); 
    41112 
    42113    //delete the temp files 
    43114    cout << "Deleting the temp directory" << endl; 
    44115    system( ("rm -rf " + tempdir).c_str() ); 
    45     system( "rm ant.install.log" ); 
    46116 
    47117 
     
    50120} 
    51121 
    52 bool extract_bundled_file( const char data[], int size, char* filename ) { 
     122bool extract_bundled_file( const char data[], int size, char* filename, bool make_executable) { 
     123 
     124    if ( size == 0 ) return false; 
    53125 
    54126    //delete the file if it exists 
     
    76148    } 
    77149 
     150    if ( make_executable ) { 
     151        string command = "chmod a+x " + string(filename); 
     152        system( command.c_str() ); 
     153    } 
     154 
    78155    return true; 
    79156