Compare commits

...

56 Commits

Author SHA1 Message Date
idk
3ad4216ce4 make my TODO 2022-09-11 02:18:32 -04:00
idk
50d803d191 bump up the profile manager version again 2022-09-11 02:11:00 -04:00
idk
5d23b012ed change selectHome log message 2022-09-11 01:58:16 -04:00
idk
299cf5ef3e change from never call setStarting except in checkStarting 2022-09-11 01:53:08 -04:00
idk
fe68a39d94 change from never call setStarting except in checkStarting 2022-09-11 01:35:01 -04:00
idk
2f0f99f609 add functionality to find base config 2022-09-11 01:31:08 -04:00
idk
cf67f6c476 include config in app content 2022-09-11 00:31:31 -04:00
idk
4a7fb5f55c include config in app content 2022-09-11 00:21:57 -04:00
idk
a34079c8ab setNotStarting before i2pBrowser.launch 2022-09-11 00:06:27 -04:00
idk
bfcdabd794 Factor out functions in WinLauncher 2022-09-11 00:03:30 -04:00
idk
733167ea8d Factor out factors in WinLauncher 2022-09-10 23:56:57 -04:00
idk
36d61b3bf6 Factor out factors in WinLauncher 2022-09-10 23:51:13 -04:00
idk
d403fd4b09 start organizing the functions used to gather information about the environment it's running in differently so they make more sense 2022-09-10 22:14:34 -04:00
idk
736071a992 Start moving config copy logic 2022-09-09 00:52:54 -04:00
idk
81d9d13742 app-content not resource-dir 2022-09-09 00:18:59 -04:00
idk
e66fc3440c app-content not resource-dir 2022-09-09 00:07:36 -04:00
idk
f9e3d1b040 experiment with how jpackage handles packaging on it's own 2022-09-08 23:51:24 -04:00
idk
928ae1a85f Update changelog and clean script 2022-09-08 10:49:20 -04:00
idk
93b197efb9 exclude .git directory from tarball 2022-09-08 10:41:06 -04:00
idk
09ffb8edbe fix date in changelog 2022-09-08 10:37:01 -04:00
idk
cdc3224eaa Generate a tarball of the exact tag or branch it's built from, upload it when we do a daily 2022-09-08 10:34:53 -04:00
idk
2eeb2106fc shorten first-run checks timeout. 2022-09-07 16:19:21 -04:00
idk
26a7944470 add safety checks around Windows config stuff 2022-09-07 12:40:05 -04:00
idk
b97d581fcc add safety checks around Windows config stuff 2022-09-07 12:37:57 -04:00
idk
615818976a add safety checks around Windows config stuff 2022-09-07 12:34:19 -04:00
idk
e6fc5a349d when launching into a router console disable the proxy timeout 2022-09-07 12:29:54 -04:00
idk
3718d2edb9 when launching into a router console disable the proxy timeout 2022-09-07 12:26:11 -04:00
idk
4a55a8d4ab bump i2pfirefox version again 2022-09-07 04:36:50 -04:00
idk
a3a45b01e5 bump i2pfirefox version 2022-09-07 03:25:46 -04:00
idk
e07c43f1eb make sure args are of right type 2022-09-07 02:59:26 -04:00
idk
fd75a7e244 Fix parsing of arguments 2022-09-07 02:28:23 -04:00
idk
0e77d53c15 bump i2pfirefox version 2022-09-07 00:05:07 -04:00
idk
4dd9448752 bump version 2022-09-06 21:57:25 -04:00
idk
b220697af2 update i2pfirefox package, point release 2022-09-06 21:53:53 -04:00
idk
d9cffc9520 update version 2022-09-06 15:45:53 -04:00
idk
c8590e4fe5 fix redundant option 2022-09-06 01:31:55 -04:00
idk
3c8b1b6d28 try an experiment where I build an MSI 2022-09-06 01:29:30 -04:00
idk
460837d7f5 bump again 2022-09-05 14:19:35 -04:00
idk
2bd3abe6bb re-add self-run of I2P.exe to save users a click, this needs testing but since I've got 3 VM's and 3 laptops on my desk right now I'm going to do it right now 2022-09-05 14:12:00 -04:00
idk
5ef6118b91 bump version again 2022-09-05 10:42:24 -04:00
idk
394f58f90e bump launcher lib again 2022-09-05 10:23:17 -04:00
idk
5ee89f98a9 chnge tunnel nickname of HTTP proxy 2022-09-05 03:01:11 -04:00
idk
6736d527a2 setNotRunning must be called on browser launch too 2022-09-05 02:55:35 -04:00
idk
ef203ba935 setNotRunning before launching the router, counter-intuitively but this is for determining whether we should launch the browser only. The other checks will still work for determining if a router is there. It only needs to be there for the first 21 or so seconds. 2022-09-05 02:00:54 -04:00
idk
3749f49641 setNotRunning before launching the router, counter-intuitively but this is for determining whether we should launch the browser only. The other checks will still work for determining if a router is there. It only needs to be there for the first 21 or so seconds. 2022-09-05 01:58:53 -04:00
idk
d63128096c Bump browserlauncher version 2022-09-05 01:51:28 -04:00
idk
51cb4c608a enable faster router startup 2022-09-05 01:47:16 -04:00
idk
f920fa8090 further accelerate startups 2022-09-05 00:41:51 -04:00
idk
252a80eb72 further accelerate startups 2022-09-05 00:41:20 -04:00
idk
ed7814cd74 enable faster startups 2022-09-04 23:56:07 -04:00
idk
073ba01da6 Lessen startup delay/timeout 2022-09-04 23:50:58 -04:00
idk
7caf03d6e4 Bump again 2022-09-04 23:12:52 -04:00
idk
c3934ab4e4 switch i2p.exe to /bin/false 2022-09-04 22:40:25 -04:00
idk
54ffdc2352 bump version and extend timeout again 2022-09-04 21:37:25 -04:00
idk
ab2548ecd4 bump version and extend timeout again 2022-09-04 21:34:14 -04:00
idk
5cf5d56738 check for up to a whole 20 seconds to see if a router is running instead of just 2 2022-09-04 14:45:10 -04:00
18 changed files with 530 additions and 121 deletions

