(release in the next hour or so)
2004-09-08 jrandom * Updated the "Active:" peer count to display the # of connections as well as the number of recently active router identities. * Implement some basic updating code - on startup, if there is a file named "i2pupdate.zip" in the I2P installation directory, extract it, delete it, then restart. * Added an ugly little script to allow launching the router on win9x machines without a dos box (using javaw to run a .bat file). * Logging updates. * Updated VERSION constants to 0.4.0.1
This commit is contained in:
@ -14,8 +14,8 @@ package net.i2p;
|
||||
*
|
||||
*/
|
||||
public class CoreVersion {
|
||||
public final static String ID = "$Revision: 1.18 $ $Date: 2004/08/20 14:56:35 $";
|
||||
public final static String VERSION = "0.4";
|
||||
public final static String ID = "$Revision: 1.19 $ $Date: 2004/09/03 14:46:07 $";
|
||||
public final static String VERSION = "0.4.0.1";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Core version: " + VERSION);
|
||||
|
@ -24,12 +24,15 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import net.i2p.util.OrderedProperties;
|
||||
|
||||
@ -636,4 +639,62 @@ public class DataHelper {
|
||||
if (fis != null) try { fis.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean extractZip(File zipfile, File targetDir) {
|
||||
try {
|
||||
byte buf[] = new byte[16*1024];
|
||||
ZipFile zip = new ZipFile(zipfile);
|
||||
Enumeration entries = zip.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry)entries.nextElement();
|
||||
if (entry.getName().indexOf("..") != -1) {
|
||||
System.err.println("ERROR: Refusing to extract a zip entry with '..' in it [" + entry.getName() + "]");
|
||||
return false;
|
||||
}
|
||||
File target = new File(targetDir, entry.getName());
|
||||
File parent = target.getParentFile();
|
||||
if ( (parent != null) && (!parent.exists()) ) {
|
||||
boolean parentsOk = parent.mkdirs();
|
||||
if (!parentsOk) {
|
||||
System.err.println("ERROR: Unable to create the parent dir for " + entry.getName() + ": [" + parent.getAbsolutePath() + "]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (entry.isDirectory()) {
|
||||
if (!target.exists()) {
|
||||
boolean created = target.mkdirs();
|
||||
if (!created) {
|
||||
System.err.println("ERROR: Unable to create the directory [" + entry.getName() + "]");
|
||||
return false;
|
||||
} else {
|
||||
System.err.println("INFO: Creating directory [" + entry.getName() + "]");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
InputStream in = zip.getInputStream(entry);
|
||||
FileOutputStream fos = new FileOutputStream(target);
|
||||
int read = 0;
|
||||
while ( (read = in.read(buf)) != -1) {
|
||||
fos.write(buf, 0, read);
|
||||
}
|
||||
fos.close();
|
||||
in.close();
|
||||
|
||||
System.err.println("INFO: File [" + entry.getName() + "] extracted");
|
||||
} catch (IOException ioe) {
|
||||
System.err.println("ERROR: Error extracting the zip entry (" + entry.getName() + "]");
|
||||
ioe.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
zip.close();
|
||||
return true;
|
||||
} catch (IOException ioe) {
|
||||
System.err.println("ERROR: Unable to extract the zip file");
|
||||
ioe.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +339,20 @@ public class ShellCommand {
|
||||
return _outputStream;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (args.length <= 0) {
|
||||
System.err.println("Usage: ShellCommand commandline");
|
||||
return;
|
||||
}
|
||||
ShellCommand cmd = new ShellCommand();
|
||||
StringBuffer command = new StringBuffer(64);
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
command.append("\"").append(args[i]).append("\" ");
|
||||
}
|
||||
cmd.execute(command.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
private boolean execute(String shellCommand, boolean consumeOutput, boolean waitForExitStatus) {
|
||||
|
||||
StreamConsumer processStderrConsumer;
|
||||
|
Reference in New Issue
Block a user