Compare commits

..

17 Commits

Author SHA1 Message Date
eyedeekay
1611312f25 find a writable directory when we're a snap 2024-06-27 02:16:14 -04:00
eyedeekay
1e4d327ca2 find a writable directory when we're a snap 2024-06-27 02:15:35 -04:00
eyedeekay
045c6dbfbd fix the eepsite directory also
Some checks failed
Java CI / nsis (push) Has been cancelled
Java CI / buildjpackagexe (push) Has been cancelled
Java CI / buildjpackagmsi (push) Has been cancelled
Java CI / buildzip (push) Has been cancelled
Java CI / buildtgz (push) Has been cancelled
Nightly Release / build (push) Has been cancelled
2024-06-27 00:01:05 -04:00
eyedeekay
e13156005f Fix plugin path so it works everywhere 2024-06-26 23:16:23 -04:00
eyedeekay
1a3d0743ab Fix plugin path so it works everywhere 2024-06-26 21:39:58 -04:00
eyedeekay
a41a4824fe Work on a wine build 2024-06-26 21:34:46 -04:00
eyedeekay
093ac9fe5d Always make Nightly also Latest 2024-06-26 21:23:35 -04:00
eyedeekay
855887da6b Update nightly release text 2024-06-26 20:53:55 -04:00
eyedeekay
9ecd701462 Update nightly release text 2024-06-26 20:53:35 -04:00
eyedeekay
66f77fec8d Allow replacing nightly releases 2024-06-26 20:50:26 -04:00
eyedeekay
8471360a63 Rename nightly release jobs 2024-06-26 20:24:28 -04:00
eyedeekay
c006fb0ca8 Set up nightly releases 2024-06-26 20:23:12 -04:00
eyedeekay
39a457d314 Fix the build 2024-06-26 19:59:56 -04:00
eyedeekay
216f075f32 Remove CCD.java from compile step 2024-06-26 19:33:50 -04:00
eyedeekay
4d3e700ec3 Remove some redundant methods 2024-06-26 19:27:29 -04:00
eyedeekay
0fc103b777 Only postman tracker in bundle torrent 2024-05-15 23:06:02 -04:00
eyedeekay
e7ff841eb5 Bump build number 2024-05-15 21:24:26 -04:00
17 changed files with 241 additions and 292 deletions

89
.github/workflows/release-nightly.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
name: Nightly Release
on: [push]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
changelog.txt
docs/RELEASE.md
sparse-checkout-cone-mode: false
- name: sleep 15 minutes
run: |
echo "sleeping 20 minutes to wait for artifacts"
sleep 1m
echo "sleeping 19 minutes to wait for artifacts"
sleep 1m
echo "sleeping 18 minutes to wait for artifacts"
sleep 1m
echo "sleeping 17 minutes to wait for artifacts"
sleep 1m
echo "sleeping 16 minutes to wait for artifacts"
sleep 1m
echo "sleeping 15 minutes to wait for artifacts"
sleep 1m
echo "sleeping 14 minutes to wait for artifacts"
sleep 1m
echo "sleeping 13 minutes to wait for artifacts"
sleep 1m
echo "sleeping 12 minutes to wait for artifacts"
sleep 1m
echo "sleeping 11 minutes to wait for artifacts"
sleep 1m
echo "sleeping 10 minutes to wait for artifacts"
sleep 1m
echo "sleeping 9 minutes to wait for artifacts"
sleep 1m
echo "sleeping 8 minutes to wait for artifacts"
sleep 1m
echo "sleeping 7 minutes to wait for artifacts"
sleep 1m
echo "sleeping 6 minutes to wait for artifacts"
sleep 1m
echo "sleeping 5 minutes to wait for artifacts"
sleep 1m
echo "sleeping 4 minutes to wait for artifacts"
sleep 1m
echo "sleeping 3 minutes to wait for artifacts"
sleep 1m
echo "sleeping 2 minutes to wait for artifacts"
sleep 1m
echo "sleeping 1 minutes to wait for artifacts"
sleep 1m
- name: Download artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
skip_unpack: true
workflow: ant.yml
if_no_artifact_found: fail
# remove .zip file extension
- run: for f in *.zip; do unzip "$f"; rm "$f"; done
- run: echo "" | tee -a changelog.txt
- run: echo "## Checksums" | tee -a changelog.txt
- run: echo "" | tee -a changelog.txt
- run: echo '```' | tee -a changelog.txt
- run: sha256sum * | tee -a changelog.txt
- run: echo '```' | tee -a changelog.txt
- run: echo "" | tee -a changelog.txt
- run: echo '```' | tee -a changelog.txt
- run: file * | tee -a changelog.txt
- run: echo '```' | tee -a changelog.txt
- run: echo "" | tee -a changelog.txt
- run: cat docs/RELEASE.md changelog.txt > RELEASE.md
- name: Upload artifacts
uses: ncipollo/release-action@v1
with:
artifacts: "*"
prerelease: true
allowUpdates: true
replacesArtifacts: true
makeLatest: true
tag: nightly
bodyFile: "RELEASE.md"

