diff --git a/build.sh b/build.sh index d91aafc..ca7f175 100755 --- a/build.sh +++ b/build.sh @@ -37,7 +37,7 @@ echo "compiling custom launcher" mkdir build cp "$I2P_JARS"/*.jar build cd java -"$JAVA_HOME"/bin/javac -d ../build -classpath "$HERE"/build/i2p.jar:"$HERE"/build/router.jar:"$HERE"/build/routerconsole.jar net/i2p/router/*.java #WinLauncher.java +"$JAVA_HOME"/bin/javac -d ../build -classpath "$HERE"/build/i2p.jar:"$HERE"/build/router.jar:"$HERE"/build/routerconsole.jar net/i2p/router/WinLauncher.java net/i2p/router/WindowsUpdatePostProcessor.java cd .. #echo "building launcher.jar" diff --git a/java/net/i2p/router/WinLauncher.java b/java/net/i2p/router/WinLauncher.java index 747291b..8ab3782 100644 --- a/java/net/i2p/router/WinLauncher.java +++ b/java/net/i2p/router/WinLauncher.java @@ -21,10 +21,10 @@ import static net.i2p.update.UpdateType.*; * i2p.dir.config this points to the (read-write) config directory in local appdata * router.pid - the pid of the java process. */ -public class WinLauncher extends WindowsUpdatePostProcessor { - - public void main(String[] args) throws Exception { - File programs = selectProgramFile(); +public class WinLauncher { + private static WindowsUpdatePostProcessor wupp = new WindowsUpdatePostProcessor(); + public static void main(String[] args) throws Exception { + File programs = wupp.selectProgramFile(); File home = selectHome(); if (!home.exists()) @@ -39,36 +39,41 @@ public class WinLauncher extends WindowsUpdatePostProcessor { System.setProperty("router.pid", String.valueOf(ProcessHandle.current().pid())); System.out.println("\t"+System.getProperty("i2p.dir.base") +"\n\t"+System.getProperty("i2p.dir.config")+"\n\t"+ System.getProperty("router.pid")); - i2pRouter = new Router(System.getProperties()); + wupp.i2pRouter = new Router(System.getProperties()); + System.out.println("Router is configured"); UpdateManager upmgr = updateManagerClient(); while (upmgr == null) { upmgr = updateManagerClient(); - System.out.println("Waiting for update manager so we can pull our own updates");; + System.out.println("Waiting for update manager so we can pull our own updates"); } - upmgr.register(this, ROUTER_SIGNED_SU3, 6); - upmgr.register(this, ROUTER_DEV_SU3, 6); + upmgr.register(wupp, ROUTER_SIGNED_SU3, 6); + System.out.println("Registered signed updates"); + upmgr.register(wupp, ROUTER_DEV_SU3, 6); + System.out.println("Registered dev updates"); - i2pRouter.runRouter(); + wupp.i2pRouter.runRouter(); } - private File selectHome() { //throws Exception { + private static File selectHome() { //throws Exception { if (SystemVersion.isWindows()) { File home = new File(System.getProperty("user.home")); File appData = new File(home, "AppData"); File local = new File(appData, "Local"); File i2p; i2p = new File(local, "I2P"); + System.out.println("Windows jpackage wrapper started, using: " + i2p + "as config"); return i2p.getAbsoluteFile(); } else { File jrehome = new File(System.getProperty("java.home")); File programs = new File(jrehome.getParentFile().getParentFile(), ".i2p"); + System.out.println("Linux portable jpackage wrapper started, using: " + programs + "as config"); return programs.getAbsoluteFile(); } } - private UpdateManager updateManagerClient() { - ClientAppManager clmgr = i2pRouter.getContext().getCurrentContext().clientAppManager(); + private static UpdateManager updateManagerClient() { + ClientAppManager clmgr = wupp.i2pRouter.getContext().getCurrentContext().clientAppManager(); if (clmgr == null) { return null; } diff --git a/java/net/i2p/router/WindowsUpdatePostProcessor.java b/java/net/i2p/router/WindowsUpdatePostProcessor.java index 942a528..6e74d92 100644 --- a/java/net/i2p/router/WindowsUpdatePostProcessor.java +++ b/java/net/i2p/router/WindowsUpdatePostProcessor.java @@ -18,7 +18,7 @@ import java.lang.InterruptedException; public class WindowsUpdatePostProcessor implements UpdatePostProcessor { private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(WindowsUpdatePostProcessor.class); - protected Router i2pRouter = null; + protected static Router i2pRouter = null; public void updateDownloadedandVerified(UpdateType type, int fileType, String version, File file) throws IOException { if (fileType == 6) {