Changeset 15974


Ignore:
Timestamp:
2008-06-12T16:55:15+12:00 (16 years ago)
Author:
oranfry
Message:

have lirk3 get the shared linux directory

Location:
release-kits/lirk3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release-kits/lirk3

    • Property svn:externals
      •  

        old new  
        11lib http://svn.greenstone.org/release-kits/shared/lib
        22search4j http://svn.greenstone.org/release-kits/shared/search4j
         3linux http://svn.greenstone.org/release-kits/shared/linux
        34
  • release-kits/lirk3/wrapper/mywrapper.c

    r15205 r15974  
    1414    string jarfile = tempdir + "/greenstone3.jar"; //where we will store the jar file
    1515    string search4jfile = tempdir + "/search4j"; //where we will store the jar file
     16    string javafile = tempdir + "/@java.installer@"; //where we will store the java tar file
    1617    bool succeeded = false;
    1718
    1819    //create the temp folder
    19     cout << "Creating temp directory" << endl;
     20    cout << "Creating temp directory..." << endl;
    2021    succeeded = ( 0 == system( ("mkdir " + tempdir).c_str() ) );
    2122    if ( !succeeded ) {
     
    2930    cout << "Extracting installer jar..." << endl;
    3031    succeeded = extract_bundled_file( greenstone3jar, sizeof(greenstone3jar), (char*)jarfile.c_str(), false);
     32
     33    cout << "Extracting search4j tool..." << endl;
     34    succeeded = extract_bundled_file( search4j, sizeof(search4j), (char*)search4jfile.c_str(), true ) && succeeded;
     35
     36    #ifdef java_is_bundled
     37    cout << "Extracting bundled java..." << endl;
     38    succeeded = extract_bundled_file( java, sizeof(java), (char*)javafile.c_str(), true ) && succeeded;
     39    #endif
     40       
    3141    if ( !succeeded ) {
    32         cout << "failed" << endl;
    33         cout << "Failed to extract the JAR file to '" << jarfile << "'" << 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;
     42        cout << "Failed to extract one or more resources" << endl;
     43        cout << "This installer may not have sufficient file permissions to write it to disk" << endl;
     44        cout << "Or, the files may be corrupt or missing from this executable" << endl;
    3645        cout << "Exiting" << endl;
    3746        return 1;
    3847    }
     48   
     49    //change to the temp directory
     50    chdir( tempdir.c_str() );
    3951
    40     cout << "Extracting search4j tool..." << endl;
    41     succeeded = extract_bundled_file( search4j, sizeof(search4j), (char*)search4jfile.c_str(), true );
     52    #ifdef java_is_bundled
     53    succeeded = (system( "tar -xzf @java.installer@" ) == 0);
    4254    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;
     55        cout << "Failed to extract the bundled java archive to the temp directory" << endl;
     56        cout << "You need the tar program on your PATH" << endl;
    4757        cout << "Exiting" << endl;
    4858        return 1;
    4959    }
    50 
    51 
    52     //change to the temp directory
    53     chdir( tempdir.c_str() );
    54 
     60    #endif
    5561
    5662    //check if an appropriate java is found
    5763    bool jvmFound = (system( "./search4j -m @java.min.version@ -h ./@java.extracted@" ) == 0);
    5864
    59     //if the jvm was not found, try to fix it and find it
     65    //if the jvm was not found, report not found
    6066    if ( !jvmFound ) {
     67
    6168        //did not find a good java
    62         cout << "Greenstone requires java @java.min.version@ or greater" << endl;
     69        cout << "Greenstone requires java @java.min.version@ or greater." << endl;
    6370       
    6471        //tell them if java is absent or just too old
    6572        if ( system( "./search4j -h ./@java.extracted@" ) == 0 ) {
    66             cout << "Your java is too old." << endl;
     73            cout << "You have java, but it is too old." << endl;
    6774        } else {
    6875            cout << "Could not find java on your system." << endl;
    6976        }
    70        
    71         //is this an installer with the bundled JRE?
    72        
    73         #ifdef java_is_bundled
    74             //yes, JRE is bundled
    75             /*
    76             cout
    77                 << "This installer comes bundled with a suitible version of java: " << endl
    78                 << "   @java.installer@" << endl
    79                 << "Do you want to install this java? (y/n)" << endl;
    80             char r[1024]; cin >> r;
    81             if ( strcmp( r, "y" ) == 0 || strcmp( r, "Y" ) == 0) {
    82             */
    8377
    84             cout << "Using bundled java." << endl;
    85             extract_bundled_file( java, sizeof(java), (char*)"@java.installer@", true );
    86             system( "tar -xzf @java.installer@" );
    87             jvmFound = true; //assume the java installation went well
    88 
    89             /*}*/
     78        cout << "Install java (@java.min.version@ or greater) and set JAVA_HOME or JRE_HOME, and try again" << endl;
     79        #ifndef java_is_bundled
     80        cout << "Or, download a greentsone3 installer with bundled java and use that instead of this one" << endl;
    9081        #endif
    9182
    92         #ifndef java_is_bundled
    93             //no, JRE is not bundled
    94             cout << "Install java (@java.min.version@ or greater) and set JAVA_HOME or JRE_HOME, and try again" << endl;
    95             cout << "Or, download a greentsone3 installer with bundled java and use that instead of this one" << endl;
    96         #endif
    97     }
     83    //if we have found it, launch the installer
     84    } else {
    9885
    99     //if we have found it by now, launch the installer
    100     if ( jvmFound ) {
    10186        cout << "Launching Installer ..." << endl;
    10287        int launch_exit_code = 0;
     
    10792            cout << "Setup complete" << endl;
    10893        } else {
    109             cout << "Still could not find a suitible version of java" << endl;
    110             cout << "Please install java, set JAVA_HOME or JRE_HOME, and try again" << endl;
     94            cout << "The installer exited with an error" << endl;
     95            cout << "Greenstone may not be correctly installed" << endl;
    11196        }
    11297
     
    119104    cout << "Deleting the temp directory" << endl;
    120105    system( ("rm -rf " + tempdir).c_str() );
    121 
    122106
    123107    return 0;
Note: See TracChangeset for help on using the changeset viewer.