View File

@ -78,7 +78,7 @@ build/I2P: I2P build
cp -rv I2P build/I2P ; true
cp "$(I2P_JBIGI)"/*windows*.dll build/I2P/runtime/lib; true
src/I2P/config: build/I2P
src/I2P/config:
mkdir -p src/I2P/config
rm -rf src/I2P/config/geoip src/I2P/config/webapps src/I2P/config/certificates
echo true | tee src/I2P/config/jpackaged

View File

@ -41,6 +41,7 @@ sleep 5s
HERE="$PWD"
if [ ! -d "$HERE/../i2p.i2p.jpackage-build/" ]; then
git clone -b "$VERSION" https://i2pgit.org/i2p-hackers/i2p.i2p "$HERE/../i2p.i2p.jpackage-build/"
tar --exclude="$HERE/../i2p.i2p.jpackage-build/.git" -cvzf i2p.i2p.jpackage-build.tar.gz "$HERE/../i2p.i2p.jpackage-build/"
fi
cd "$HERE/../i2p.i2p.jpackage-build/"
for i in $COUNT; do
@ -90,6 +91,9 @@ fi
echo "preparing to invoke jpackage for I2P version $I2P_VERSION"
rm -rf I2P
make src/I2P/config
"$JAVA_HOME"/bin/jpackage --type app-image --name I2P --app-version "$I2P_VERSION" \
--verbose \
--java-options "-Xmx512m" \
@ -100,6 +104,7 @@ rm -rf I2P
--java-options "--add-opens java.base/java.util.Properties.defaults=ALL-UNNAMED" \
$JPACKAGE_OPTS \
--resource-dir build \
--app-content src/I2P/config \
--input build --main-jar launcher.jar --main-class net.i2p.router.WinLauncher
cp "$I2P_PKG/licenses/"* license/

View File

@ -1,3 +1,11 @@
2022-09-08 idk
* Generate a source tarball when we checkout a branch of i2p.i2p
* Upload a source tarball when we do a daily build
* Clean up a source tarball when running the clean script. Regenerate tarball after cleaning.
2022-09-06 idk
* Point release 1.9.5, fixes a bug which occurs more often on Windows 11, fixes a SusiDNS issue
2022-08-28 idk
* Migrate away from batch scripts and simply launch a browser if I2P is already running.
This is more flexible, stable, and simplet to install

View File

@ -4,6 +4,7 @@ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
cd "$SCRIPT_DIR" || exit 1
. "$SCRIPT_DIR/config.sh"
. "$SCRIPT_DIR/i2pversion"
if [ -f config_overide.sh ]; then
. "$SCRIPT_DIR/config_override.sh"
@ -11,8 +12,9 @@ fi
cd ../i2p.i2p.jpackage-build/
ant distclean
git clean -fd
git checkout .
git checkout master
tar --exclude="$SCRIPT_DIR/../i2p.i2p.jpackage-build/.git" -cvzf "$SCRIPT_DIR/../i2p.i2p.jpackage-build.tar.gz" "$SCRIPT_DIR/../i2p.i2p.jpackage-build/"
cd "$SCRIPT_DIR" || exit 1
rm -rf \
build \

View File

@ -3,16 +3,28 @@
## If you need to use a different JVM, JDK, or other utility from
# build.sh, set it in this file, for example:
uname=$(uname)
#export PATH="$PATH:/c/Program Files/Java/jdk-17.0.3/bin/"
#export JAVA_HOME="/c/Program Files/Java/jdk-17.0.3"
# to use it for Oracle OpenJDK17
## Other potential values(NOT exhaustive):
PATH="/c/Program Files/Java/jdk-18.0.2/bin/:$PATH:/c/Program Files/Java/jdk-18.0.2/bin/"
export PATH="/c/Program Files/Java/jdk-18.0.2/bin/:$PATH:/c/Program Files/Java/jdk-18.0.2/bin/"
JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
export JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
if [[ -n "$IS_WSL" || -n "$WSL_DISTRO_NAME" ]]; then
PATH="/c/Program Files/Java/jdk-18.0.2/bin/:$PATH:/c/Program Files/Java/jdk-18.0.2/bin/"
export PATH="/c/Program Files/Java/jdk-18.0.2/bin/:$PATH:/c/Program Files/Java/jdk-18.0.2/bin/"
JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
export JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
fi
if [ "${uname}" != "Linux" ]; then
PATH="/c/Program Files/Java/jdk-18.0.2/bin/:$PATH:/c/Program Files/Java/jdk-18.0.2/bin/"
export PATH="/c/Program Files/Java/jdk-18.0.2/bin/:$PATH:/c/Program Files/Java/jdk-18.0.2/bin/"
JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
export JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
fi
#export PATH="$PATH:/c/Program Files/Eclipse Adoptium/jdk-17.0.3/bin/"
#export JAVA_HOME="/c/Program Files/Eclipse Adoptium/jdk-17.0.3"
#export PATH="$PATH:/c/Program Files/OpenJDK/jdk-17.0.3/bin/"
@ -49,6 +61,12 @@ export JAVA_HOME="/c/Program Files/Java/jdk-18.0.2"
#export ANT_HOME="/c/apache-ant-1.10.9"
#export PATH="$PATH:$ANT_HOME/bin/"
# Uncomment this to add signtool to the path so you don't have to fight with Visual Studio.
PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"
export PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"
if [[ -n "$IS_WSL" || -n "$WSL_DISTRO_NAME" ]]; then
PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"
export PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"
fi
if [ "${uname}" != "Linux" ]; then
PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"
export PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"
fi

View File

@ -49,3 +49,7 @@ tar -a -cf ../I2P.zip I2P
ZIPCHECKSUM=$(sha256sum "../I2P.zip")
echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "../I2P.zip" -l "$ZIPCHECKSUM" -t "$TODAYSDATE" -n "I2P.zip"
github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "../I2P.zip" -l "$ZIPCHECKSUM" -t "$TODAYSDATE" -n "I2P.zip"
TARCHECKSUM=$(sha256sum "i2p.i2p.jpackage-build.tar.gz")
echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "i2p.i2p.jpackage-build.tar.gz" -l "Upstream I2P Router source code $TARCHECKSUM" -t "$TODAYSDATE" -n "i2p.i2p.jpackage-build.tar.gz"
github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "i2p.i2p.jpackage-build.tar.gz" -l "Upstream I2P Router source code $TARCHECKSUM" -t "$TODAYSDATE" -n "i2p.i2p.jpackage-build.tar.gz"

40
exe.sh Executable file
View File

@ -0,0 +1,40 @@
#! /usr/bin/env sh
## EXPERIMENTAL. PROBABLY WON'T SEE THE LIGHT OF DAY BUT MAYBE I GET LUCKY.
# Motivation
. ./config.sh
. ./i2pversion
jpackage --name I2P-EXE --app-version "$I2P_VERSION" \
--verbose \
--java-options "-Xmx512m" \
--java-options "--add-opens java.base/java.lang=ALL-UNNAMED" \
--java-options "--add-opens java.base/sun.nio.fs=ALL-UNNAMED" \
--java-options "--add-opens java.base/java.nio=ALL-UNNAMED" \
--java-options "--add-opens java.base/java.util.Properties=ALL-UNNAMED" \
--java-options "--add-opens java.base/java.util.Properties.defaults=ALL-UNNAMED" \
$JPACKAGE_OPTS \
--app-content build/I2P/config/certificates \
--app-content build/I2P/config/eepsite \
--app-content build/I2P/config/geoip \
--app-content build/I2P/config/webapps \
--app-content build/I2P/config/clients.config \
--app-content build/I2P/config/hosts.txt \
--app-content build/I2P/config/i2ptunnel.config \
--app-content build/I2P/config/jpackaged \
--app-content build/I2P/config/router.config \
--app-content build/I2P/config/wrappper.config \
--input build \
--verbose \
--type exe \
--win-dir-chooser \
--win-help-url "https://geti2p.net" \
--win-menu \
--win-menu-group "I2P Easy-Install Bundle" \
--win-shortcut \
--win-shortcut-prompt \
--win-per-user-install \
--license-file LICENSE.md \
--main-jar launcher.jar \
--main-class net.i2p.router.WinLauncher

View File

@ -24,8 +24,8 @@ tunnel.0.listenPort=4444
tunnel.0.proxyList=false.i2p
tunnel.0.i2cpHost=127.0.0.1
tunnel.0.i2cpPort=7654
tunnel.0.option.inbound.nickname=shared clients
tunnel.0.option.outbound.nickname=shared clients
tunnel.0.option.inbound.nickname=HTTP Proxy
tunnel.0.option.outbound.nickname=HTTP Proxy
tunnel.0.option.i2cp.leaseSetEncType=4,0
tunnel.0.option.i2cp.reduceIdleTime=900000
tunnel.0.option.i2cp.reduceOnIdle=true

View File

@ -2,20 +2,15 @@
JNA_VERSION=5.11.0
export JNA_VERSION=5.11.0
I2PFIREFOX_VERSION=0.0.22
export I2PFIREFOX_VERSION=0.0.22
#Comment this out to build from an alternate branch or
I2PFIREFOX_VERSION=0.0.34
export I2PFIREFOX_VERSION=0.0.36
# Comment this out to build from an alternate branch or
# the tip of the master branch.
VERSIONMAJOR=1
VERSIONMINOR=9
VERSIONBUILD=1
VERSIONBUILD=5
I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
export I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
VERSION=i2p-jpackage-1.9.1
export VERSION=i2p-jpackage-1.9.1
VERSION=i2p-jpackage-1.9.4
export VERSION=i2p-jpackage-1.9.4
#Uncomment this to build from the tip of the master.
#I2P_VERSION=1.8.0
#export I2P_VERSION=1.8.0
#VERSION=master
#export VERSION="$VERSION"

View File

@ -0,0 +1,76 @@
package net.i2p.router;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
public class CopyConfigDir {
public boolean copyDirectory(String baseDir, String workDir) {
File baseFile = new File(baseDir);
File workFile = new File(workDir);
return copyDirectory(baseFile, workFile);
}
public boolean copyDirectory(File baseDir, File workDir) {
for (File file : baseDir.listFiles()) {
System.out.println(file.getAbsolutePath());
if (file.isDirectory())
copyDirectory(file, new File(workDir, file.toString()));
if (file.isFile())
copyFileNeverOverwrite(file, new File(workDir, file.toString()));
}
return true;
}
public boolean copyConfigDirectory(File baseDir, File workDir) {
for (File file : baseDir.listFiles()) {
System.out.println(file.getAbsolutePath());
if (file.isDirectory())
copyDirectory(file, new File(workDir, file.toString()));
if (file.isFile())
copyFileNeverOverwrite(file, new File(workDir, file.toString()));
}
return true;
}
public boolean copyFileNeverOverwrite(String basePath, String workPath) {
File baseFile = new File(basePath);
File workFile = new File(workPath);
return copyFileNeverOverwrite(baseFile, workFile);
}
public boolean copyFileNeverOverwrite(File basePath, File workPath) {
return copyFile(basePath, workPath, false);
}
public boolean copyFile(File basePath, File workPath, boolean overWrite) {
if (!basePath.exists()) {
return false;
}
if (!overWrite && workPath.exists()) {
return false;
}
try (InputStream in =
new BufferedInputStream(new FileInputStream(basePath));
OutputStream out =
new BufferedOutputStream(new FileOutputStream(workPath))) {
byte[] buffer = new byte[1024];
int lengthRead;
while ((lengthRead = in.read(buffer)) > 0) {
out.write(buffer, 0, lengthRead);
out.flush();
}
in.close();
out.close();
return true;
} catch (Throwable e) {
return false;
}
}
}

View File

@ -35,73 +35,73 @@ public class WinLauncher {
static FileHandler fh;
public static void main(String[] args) throws Exception {
try {
// This block configure the logger with handler and formatter
fh = new FileHandler(logFile().toString());
logger.addHandler(fh);
SimpleFormatter formatter = new SimpleFormatter();
fh.setFormatter(formatter);
// the following statement is used to log any messages
logger.info("My first log");
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
setupLauncher();
boolean privateBrowsing = false;
boolean usabilityMode = false;
boolean chromiumFirst = false;
int proxyTimeoutTime = 200;
ArrayList<String> newArgsList = new ArrayList<String>();
if (args != null) {
if (args.length > 0) {
logger.info("checking for private browsing");
if (args[0].equals("-private")) {
privateBrowsing = true;
logger.info(
"Private browsing is true, profile will be discarded at end of session.");
}
if (args[0].equals("-chromium")) {
chromiumFirst = true;
logger.info("Chromium will be selected before Firefox.");
}
if (args[0].equals("-usability")) {
usabilityMode = true;
logger.info(
"Usability mode is true, using alternate extensions loadout.");
for (String arg : args) {
if (arg.equals("-private")) {
privateBrowsing = true;
logger.info(
"Private browsing is true, profile will be discarded at end of session.");
} else if (arg.equals("-chromium")) {
chromiumFirst = true;
logger.info("Chromium will be selected before Firefox.");
} else if (arg.equals("-usability")) {
usabilityMode = true;
logger.info(
"Usability mode is true, using alternate extensions loadout.");
} else if (arg.equals("-noproxycheck")) {
proxyTimeoutTime = 0;
logger.info("Proxy timeout time set to zero");
} else {
// make an effort to not let people launch into sites if the proxy
// isn't quite ready yet, but also disable the proxy timeout if
// they're reaching a router console
if (arg.startsWith("http://localhost:76")) {
newArgsList.add(arg);
proxyTimeoutTime = 0;
} else if (arg.startsWith("http://127.0.0.1:76")) {
newArgsList.add(arg);
proxyTimeoutTime = 0;
} else if (arg.startsWith("https://localhost:76")) {
newArgsList.add(arg);
proxyTimeoutTime = 0;
} else if (arg.startsWith("https://127.0.0.1:76")) {
newArgsList.add(arg);
proxyTimeoutTime = 0;
} else if (proxyTimeoutTime > 0) {
newArgsList.add(arg);
} else if (!isAvailable(4444)) {
newArgsList.add(arg);
}
}
}
}
}
File programs = selectProgramFile();
if (!programs.exists())
programs.mkdirs();
else if (!programs.isDirectory()) {
logger.warning(
programs +
" exists but is not a directory. Please get it out of the way");
System.exit(1);
}
File programs = programFile();
File home = homeDir();
File home = selectHome();
if (!home.exists())
home.mkdirs();
else if (!home.isDirectory()) {
logger.warning(
home +
" exists but is not a directory. Please get it out of the way");
System.exit(1);
}
// TODO: I want to minimize the amount of stuff I have to rely on NSIS for
// and if I
// 1. make the config directory inclusion part of the jpackage step
// and
// 2. make the launcher copy new or missing config files at launch
// then NSIS serves primarily as a way of providing multilanguage
// support in the installer. It has a higher degree of customization,
// but probably ceases to be necessary, I can make jpackage generate
// the installer, **and** I get to build every other kind of jpackage
// powered package.
if (i2pIsRunning()) {
logger.warning("I2P is already running");
I2PBrowser i2pBrowser = new I2PBrowser();
i2pBrowser.usability = usabilityMode;
i2pBrowser.chromiumFirst = chromiumFirst;
i2pBrowser.firefox = !chromiumFirst;
i2pBrowser.chromium = chromiumFirst;
System.out.println("I2PBrowser");
i2pBrowser.launch(privateBrowsing);
return;
if (launchBrowser(privateBrowsing, usabilityMode, chromiumFirst,
proxyTimeoutTime, newArgsList)) {
System.exit(0);
}
System.setProperty("i2p.dir.base", programs.getAbsolutePath());
@ -111,7 +111,7 @@ public class WinLauncher {
logger.info("\t" + System.getProperty("i2p.dir.base") + "\n\t" +
System.getProperty("i2p.dir.config") + "\n\t" +
System.getProperty("router.pid"));
/**
/**
* IMPORTANT: You must set user.dir to the same directory where the
* jpackage is intstalled, or when the launcher tries to re-run itself
* to start the browser, it will start in the wrong directory and fail
@ -127,13 +127,86 @@ public class WinLauncher {
registrationThread.setDaemon(true);
registrationThread.start();
setNotStarting();
// wupp.i2pRouter.runRouter();
RouterLaunch.main(args);
}
private static void setupLauncher() {
try {
// This block configure the logger with handler and formatter
fh = new FileHandler(logFile().toString());
logger.addHandler(fh);
SimpleFormatter formatter = new SimpleFormatter();
fh.setFormatter(formatter);
// the following statement is used to log any messages
logger.info("My first log");
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
File jrehome = javaHome();
logger.info("jre home is: " + jrehome.getAbsolutePath());
File appimagehome = appImageHome();
logger.info("appimage home is: " + appimagehome.getAbsolutePath());
}
private static File programFile() {
File programs = selectProgramFile();
if (!programs.exists())
programs.mkdirs();
else if (!programs.isDirectory()) {
logger.warning(
programs +
" exists but is not a directory. Please get it out of the way");
System.exit(1);
}
return programs;
}
private static File homeDir() {
File home = selectHome();
if (!home.exists())
home.mkdirs();
else if (!home.isDirectory()) {
logger.warning(
home +
" exists but is not a directory. Please get it out of the way");
System.exit(1);
}
return home;
}
private static boolean launchBrowser(boolean privateBrowsing,
boolean usabilityMode,
boolean chromiumFirst,
int proxyTimeoutTime,
ArrayList<String> newArgsList) {
if (i2pIsRunning()) {
logger.info("I2P is already running, launching an I2P browser");
I2PBrowser i2pBrowser = new I2PBrowser();
i2pBrowser.usability = usabilityMode;
i2pBrowser.chromiumFirst = chromiumFirst;
i2pBrowser.firefox = !chromiumFirst;
i2pBrowser.chromium = chromiumFirst;
if (chromiumFirst) {
logger.warning("favoring Chromium instead of Firefox");
}
i2pBrowser.setProxyTimeoutTime(proxyTimeoutTime);
System.out.println("I2PBrowser");
String[] newArgs = newArgsList.toArray(new String[newArgsList.size()]);
setNotStarting();
i2pBrowser.launch(privateBrowsing, newArgs);
return true;
}
return false;
}
// see
// https://stackoverflow.com/questions/434718/sockets-discover-port-availability-using-java
public static boolean isAvailable(int portNr) {
private static boolean isAvailable(int portNr) {
boolean portFree;
try (var ignored = new ServerSocket(portNr)) {
portFree = true;
@ -143,67 +216,108 @@ public class WinLauncher {
return portFree;
}
private static boolean i2pIsRunning() {
sleep(2000);
private static boolean i2pIsRunningCheck() {
// check if there's something listening on port 7657(Router Console)
if (!isAvailable(7657)) {
if (!isAvailable(7657))
return true;
}
// check if there's something listening on port 7654(I2CP)
if (!isAvailable(7654)) {
if (!isAvailable(7654))
return true;
if (checkPing())
return true;
return false;
}
private static void setNotStarting() {
logger.info("removing startup file, the application has started");
File home = selectHome();
File starting = new File(home, "starting");
if (starting.exists()) {
starting.delete();
}
}
private static void setStarting() {
logger.info("creating startup file, router is starting up");
File home = selectHome();
File starting = new File(home, "starting");
if (!starting.exists()) {
try {
starting.createNewFile();
} catch (IOException e) {
logger.info(e.toString());
}
}
}
private static boolean checkStarting() {
logger.info("checking startup file");
File home = selectHome();
File starting = new File(home, "starting");
if (starting.exists()) {
logger.info("startup file exists, I2P is already starting up");
return true;
}
// check for the existence of router.ping file, if it's less then 2 minutes
// old, exit
logger.info("startup file does not exist but we're running now");
setStarting();
return false;
}
// check for the existence of router.ping file, if it's less then 2
// minutes old, exit
private static boolean checkPing() {
File home = selectHome();
File ping = new File(home, "router.ping");
if (ping.exists()) {
long diff = System.currentTimeMillis() - ping.lastModified();
if (diff < 60 * 1000) {
if (diff > 60 * 1000) {
logger.info(
"router.ping exists and is less than 1 minute old, I2P appears to be running already.");
logger.info("If I2P is not running, wait 60 seconds and try again.");
"router.ping exists and is more than 1 minute old, I2P does not appear to be running.");
logger.info("If I2P is running, report this as a bug.");
return false;
} else {
return true;
}
}
return false;
}
private static final Runnable REGISTER_UPP = () -> {
private static boolean i2pIsRunning() {
if (checkStarting())
return true;
if (checkPing())
return true;
if (i2pIsRunningCheck())
return true;
for (int i = 0; i < 10; i++) {
if (i2pIsRunningCheck())
return true;
sleep(1000);
}
return false;
}
private static final Runnable REGISTER_UPP = () -> {
// first wait for the RouterContext to appear
RouterContext ctx;
while ((ctx = (RouterContext)RouterContext.getCurrentContext()) == null) {
sleep(1000);
}
// then wait for the update manager
ClientAppManager cam;
while ((cam = ctx.clientAppManager()) == null) {
sleep(1000);
}
UpdateManager um;
while ((um = (UpdateManager)cam.getRegisteredApp(UpdateManager.APP_NAME)) ==
null) {
sleep(1000);
}
WindowsUpdatePostProcessor wupp = new WindowsUpdatePostProcessor(ctx);
um.register(wupp, UpdateType.ROUTER_SIGNED_SU3, SU3File.TYPE_EXE);
um.register(wupp, UpdateType.ROUTER_DEV_SU3, SU3File.TYPE_EXE);
};
private static void sleep(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException bad) {
bad.printStackTrace();
throw new RuntimeException(bad);
}
}
private static File selectHome() { // throws Exception {
String path_override = System.getenv("I2P_CONFIG");
if (path_override != null) {
@ -216,18 +330,13 @@ public class WinLauncher {
}
}
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");
logger.info("Windows jpackage wrapper started, using: " + i2p +
" as base config");
return i2p.getAbsoluteFile();
File i2p = appImageHome();
logger.info("Checking for signs of life in I2P directory: " + i2p);
return i2p;
} else {
File jrehome = new File(System.getProperty("java.home"));
File programs = new File(jrehome.getParentFile().getParentFile(), ".i2p");
logger.info("Linux portable jpackage wrapper started, using: " +
File i2p = appImageHome();
File programs = new File(i2p, ".i2p");
logger.info("Linux portable jpackage wrapper starting up, using: " +
programs + " as base config");
return programs.getAbsoluteFile();
}
@ -259,10 +368,122 @@ public class WinLauncher {
}
}
/**
* get the OS name(windows, mac, linux only)
*
* @return os name in lower-case, "windows" "mac" or "linux"
*/
private static String osName() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows"))
return "windows";
if (osName.contains("mac"))
return "mac";
return "linux";
}
/**
* get the path to the java home, for jpackage this is related to the
* executable itself, which is handy to know. It's a directory called runtime,
* relative to the root of the app-image on each platform:
*
* Windows - Root of appimage is 1 directory above directory named runtime
* ./runtime
*
* Linux - Root of appimage is 2 directories above directory named runtime
* ./lib/runtime
*
* Mac OSX - Unknown for now
*
* @return
*/
private static File javaHome() {
File jrehome = new File(System.getProperty("java.home"));
if (jrehome != null) {
if (jrehome.exists()) {
return jrehome;
}
}
return null;
}
/**
* get the path to the root of the app-image root by getting the path to
* java.home and the OS, and traversing up to the app-image root based on that
* information.
*
* @return the app-image root
*/
private static File appImageHome() {
File jreHome = javaHome();
if (jreHome != null) {
switch (osName()) {
case "windows":
return jreHome.getAbsoluteFile().getParentFile();
case "mac":
case "linux":
return jreHome.getAbsoluteFile().getParentFile().getParentFile();
}
}
return null;
}
/**
* get the path to the default config of the app-image by getting the path to
* java.home and the OS, and traversing up to the app-image root based on that
* information, then appending lib/config to the end.
*
* @return the app-image root
*/
private static File appImageConfig() {
File aih = appImageHome();
if (aih == null) {
return null;
}
String osName = osName();
switch (osName) {
case "windows":
File winConfigDir = new File(aih, "config");
if (winConfigDir != null) {
if (winConfigDir.exists()) {
return winConfigDir;
}
}
case "mac":
case "linux":
File linConfigDir = new File(aih, "lib/config");
if (linConfigDir != null) {
if (linConfigDir.exists()) {
return linConfigDir;
}
}
}
return null;
}
/**
* set up the path to the log file
*
* @return
*/
private static File logFile() {
File log = new File(selectProgramFile(), "log");
File log = new File(selectProgramFile(), "logs");
if (!log.exists())
log.mkdirs();
return new File(log, "launcher.log");
}
/**
* sleep for 1 second
*
* @param millis
*/
private static void sleep(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException bad) {
bad.printStackTrace();
throw new RuntimeException(bad);
}
}
}

