Changeset b5f97d0
- Timestamp:
- Dec 31, 2011 2:38:37 PM (9 years ago)
- Branches:
- master
- Children:
- 33b25b57, 84e4558
- Parents:
- beb6d1f4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
build.xml
rbeb6d1f4 rb5f97d0 938 938 <fileset dir="build" includes="jasper*.jar javax*.jar jetty*.jar jsp*.jar org.mortbay.jetty.jar" /> 939 939 </copy> 940 <copy todir="pkg-temp/eepsite" > 940 <!-- We have to package the new eepsite files for MigrateJetty.java, but we 941 can't overwrite an existing eepsite dir in a non-split configuration. 942 --> 943 <copy todir="pkg-temp/eepsite-jetty6" > 941 944 <fileset dir="installer/resources/eepsite" includes="jetty.xml jetty-ssl.xml contexts/* etc/*" /> 942 945 </copy> -
router/java/src/net/i2p/router/Router.java
rbeb6d1f4 rb5f97d0 427 427 } 428 428 429 /** this does not use ctx.getConfigDir(), must provide a full path in filename */ 429 /** 430 * this does not use ctx.getConfigDir(), must provide a full path in filename 431 * 432 * @param ctx will be null at startup when called from constructor 433 */ 430 434 private static Properties getConfig(RouterContext ctx, String filename) { 431 435 Log log = null; … … 445 449 if (log != null) 446 450 log.warn("Configuration file " + filename + " does not exist"); 451 // normal not to exist at first install 452 //else 453 // System.err.println("WARNING: Configuration file " + filename + " does not exist"); 447 454 } 448 455 } catch (Exception ioe) { 449 456 if (log != null) 450 457 log.error("Error loading the router configuration from " + filename, ioe); 458 else 459 System.err.println("Error loading the router configuration from " + filename + ": " + ioe); 451 460 } 452 461 return props; … … 1194 1203 fos.write(buf.toString().getBytes("UTF-8")); 1195 1204 } catch (IOException ioe) { 1196 if (_log.shouldLog(Log.ERROR)) 1205 // warning, _log will be null when called from constructor 1206 if (_log != null) 1197 1207 _log.error("Error saving the config to " + _configFilename, ioe); 1208 else 1209 System.err.println("Error saving the config to " + _configFilename + ": " + ioe); 1198 1210 return false; 1199 1211 } finally { -
router/java/src/net/i2p/router/startup/MigrateJetty.java
rbeb6d1f4 rb5f97d0 13 13 /** 14 14 * Migrate the clients.config and jetty.xml files 15 * from Jetty 5 to Jetty 6 15 * from Jetty 5 to Jetty 6. 16 16 * 17 17 * For each client for class org.mortbay.jetty.Server: … … 19 19 * Let $D be the dir that jetty.xml is in (usually ~/.i2p/eepsite) 20 20 * Saves $D/jetty.xml to $D/jetty5.xml 21 * Copies $I2P/eepsite/jetty.xml to $D/jetty.xml, edited for $D 22 * Copies $I2P/eepsite/context/base-context.xml to $D/jetty.xml, edited for $D 23 * Copies $I2P/eepsite/context/cgi-context.xml to $D/jetty.xml, edited for $D 24 * Copies $I2P/eepsite/etc/* to $D/etc 21 * Copies $I2P/eepsite-jetty6/jetty.xml to $D/jetty.xml, edited for $D 22 * Copies $I2P/eepsite-jetty6/jetty-ssl.xml to $D/jetty-ssl.xml, edited for $D 23 * Copies $I2P/eepsite-jetty6/context/base-context.xml to $D/jetty.xml, edited for $D 24 * Copies $I2P/eepsite-jetty6/context/cgi-context.xml to $D/jetty.xml, edited for $D 25 * Copies $I2P/eepsite-jetty6/etc/* to $D/etc 25 26 * Changes main class in clients.config 26 27 *</pre> … … 39 40 private static final String NEW_CLASS = "org.mortbay.start.Main"; 40 41 private static final String BACKUP = "jetty5.xml"; 42 private static final String JETTY6_TEMPLATE_DIR = "eepsite-jetty6"; 41 43 private static final String BASE_CONTEXT = "contexts/base-context.xml"; 42 44 private static final String CGI_CONTEXT = "contexts/cgi-context.xml"; … … 48 50 if (!app.className.equals(OLD_CLASS)) 49 51 continue; 52 String client = "client application " + i + " [" + app.clientName + 53 "] from Jetty 5 " + OLD_CLASS + 54 " to Jetty 6 " + NEW_CLASS; 50 55 if (!hasJetty6()) { 51 System.err.println("WARNING: Jetty 6 unavailable, cannot migrate client " + i + 52 " from Jetty 5 class " + OLD_CLASS + 53 " to Jetty 6 class " + NEW_CLASS); 56 System.err.println("WARNING: Jetty 6 unavailable, cannot migrate " + client); 54 57 continue; 55 58 } … … 58 61 continue; 59 62 File xmlFile = new File(xml); 60 if ((!xmlFile.exists()) || (!xmlFile.isAbsolute())) { 63 if (!xmlFile.isAbsolute()) 64 xmlFile = new File(ctx.getAppDir(), xml); 65 if (!xmlFile.exists()) { 61 66 System.err.println("WARNING: XML file " + xmlFile + 62 " not found, cannot migrate client " + i + 63 " from Jetty 5 class " + OLD_CLASS + 64 " to Jetty 6 class " + NEW_CLASS); 67 " not found, cannot migrate " + client); 65 68 continue; 66 69 } 67 70 File eepsite = xmlFile.getParentFile(); 68 71 File backup = new File(eepsite, BACKUP); 69 if (backup.exists()) { 70 System.err.println("WARNING: Backup XML file " + backup + " already exists" + 71 ", cannot migrate client " + i + 72 " from Jetty 5 class " + OLD_CLASS + 73 " to Jetty 6 class " + NEW_CLASS); 74 continue; 75 } 72 if (backup.exists()) 73 backup = new File(eepsite, BACKUP + ctx.random().nextInt()); 76 74 boolean ok = WorkingDir.copyFile(xmlFile, backup); 77 75 if (!ok) { 78 76 System.err.println("WARNING: Failed to copy XML file " + xmlFile + " to " + backup + 79 ", cannot migrate client " + i + 80 " from Jetty 5 class " + OLD_CLASS + 81 " to Jetty 6 class " + NEW_CLASS); 77 ", cannot migrate " + client); 82 78 continue; 83 79 } 84 File baseEep = new File(ctx.getBaseDir(), "eepsite");80 File baseEep = new File(ctx.getBaseDir(), JETTY6_TEMPLATE_DIR); 85 81 // jetty.xml existed before in jetty 5 version, so check this new file 86 82 // and if it doesn't exist we can't continue … … 88 84 if (!baseContext.exists()) { 89 85 System.err.println("WARNING: Cannot find new XML file template " + baseContext + 90 ", cannot migrate client " + i + 91 " from Jetty 5 class " + OLD_CLASS + 92 " to Jetty 6 class " + NEW_CLASS); 86 ", cannot migrate " + client); 93 87 continue; 94 88 } … … 97 91 if (!ok) { 98 92 System.err.println("WARNING: Failed to modify XML file " + xmlFile + 99 ", cannot migrate client " + i + 100 " from Jetty 5 class " + OLD_CLASS + 101 " to Jetty 6 class " + NEW_CLASS); 93 ", cannot migrate " + client); 102 94 continue; 103 95 } 104 96 // now we're committed, so don't check any more failure codes 97 WorkingDir.migrateJettyXml(baseEep, eepsite, "jetty-ssl.xml", "./eepsite/", newPath); 105 98 (new File(eepsite, "contexts")).mkdir(); 106 99 WorkingDir.migrateJettyXml(baseEep, eepsite, BASE_CONTEXT, "./eepsite/", newPath); … … 115 108 app.className = NEW_CLASS; 116 109 shouldSave = true; 117 System.err.println("WARNING: Migrated client " + i + " from Jetty 5 class " + OLD_CLASS + 118 " to Jetty 6 class " + NEW_CLASS + ".\n" + 119 "Check the following files in " + baseEep + 110 System.err.println("WARNING: Migrated " + client + '\n' + 111 "Check the following files in " + eepsite + 120 112 ": jetty.xml, " + BASE_CONTEXT + ", and " + CGI_CONTEXT + "\n" + 121 "Your old jetty.xml was saved as jetty5.xml\n"+113 "Your old jetty.xml was saved as " + backup + '\n' + 122 114 "If you modified your jetty.xml to change ports, thread limits, etc, you MUST\n" + 123 115 "edit it to change them again. Your port was reset to 7658."); … … 126 118 File cfgFile = ClientAppConfig.configFile(ctx); 127 119 File backup = new File(cfgFile.getAbsolutePath() + ".jetty5"); 120 if (backup.exists()) 121 backup = new File(cfgFile.getAbsolutePath() + ctx.random().nextInt()); 128 122 boolean ok = WorkingDir.copyFile(cfgFile, backup); 129 123 if (ok) { 130 124 ClientAppConfig.writeClientAppConfig(ctx, apps); 131 125 System.err.println("WARNING: Migrated clients config file " + cfgFile + 132 " from Jetty 5 class" + OLD_CLASS +133 " to Jetty 6 class" + NEW_CLASS + "\n" +134 "Your old clients config file was saved as " + cfgFile + ".jetty5");126 " from Jetty 5 " + OLD_CLASS + 127 " to Jetty 6 " + NEW_CLASS + "\n" + 128 "Your old clients config file was saved as " + backup); 135 129 } 136 130 } -
router/java/src/net/i2p/router/startup/WorkingDir.java
rbeb6d1f4 rb5f97d0 149 149 // this one must be after MIGRATE_BASE 150 150 File oldEep = new File(oldDirf, "eepsite"); 151 File newEep = new File( oldDirf, "eepsite");151 File newEep = new File(dirf, "eepsite"); 152 152 String newPath = newEep.getAbsolutePath() + File.separatorChar; 153 153 success &= migrateJettyXml(oldEep, newEep, "jetty.xml", "./eepsite/", newPath); … … 246 246 out.println(s); 247 247 } 248 System.err.println("Copied clients.configwith modifications");248 System.err.println("Copied " + oldFile + " with modifications"); 249 249 return true; 250 250 } catch (IOException ioe) { 251 251 if (in != null) { 252 System.err.println("FAILED copy clients.config");252 System.err.println("FAILED copy " + oldFile + ": " + ioe); 253 253 return false; 254 254 } … … 281 281 } 282 282 out.println("<!-- Modified by I2P User dir migration script -->"); 283 System.err.println("Copied " + filename + " with modifications");283 System.err.println("Copied " + oldFile + " with modifications"); 284 284 return true; 285 285 } catch (IOException ioe) { 286 286 if (in != null) { 287 System.err.println("FAILED copy " + filename);287 System.err.println("FAILED copy " + oldFile + ": " + ioe); 288 288 return false; 289 289 } … … 358 358 System.err.println("Copied " + src.getPath()); 359 359 } catch (IOException ioe) { 360 System.err.println("FAILED copy " + src.getPath() );360 System.err.println("FAILED copy " + src.getPath() + ": " + ioe); 361 361 rv = false; 362 362 } finally {
Note: See TracChangeset
for help on using the changeset viewer.