Show
Ignore:
Timestamp:
26.06.2009 18:02:44 (11 years ago)
Author:
oranfry
Message:

it's all good stuff

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • release-kits/shared/linux/wrapper.cpp

    r19767 r19938  
    1212bool extract_bundled_file( const char[], int, char*, bool ); 
    1313#else 
    14 string get_full_java( string wd ); 
     14bool prep_java( string wd ); 
    1515#endif 
    1616 
     
    178178    } 
    179179    #else 
    180         string java_executable = get_full_java( wd ); 
    181         if ( java_executable != "" ) { 
    182             string cmd = java_executable + " -Dorig.dir=\"" + wd + "\" -jar " + wd + "/Java/Jars/linux.jar" + (text_mode?" text":""); 
     180        bool java_ready = prep_java( wd ); 
     181        if ( java_ready ) { 
     182            string cmd = "./jre/bin/java -Dorig.dir=\"" + wd + "\" -jar " + wd + "/Java/Jars/linux.jar" + (text_mode?" text":""); 
    183183            system( cmd.c_str() ); 
    184184        } 
     
    234234#else 
    235235 
    236 string get_full_java( string wd ) { 
    237   string full_java = ""; 
    238  
    239   string cdrom_java = "/Java/Linux/jre/bin/java"; 
    240  
    241   full_java = wd + cdrom_java; 
    242    
    243   string j1cmd = "\""+full_java+"\" -version >/dev/null 2>&1"; 
     236bool prep_java( string wd ) { 
     237 
     238 
     239  string jTestCmd = "./jre/bin/java -version >/dev/null 2>&1"; 
     240 
     241  //try to extract straight off cd 
     242  string j1cmd = wd + "/Java/Linux/jre_bin && tar -xf jre.tar && " + jTestCmd; 
    244243  int j1status = system(j1cmd.c_str()); 
     244  system("/bin/rm -f jre.tar"); 
    245245   
    246246  if (WEXITSTATUS(j1status)!=0) { 
    247     cerr << "Unable to run Java executable from CD-ROM." << endl; 
     247    cerr << "Unable to extract java straight off CD-ROM." << endl; 
    248248    cerr << "This is probably because your CD-ROM was mounted with 'noexec'." << endl; 
    249249    cerr << "It can be changed by a system administrator" << endl << endl; 
     
    251251     
    252252    string cdtar_home = wd + "/Java/Linux/"; 
    253     string tcmd = "(cd \"" + cdtar_home + "\" ; tar cf - jre )"; 
     253    string tcmd = "(cd \"" + cdtar_home + "\" ; tar cf - jre_bin )"; 
    254254    tcmd += "| tar xvf - "; 
    255     tcmd += "| awk 'BEGIN{C=0}{C++; printf(\".\"); if (C%70==0) printf(\"\\n\");}END{printf(\"\\n\")}'"; 
     255    //tcmd += "| awk 'BEGIN{C=0}{C++; printf(\".\"); if (C%70==0) printf(\"\\n\");}END{printf(\"\\n\")}'"; 
    256256 
    257257    int tstatus = system(tcmd.c_str()); 
     
    262262    } 
    263263    else { 
    264       full_java = "./jre/bin/java"; 
    265       string j2cmd = full_java +" -version >/dev/null 2>&1"; 
    266  
     264 
     265      string j2cmd = "./jre_bin && tar -xf jre.tar && " + jTestCmd; 
    267266      int j2status = system(j2cmd.c_str()); 
    268  
    269           if (WEXITSTATUS(j2status)!=0) { 
    270         cerr << "Unable to run copied Java" << endl; 
    271         system("/bin/rm -rf jre"); 
    272         return ""; 
    273       } 
     267      system("/bin/rm -f jre.tar jre_bin"); 
     268 
     269      if (WEXITSTATUS(j2status)!=0) { 
     270        cerr << "Unable to run copied Java" << endl; 
     271        return false; 
     272      } 
    274273    } 
    275274  } 
     
    277276  // to get to here, full_java must be set (and working) 
    278277 
    279   return full_java; 
     278  return true; 
    280279} 
    281280