View File

@@ -95,8 +95,8 @@ Windows Build
-------------
After installing the dependencies and completing the preparations,
just run `make`. This will produce the install.exe - the windows
installer, which sets up the shortcuts to launch Firefox on Windows.
just run `buildscripts/unsigned.sh`. This will produce the install.exe - the
windows installer, which sets up the shortcuts to launch Firefox on Windows.
Building without a jpackage is no longer supported.
When generating a build it's important to make sure that the
@@ -137,7 +137,7 @@ Ubuntu in WSL.
7. Move into the i2p.firefox directory. Run the `./buildscripts/build.sh` script.
cd i2p.firefox
./buildscripts/build.sh
./buildscripts/unsigned.sh
8. Compile the NSIS installer using WSL.

View File

@@ -48,9 +48,16 @@ export I2P_JARS="$I2P_PKG/lib"
export I2P_JBIGI="$SCRIPT_DIR/../i2p.i2p.jpackage-build/installer/lib/jbigi"
export I2P_JBIGI_JAR="$SCRIPT_DIR/../i2p.i2p.jpackage-build/build/jbigi.jar"
if [ ! -d "$SCRIPT_DIR/../i2p.i2p.jpackage-build/" ]; then
git clone --depth=1 -b "$VERSION" https://i2pgit.org/i2p-hackers/i2p.i2p "$SCRIPT_DIR/../i2p.i2p.jpackage-build/"
if [ -d "$SCRIPT_DIR/../i2p.i2p/" ]; then
echo cloning from local i2p.i2p checkout
git clone --depth=1 -b "$VERSION" -l "$SCRIPT_DIR/../i2p.i2p/" "$SCRIPT_DIR/../i2p.i2p.jpackage-build/"
else
echo cloning from remote i2p.i2p repository
git clone --depth=1 -b "$VERSION" https://i2pgit.org/i2p-hackers/i2p.i2p "$SCRIPT_DIR/../i2p.i2p.jpackage-build/"
fi
fi
cd "$SCRIPT_DIR/../i2p.i2p.jpackage-build/"
echo "setting up git branch for build"
OLDEXTRA=$(find . -name RouterVersion.java -exec grep 'String EXTRA' {} \;)
if [ -z "$EXTRA" ]; then
export EXTRACODE="win"
@@ -62,8 +69,7 @@ if [ "$VERSION" = master ]; then
else
export TAG_VERSION="$VERSION"
fi
echo "build is: i2p-$TAG_VERSION-$VERSIONDATE-$EXTRACODE"
find . -name RouterVersion.java -exec sed -i "s|$OLDEXTRA|$EXTRA|g" {} \;
git switch - || :
@@ -82,7 +88,7 @@ ant jbigi
cd "$SCRIPT_DIR"
mkdir -p "$SCRIPT_DIR/src/I2P/config"
rm -rf "$SCRIPT_DIR/src/I2P/config/geoip" "$SCRIPT_DIR/src/I2P/config/webapps" "$SCRIPT_DIR/src/I2P/config/certificates"
rm -rf "$SCRIPT_DIR/src/I2P/config/geoip" "$SCRIPT_DIR/src/I2P/config/webapps" "$SCRIPT_DIR/src/I2P/config/certificates" "$SCRIPT_DIR/src/I2P/config/eepsite"
cp -v "$RES_DIR/clients.config" "$SCRIPT_DIR/src/I2P/config/"
cp -v "$RES_DIR/wrapper.config" "$SCRIPT_DIR/src/I2P/config/"
#grep -v 'router.updateURL' $(RES_DIR)/router.config > "$SCRIPT_DIR"/src/I2P/config/router.config
@@ -115,11 +121,11 @@ if [ ! -f "$SCRIPT_DIR/build/i2pfirefox.zip" ]; then
wget_download "https://github.com/eyedeekay/i2p.plugins.firefox/releases/download/$I2PFIREFOX_VERSION/plugin.zip" -O "$SCRIPT_DIR/build/i2pfirefox.zip"
fi
if [ ! -d "$SCRIPT_DIR/build/I2P/config/plugins/i2pfirefox" ]; then
mkdir -p "$SCRIPT_DIR/build/I2P/config/plugins/"
unzip "$SCRIPT_DIR/build/i2pfirefox.zip" -d "$SCRIPT_DIR/build/I2P/config/plugins/"
rm -rf "$SCRIPT_DIR/build/I2P/config/plugins/i2pfirefox"
mv "$SCRIPT_DIR/build/I2P/config/plugins/plugin" "$SCRIPT_DIR/build/I2P/config/plugins/i2pfirefox"
if [ ! -d "$SCRIPT_DIR/src/I2P/config/plugins/i2pfirefox" ]; then
mkdir -p "$SCRIPT_DIR/src/I2P/config/plugins/"
unzip "$SCRIPT_DIR/build/i2pfirefox.zip" -d "$SCRIPT_DIR/src/I2P/config/plugins/"
rm -rf "$SCRIPT_DIR/src/I2P/config/plugins/i2pfirefox"
mv "$SCRIPT_DIR/src/I2P/config/plugins/plugin" "$SCRIPT_DIR/src/I2P/config/plugins/i2pfirefox"
fi
for dll in "$I2P_JBIGI/"*windows*.dll; do
@@ -128,12 +134,11 @@ done
cd "$SCRIPT_DIR"/java
"$JAVA_HOME"/bin/javac -Xlint:deprecation -d ../build -classpath "$SCRIPT_DIR/build/i2pfirefox.jar:$SCRIPT_DIR/build/jna.jar:$SCRIPT_DIR/build/jna-platform.jar":"$SCRIPT_DIR/build/i2p.jar:$SCRIPT_DIR/build/router.jar:$SCRIPT_DIR/build/routerconsole.jar:$SCRIPT_DIR/build/jbigi.jar" \
net/i2p/router/CopyConfigDir.java \
net/i2p/router/WindowsServiceUtil.java \
net/i2p/router/WindowsAppUtil.java \
net/i2p/router/I2PAppUtil.java \
net/i2p/router/WinUpdatePostProcessor.java \
net/i2p/router/WindowsAppUtil.java \
net/i2p/router/WindowsServiceUtil.java \
net/i2p/router/WinLauncher.java \
net/i2p/router/WinUpdatePostProcessor.java \
net/i2p/router/WinUpdateProcess.java \
net/i2p/router/ZipUpdateProcess.java