40
msi.sh Executable file
View File

@ -0,0 +1,40 @@
#! /usr/bin/env sh
## EXPERIMENTAL. PROBABLY WON'T SEE THE LIGHT OF DAY BUT MAYBE I GET LUCKY.
# Motivation
. ./config.sh
. ./i2pversion
jpackage --name I2P-MSI --app-version "$I2P_VERSION" \
--verbose \
--java-options "-Xmx512m" \
--java-options "--add-opens java.base/java.lang=ALL-UNNAMED" \
--java-options "--add-opens java.base/sun.nio.fs=ALL-UNNAMED" \
--java-options "--add-opens java.base/java.nio=ALL-UNNAMED" \
--java-options "--add-opens java.base/java.util.Properties=ALL-UNNAMED" \
--java-options "--add-opens java.base/java.util.Properties.defaults=ALL-UNNAMED" \
$JPACKAGE_OPTS \
--app-content build/I2P/config/certificates \
--app-content build/I2P/config/eepsite \
--app-content build/I2P/config/geoip \
--app-content build/I2P/config/webapps \
--app-content build/I2P/config/clients.config \
--app-content build/I2P/config/hosts.txt \
--app-content build/I2P/config/i2ptunnel.config \
--app-content build/I2P/config/jpackaged \
--app-content build/I2P/config/router.config \
--app-content build/I2P/config/wrappper.config \
--input build \
--verbose \
--type msi \
--win-dir-chooser \
--win-help-url "https://geti2p.net" \
--win-menu \
--win-menu-group "I2P Easy-Install Bundle" \
--win-shortcut \
--win-shortcut-prompt \
--win-per-user-install \
--license-file LICENSE.md \
--main-jar launcher.jar \
--main-class net.i2p.router.WinLauncher