View File

@@ -36,7 +36,7 @@ java -cp "$I2P_LIBS/*" net.i2p.crypto.SU3File sign -c ROUTER -f EXE I2P-Easy-Ins
rm -f i2pwinupdate.su3.torrent
cp -v I2P-Easy-Install-Bundle-$I2P_VERSION-signed.su3 i2pwinupdate.su3
java -cp "$I2P_LIBS/*" "org.klomp.snark.Storage" -a http://tracker2.postman.i2p/announce.php -a http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a -a http://mb5ir7klpc2tj6ha3xhmrs3mseqvanauciuoiamx2mmzujvg67uq.b32.i2p/a -c "$SIGNER" -m "Official torrent for Windows Easy-Install version $I2P_VERSION" i2pwinupdate.su3
java -cp "$I2P_LIBS/*" "org.klomp.snark.Storage" -a http://tracker2.postman.i2p/announce.php -c "$SIGNER" -m "Official torrent for Windows Easy-Install version $I2P_VERSION" i2pwinupdate.su3
echo "~~~~~~~~~~"
MAGNET=$(transmission-show -m "i2pwinupdate.su3.torrent" 2>&1 3>&1 | tail -n 1)
echo "$MAGNET"

View File

@@ -0,0 +1,5 @@
#! /usr/bin/env sh
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/..
cd "$SCRIPT_DIR" || exit 1

View File

@@ -1,15 +1,6 @@
# I2P Easy-Install Bundle for Windows 2.5.0
# I2P Easy-Install Nightly Build
This is a pre-release of the I2P Easy-Install Bundle for Windows.
## 2.5.0 Release Notes.
This release, I2P 2.5.0, provides more user-facing improvements than the 2.4.0 release, which was focused on implementing the NetDB isolation strategy.
New features have been added to I2PSnark like the ability to search through torrents. Bugs have been fixed to improve compatibility with other I2P torrent clients like BiglyBT and qBittorrent. We would like to thank all of the developers who have worked with libtorrent and qBittorrent to enable and improve their I2P support. New features have also been added to SusiMail including support for Markdown formatting in emails and the ability to drag-and-drop attachments into emails. Tunnels created with the Hidden Services manager now support "Keepalive" which improves performance and compatibility with web technologies, enabling more sophisticated I2P sites.
During this release we also made several tweaks to the NetDB to improve its resilience to spam and to improve the router's ability to reject suspicious messages. This was part of an effort to "audit" the implementation of "Sub-DB isolation" defenses from the 2.4.0 release. This investigation uncovered one minor isolation-piercing event which we repaired. This issue was discovered and fixed internally by the I2P team.
During this release several improvements were made to the process of releasing our downstream distributions for Android and Windows. This should result in improved delivery and availability for these downstream products.
As usual, we recommend that you update to this release. The best way to maintain security and help the network is to run the latest release.
It is built from the `master` branch of the `i2p.i2p` and `i2p.firefox` repositories.
It is a nightly build and may contain bugs.
Use it at your own risk.

View File

@@ -20,7 +20,7 @@ if [ -z "$VERSIONMINOR" ]; then
VERSIONMINOR=5
fi
if [ -z "$VERSIONBUILD" ]; then
VERSIONBUILD=1
VERSIONBUILD=2
fi
I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
export I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"

View File

@@ -1,150 +0,0 @@
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.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;
import net.i2p.util.Log;
public class CopyConfigDir extends I2PAppUtil {
final Log logger;
public CopyConfigDir(RouterContext ctx) {
logger = ctx.logManager().getLog(CopyConfigDir.class);
}
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()) {
String fPath = file.getAbsolutePath().replace(
file.getParentFile().getAbsolutePath(), "");
String newPath = workDir.toString() + fPath;
if (file.isDirectory())
if (copyDirectory(file, new File(newPath)))
return false;
if (file.isFile())
if (0 == copyFile(file, new File(newPath), true))
return false;
}
return true;
}
public boolean copyConfigDirectory(File baseDir, File workDir) {
for (File file : baseDir.listFiles()) {
// System.out.println(file.getAbsolutePath());
String fPath = file.getAbsolutePath().replace(
file.getParentFile().getAbsolutePath(), "");
String newPath = workDir.toString() + fPath;
if (file.isDirectory())
if (!copyConfigDirectory(file, new File(newPath)))
return false;
if (file.isFile()) {
int cnr = copyFileNeverOverwrite(file, new File(newPath));
if (0 == cnr)
return false;
if (1 == cnr) {
logger.info(
"using jpackaged configs in a jpackaged install, creating jpackaged file");
File jpackagedConfigsInUse = new File(appImageHome(), "jpackaged");
if (!jpackagedConfigsInUse.exists()) {
try {
jpackagedConfigsInUse.createNewFile();
} catch (IOException e) {
logger.warn(
"Error creating jpackaged file, delete config files manually when uninstalling");
}
}
}
if (-1 == cnr) {
logger.info(
"not overwriting existing config file, not creating jpackaged file");
}
}
}
return true;
}
public int copyFileNeverOverwrite(String basePath, String workPath) {
File baseFile = new File(basePath);
File workFile = new File(workPath);
return copyFileNeverOverwrite(baseFile, workFile);
}
public int copyFileNeverOverwrite(File basePath, File workPath) {
return copyFile(basePath, workPath, false);
}
public int copyFile(File basePath, File workPath, boolean overWrite) {
if (!basePath.exists()) {
logger.info(basePath.getAbsolutePath() + " doesn't exist, not copying");
return 0;
}
if (!overWrite && workPath.exists()) {
logger.info(workPath.getAbsolutePath() +
" already exists, not overwriting");
return -1;
}
File workDir = workPath.getParentFile();
if (!workDir.exists()) {
workDir.mkdirs();
}
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 1;
} catch (Throwable e) {
logger.warn(e.toString());
logger.warn("failed to copy " + basePath.getAbsolutePath() + " to " +
workPath.getAbsolutePath());
return 0;
}
}
protected boolean copyConfigDir() {
File appImageConfigDir = appImageConfig();
File appImageHomeDir = selectHome();
return copyConfigDirectory(appImageConfigDir, appImageHomeDir);
}
/**
* set up the path to the log file
*
* @return
*/
protected File logFile() { return logFile("launcher.log"); }
/**
* set up the path to the log file
*
* @return
*/
protected File logFile(String p) {
File log = new File(selectHome(), "logs");
if (!log.exists())
log.mkdirs();
return new File(log, p);
}
}