View File

@ -1,5 +1,5 @@
router.updateURL=http://ekm3fu6fr5pxudhwjmdiea5dovc3jdi66hjgop4c7z7dfaw7spca.b32.i2p/i2pwinupdate.su3
router.newsURL=http://dn3tvalnjz432qkqsvpfdqrwpqkw3ye4n4i2uyfr4jexvo3sp5ka.b32.i2p/news/win/beta/news.su3
router.backupNewsURL=http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/win/beta/news.su3
routerconsole.browser=I2P.exe
routerconsole.browser=I2P.exe -noproxycheck
router.disableTunnelTesting=false

View File

@ -40,6 +40,6 @@ if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
linuxsign I2P-Profile-Installer-$I2P_VERSION.exe
cp "I2P-Profile-Installer-$I2P_VERSION.exe" "I2P-Profile-Installer-$I2P_VERSION-signed.exe"
else
signtool.exe sign /a "I2P-Profile-Installer-$I2P_VERSION.exe"
signtool.exe sign -a "I2P-Profile-Installer-$I2P_VERSION.exe"
cp "I2P-Profile-Installer-$I2P_VERSION.exe" "I2P-Profile-Installer-$I2P_VERSION-signed.exe"
fi

View File

@ -1 +1 @@
1.9.1
1.9.5

View File

@ -1 +1 @@
!define I2P_VERSION 1.9.1
!define I2P_VERSION 1.9.5

View File

@ -1,3 +1,3 @@
!define VERSIONMAJOR 1
!define VERSIONMINOR 9
!define VERSIONBUILD 1
!define VERSIONBUILD 5

View File

@ -1 +1 @@
1.9.1
1.9.5