View File

@@ -3,8 +3,10 @@ package net.i2p.router;
import java.io.File;
import java.io.IOException;
import javax.swing.JOptionPane;
import net.i2p.router.RouterContext;
public class I2PAppUtil extends WindowsAppUtil {
public String ServiceUpdaterString() {
return "http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/news.su3";
}

View File

@@ -25,20 +25,20 @@ import net.i2p.util.Log;
* router.pid - the pid of the java process.
*/
public class WinLauncher extends I2PAppUtil {
private final CopyConfigDir copyConfigDir;
// private final CopyConfigDir copyConfigDir;
WinUpdatePostProcessor wupp = null;
private Router i2pRouter;
private final Log logger;
public WinLauncher() {
File programs = programFile();
File home = homeDir();
System.setProperty(
"i2p.dir.base",
new File(programs.getAbsolutePath(), "config").getAbsolutePath());
System.setProperty("i2p.dir.config", home.getAbsolutePath());
appImageConfig().getAbsolutePath());
System.setProperty("i2p.dir.config", appImageConfig().getAbsolutePath());
System.setProperty("router.pid",
String.valueOf(ProcessHandle.current().pid()));
String.valueOf(ProcessHandle.current().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
@@ -48,7 +48,8 @@ public class WinLauncher extends I2PAppUtil {
System.setProperty("user.dir", programs.getAbsolutePath());
i2pRouter = new Router(routerConfig(), System.getProperties());
copyConfigDir = new CopyConfigDir(i2pRouter.getContext());
this.setLog(i2pRouter.getContext().logManager().getLog(WindowsAppUtil.class));
// copyConfigDir = new CopyConfigDir(i2pRouter.getContext());
logger = i2pRouter.getContext().logManager().getLog(WinLauncher.class);
}
@@ -75,15 +76,17 @@ public class WinLauncher extends I2PAppUtil {
// This actually does most of what we use NSIS for if NSIS hasn't
// already done it, which essentially makes this whole thing portable.
if (!launcher.copyConfigDir.copyConfigDir()) {
launcher.logger.error("Cannot copy the configuration directory");
System.exit(1);
}
/*
* if (!launcher.copyConfigDir.copyConfigDir()) {
* launcher.logger.error("Cannot copy the configuration directory");
* System.exit(1);
* }
*/
if (!launcher.isInstalled("i2p")) {
if (launcher.i2pRouter.saveConfig("routerconsole.browser", "NUL")) {
launcher.logger.info("updated routerconsole.browser config " +
launcher.appImageExe());
launcher.appImageExe());
}
}
launcher.logger.info("Router is configured");
@@ -110,25 +113,12 @@ public class WinLauncher extends I2PAppUtil {
else if (!programs.isDirectory()) {
logger.warn(
programs +
" exists but is not a directory. Please get it out of the way");
" exists but is not a directory. Please get it out of the way");
System.exit(1);
}
return programs;
}
private File homeDir() {
File home = selectHome();
if (!home.exists())
home.mkdirs();
else if (!home.isDirectory()) {
logger.warn(
home +
" exists but is not a directory. Please get it out of the way");
System.exit(1);
}
return home;
}
// see
// https://stackoverflow.com/questions/434718/sockets-discover-port-availability-using-java
private boolean isAvailable(int portNr) {
@@ -152,8 +142,7 @@ public class WinLauncher extends I2PAppUtil {
sleep(1000);
}
UpdateManager um;
while ((um = (UpdateManager)cam.getRegisteredApp(UpdateManager.APP_NAME)) ==
null) {
while ((um = (UpdateManager) cam.getRegisteredApp(UpdateManager.APP_NAME)) == null) {
sleep(1000);
}
WinUpdatePostProcessor wupp = new WinUpdatePostProcessor(ctx);

View File

@@ -31,12 +31,16 @@ public class WinUpdatePostProcessor implements UpdatePostProcessor {
this._log = ctx.logManager().getLog(WinUpdatePostProcessor.class);
}
public String getVersion() { return version; }
public String getVersion() {
return version;
}
public File getFile() { return positionedFile; }
public File getFile() {
return positionedFile;
}
public void updateDownloadedandVerified(UpdateType type, int fileType,
String version, File file)
String version, File file)
throws IOException {
_log.info("Got an update to post-process");
if (type != UpdateType.ROUTER_SIGNED_SU3 &&
@@ -97,12 +101,11 @@ public class WinUpdatePostProcessor implements UpdatePostProcessor {
private File workDir() throws IOException {
if (this.ctx != null) {
File workDir =
new File(this.ctx.getConfigDir().getAbsolutePath(), "i2p_update_win");
File workDir = new File(this.ctx.getConfigDir().getAbsolutePath(), "i2p_update_win");
if (workDir.exists()) {
if (workDir.isFile())
throw new IOException(workDir +
" exists but is a file, get it out of the way");
" exists but is a file, get it out of the way");
return null;
} else {
workDir.mkdirs();

View File

@@ -14,7 +14,7 @@ class WinUpdateProcess implements Runnable {
private final Log _log;
WinUpdateProcess(RouterContext ctx, Supplier<String> versionSupplier,
Supplier<File> fileSupplier) {
Supplier<File> fileSupplier) {
this.ctx = ctx;
this.versionSupplier = versionSupplier;
this.fileSupplier = fileSupplier;
@@ -23,12 +23,11 @@ class WinUpdateProcess implements Runnable {
private File workDir() throws IOException {
if (ctx != null) {
File workDir =
new File(ctx.getConfigDir().getAbsolutePath(), "i2p_update_win");
File workDir = new File(ctx.getConfigDir().getAbsolutePath(), "i2p_update_win");
if (workDir.exists()) {
if (workDir.isFile())
throw new IOException(workDir +
" exists but is a file, get it out of the way");
" exists but is a file, get it out of the way");
return workDir;
} else {
workDir.mkdirs();
@@ -62,13 +61,13 @@ class WinUpdateProcess implements Runnable {
try {
Process p = pb.directory(workingDir)
.redirectErrorStream(true)
.redirectOutput(logFile)
.start();
.redirectErrorStream(true)
.redirectOutput(logFile)
.start();
exitCode = p.waitFor();
if (exitCode != 0)
_log.error("Update failed with exit code " + exitCode + " see " +
logFile.getAbsolutePath() + " for more details");
logFile.getAbsolutePath() + " for more details");
} catch (IOException ex) {
_log.error(
"Unable to run update program in background. Update will fail.", ex);

View File

@@ -2,8 +2,15 @@ package net.i2p.router;
import java.io.File;
import net.i2p.util.Log;
import net.i2p.router.RouterContext;
public class WindowsAppUtil extends WindowsServiceUtil {
private Log _log;
public void setLog(Log log) {
this._log = log;
}
private File checkPathEnvironmentVariable(String name) {
String path_override = System.getenv(name);
if (path_override != null) {
@@ -31,10 +38,10 @@ public class WindowsAppUtil extends WindowsServiceUtil {
* relative to the root of the app-image on each platform:
*
* Windows - Root of appimage is 1 directory above directory named runtime
* ./runtime
* ./runtime
*
* Linux - Root of appimage is 2 directories above directory named runtime
* ./lib/runtime
* ./lib/runtime
*
* Mac OSX - Unknown for now
*
@@ -61,11 +68,11 @@ public class WindowsAppUtil extends WindowsServiceUtil {
File jreHome = javaHome();
if (jreHome != null) {
switch (osName()) {
case "windows":
return jreHome.getAbsoluteFile().getParentFile();
case "mac":
case "linux":
return jreHome.getAbsoluteFile().getParentFile().getParentFile();
case "windows":
return jreHome.getAbsoluteFile().getParentFile();
case "mac":
case "linux":
return jreHome.getAbsoluteFile().getParentFile().getParentFile();
}
}
return null;
@@ -86,11 +93,11 @@ public class WindowsAppUtil extends WindowsServiceUtil {
// name of the executable as well
String baseName = aih.getName();
switch (osName()) {
case "windows":
return baseName + ".exe";
case "mac":
case "linux":
return "./bin/" + baseName;
case "windows":
return baseName + ".exe";
case "mac":
case "linux":
return "./bin/" + baseName;
}
}
return null;
@@ -111,21 +118,29 @@ public class WindowsAppUtil extends WindowsServiceUtil {
}
String osName = osName();
switch (osName) {
case "windows":
File winConfigDir = new File(aih, "config");
if (winConfigDir != null) {
if (winConfigDir.exists()) {
return winConfigDir;
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;
case "mac":
case "linux":
File linConfigDir = new File(aih, "lib/config");
if (linConfigDir != null) {
if (linConfigDir.exists()) {
File cfg = new File(linConfigDir, "router.config");
if (cfg.canWrite())
return linConfigDir;
else {
String home = System.getenv("HOME");
if (home != null)
linConfigDir = new File(home,"i2p-config");
}
return linConfigDir;
}
}
}
}
return null;
}

View File

@@ -30,7 +30,9 @@ import javax.swing.JOptionPane;
*/
public class WindowsServiceUtil {
public WindowsServiceUtil() {}
public WindowsServiceUtil() {
}
public String queryService(String serviceName) {
String result = "";
String line;
@@ -39,8 +41,7 @@ public class WindowsServiceUtil {
Process p = pb.start();
try {
p.waitFor(); // wait for process to finish then continue.
BufferedReader bri =
new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = bri.readLine()) != null) {
result += line;
}
@@ -54,6 +55,7 @@ public class WindowsServiceUtil {
}
return result;
}
public String getStatePrefix(String qResult) {
String statePrefix = "STATE : ";
// get the first occurrence of "STATE", then find the
@@ -70,8 +72,9 @@ public class WindowsServiceUtil {
}
return statePrefix;
}
public int getServiceStateInt(String serviceName) {
// String statePrefix = "STATE : ";
// String statePrefix = "STATE : ";
String qResult = queryService(serviceName);
String statePrefix = getStatePrefix(qResult);
// check that the temp string contains the status prefix
@@ -79,7 +82,7 @@ public class WindowsServiceUtil {
if (ix >= 0) {
// compare status number to one of the states
String stateStr = qResult.substring(ix + statePrefix.length(),
ix + statePrefix.length() + 1);
ix + statePrefix.length() + 1);
int state = Integer.parseInt(stateStr);
return state;
}
@@ -113,15 +116,12 @@ public class WindowsServiceUtil {
if (isInstalled(serviceName)) {
if (!isStart(serviceName)) {
int a;
String message =
"It appears you have an existing I2P service installed.\n";
message +=
"However, it is not running yet. Please start it through `services.msc`.\n";
message +=
"If you click \"No\", the jpackage router will be launched instead.\n";
String message = "It appears you have an existing I2P service installed.\n";
message += "However, it is not running yet. Please start it through `services.msc`.\n";
message += "If you click \"No\", the jpackage router will be launched instead.\n";
a = JOptionPane.showConfirmDialog(null, message,
"I2P Service detected not running",
JOptionPane.YES_NO_OPTION);
"I2P Service detected not running",
JOptionPane.YES_NO_OPTION);
if (a == JOptionPane.NO_OPTION) {
// Do nothing here, this will continue on to launch a jpackaged router
return true;
@@ -131,8 +131,7 @@ public class WindowsServiceUtil {
// user can start the service themselves. OR maybe we ask for
// elevation here? May need to refactor Elevator and Shell32X to
// achieve it though
ProcessBuilder pb =
new ProcessBuilder("C:\\Windows\\System32\\services.msc");
ProcessBuilder pb = new ProcessBuilder("C:\\Windows\\System32\\services.msc");
try {
Process p = pb.start();
int exitCode = p.waitFor();
@@ -156,27 +155,27 @@ public class WindowsServiceUtil {
String stateString = "uninstalled";
int state = getServiceStateInt(serviceName);
switch (state) {
case (1): // service stopped
stateString = "stopped";
break;
case (2): // service starting
stateString = "starting";
break;
case (3): // service stopping
stateString = "stopping";
break;
case (4): // service started
stateString = "started";
break;
case (5): // service resuming from pause
stateString = "resuming";
break;
case (6): // service pausing
stateString = "pausing";
break;
case (7): // service paused
stateString = "paused";
break;
case (1): // service stopped
stateString = "stopped";
break;
case (2): // service starting
stateString = "starting";
break;
case (3): // service stopping
stateString = "stopping";
break;
case (4): // service started
stateString = "started";
break;
case (5): // service resuming from pause
stateString = "resuming";
break;
case (6): // service pausing
stateString = "pausing";
break;
case (7): // service paused
stateString = "paused";
break;
}
return stateString;
}
@@ -184,7 +183,7 @@ public class WindowsServiceUtil {
/**
* get the OS name(windows, mac, linux only)
*
* @return os name in lower-case, "windows" "mac" or "linux"
* @return os name in lower-case, "windows" "mac" or "linux"
*/
protected String osName() {
String osName = System.getProperty("os.name").toLowerCase();
@@ -194,6 +193,7 @@ public class WindowsServiceUtil {
return "mac";
return "linux";
}
public static void main(String args[]) {
WindowsServiceUtil wsu = new WindowsServiceUtil();
// when querying the I2P router service installed by the IzPack installer

View File

@@ -20,7 +20,7 @@ public class ZipUpdateProcess implements Runnable {
private final Log _log;
ZipUpdateProcess(RouterContext ctx, Supplier<String> versionSupplier,
Supplier<File> fileSupplier) {
Supplier<File> fileSupplier) {
this.ctx = ctx;
this.versionSupplier = versionSupplier;
this.fileSupplier = fileSupplier;
@@ -29,12 +29,11 @@ public class ZipUpdateProcess implements Runnable {
private File workDir() throws IOException {
if (ctx != null) {
File workDir =
new File(ctx.getConfigDir().getAbsolutePath(), "i2p_update_zip");
File workDir = new File(ctx.getConfigDir().getAbsolutePath(), "i2p_update_zip");
if (workDir.exists()) {
if (workDir.isFile())
throw new IOException(workDir +
" exists but is a file, get it out of the way");
" exists but is a file, get it out of the way");
return workDir;
} else {
workDir.mkdirs();

View File

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

View File

@@ -1,8 +1,10 @@
#!/bin/bash
TORSOCKS=$(which torsocks)
if [ -f "${TORSOCKS}" ]; then
. "${TORSOCKS}" on
if [ -z "$NO_TORSOCKS" ]; then
TORSOCKS=$(which torsocks)
if [ -f "${TORSOCKS}" ]; then
. "${TORSOCKS}" on
fi
fi
version="$(curl -s https://aus1.torproject.org/torbrowser/update_3/release/downloads.json | jq -r ".version")"