Compare commits

...

42 Commits

Author SHA1 Message Date
idk
a5c7bac581 zip in release upload 2023-04-22 15:33:40 +00:00
idk
7eeb2e4523 add release uploader script 2023-04-22 06:14:05 +00:00
idk
9cae0f78ad add release uploader script 2023-04-22 06:06:11 +00:00
idk
99438cfc33 fix changelog date 2023-04-22 06:00:58 +00:00
idk
eba4ebe3d0 remove last few references to wsl 2023-04-22 05:50:24 +00:00
idk
7f24838725 ShellExecAsUser is not required for installers that do not run as admin, this installer is adminless 2023-04-19 03:30:06 +00:00
idk
673725304c ShellExecAsUser is not required for installers that do not run as admin, this installer is adminless 2023-04-19 02:13:43 +00:00
idk
7cf2bf455a fix licenses path on windows 2023-04-19 02:05:22 +00:00
idk
d177435b50 work around makensis path issues 2023-04-19 01:34:29 +00:00
idk
33fb6ab6d5 work around makensis path issues 2023-04-19 01:33:05 +00:00
idk
29827366fb work around makensis path issues 2023-04-19 01:30:01 +00:00
idk
edfe44bc3b work around makensis path issues 2023-04-19 01:26:11 +00:00
idk
432e2c54f8 bump version 2023-04-19 01:25:02 +00:00
idk
8894c946bc work around makensis path issues 2023-04-19 01:16:51 +00:00
idk
bc9b4a0250 use invoke-webrequest instead of wget on windows 2023-04-19 00:01:20 +00:00
idk
35841c7887 fix positional args for wsl-free build 2023-04-18 23:14:09 +00:00
idk
e3afb9de1d fix paths for wsl-free windows build 2023-04-18 23:03:48 +00:00
idk
3b11def66c fix paths for wsl-free windows build 2023-04-18 22:54:12 +00:00
idk
e152513043 Work around absence of wget, lessens requirement of wsl 2023-04-18 22:35:26 +00:00
idk
81dd3ed5ef update config file, automatically determine JAVA_HOME from java in path, automatically find apache ant 2023-04-18 20:28:41 +00:00
idk
0630f77a4c update .gitignore 2023-04-18 20:16:34 +00:00
idk
204fda1a11 Remove i2pbrowser-jpackage file 2023-04-18 20:14:33 +00:00
idk
9e1ef2d546 Remove i2pbrowser-jpackage file 2023-04-18 20:14:25 +00:00
idk
688bc1b0f3 update from 2.2.0 to 2.2.1 2023-04-18 20:10:10 +00:00
idk
dd566165dd update from -19 to -20 2023-04-18 20:07:41 +00:00
idk
57833edc36 always check out branch when building launcher, not just the first time 2023-03-20 17:27:16 +00:00
idk
a19fcd9ea5 remember to update I2PFIREFOX_VERSION to 1.0.9 2023-03-20 17:11:01 +00:00
idk
bfddc378cd update I2P version 2023-03-19 16:26:53 +00:00
idk
fd712293b4 update I2P version 2023-03-19 16:26:26 +00:00
idk
068fbee70e move extra docs to docs directory 2023-02-22 22:05:50 +00:00
idk
377c836887 fix other static reference conflicts 2023-02-12 19:27:24 +00:00
idk
99a4959c12 fix other static reference conflicts 2023-02-12 19:18:25 +00:00
idk
922ec66f95 only use instance reference to logger in static context 2023-02-12 19:05:56 +00:00
idk
298c87f457 update javadoc at top of winlauncher, lots more javadoc to do. 2023-02-12 16:52:40 +00:00
idk
fcacf59a48 main functions should still be static 2023-02-12 16:50:59 +00:00
idk
8d06c9079b main functions should still be static 2023-02-12 16:48:49 +00:00
idk
c0fb7dcf67 remove redundant admin check in nsis 2023-02-09 19:02:59 +00:00
idk
019581479b Tag nightlies with a date, remove jpackaged file from nsis installer 2023-02-09 02:48:49 +00:00
idk
65fb9e1847 Remove admin update subsystem along with admin installs. There is no more need to change the update URL on the first run now that it uses it's own directory. Tweak WindowsUpdatePostProcessor to use a zip update only as a backup. 2023-02-08 21:47:54 +00:00
idk
402cede106 mark Elevator and Shell32X for removal 2023-02-06 17:46:14 +00:00
idk
673d6b469f change appname 2023-01-31 20:10:19 +00:00
idk
dd47ffd902 don't use wine to unpack Tor Browser on Windows 2023-01-24 04:50:30 +00:00
26 changed files with 287 additions and 471 deletions

4
.gitignore vendored
View File

@ -25,4 +25,6 @@ config_override.sh
i2pkeys
onionkeys
tlskeys
tmp
tmp
/.stfolder/
/.vscode/

View File

@ -1,29 +0,0 @@
Setting up an Update Server for an I2P Bundle
=============================================
It is important to set up a signed update server so that people are able to
safely and anonymously update your I2P bundle.
The quick way:
--------------
This process depends on my ability to push releases to github. If you are
forking, setting up a dev server, or taking over because I got hit by a bus,
you'll need to do it the complete way.
For as long as I am building updates, you will be able to mirror the jpackaged
Windows bundle by cloning the repository `https://github.com/eyedeekay/i2p` and
running the `make docker run` target in that repository. You can retrieve the
base32 address of your update server by viewing the log with
`docker logs eephttpd-jpackage | grep b32.i2p | tee eephttpd-address.md`. To
update the site, run `./update.site.sh` in that repository.
Once you have cloned the repository and started the container with
`make docker run`, you can simply add `path/to/repo/update-site.sh` to your
`crontab` and it will update at an interval of your choosing.
The complete way:
-----------------
TODO: describe how to do it with less of the awesome fancy stuff I put together
to make it easier on myself to keep an update server going.

View File

@ -30,10 +30,10 @@ if [ "$JAVA" -lt "17" ]; then
fi
if [ -z "${JAVA_HOME}" ]; then
export JAVA_HOME=`type -p java|xargs readlink -f|xargs dirname|xargs dirname`
export JAVA_HOME=$(type -p java|xargs readlink -f|xargs dirname|xargs dirname)
fi
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
export JAVA_HOME=`type -p java|xargs readlink -f|xargs dirname|xargs dirname`
export JAVA_HOME=$(type -p java|xargs readlink -f|xargs dirname|xargs dirname)
fi
echo "Building with: $JAVA, $JAVA_HOME"
sleep 5s
@ -56,10 +56,16 @@ if [ -z "$EXTRA" ]; then
export EXTRACODE="win"
export EXTRA=" public final static String EXTRA = \"-$EXTRACODE\";"
fi
if [ "$VERSION" = master ]; then
VERSIONDATE="$(date +%m%d)"
fi
find . -name RouterVersion.java -exec sed -i "s|$OLDEXTRA|$EXTRA|g" {} \;
git checkout -b "i2p-$VERSION-$EXTRACODE" && git commit -am "i2p-$VERSION-$EXTRACODE"
git switch - || :
git pull --tags
git archive --format=tar.gz --output="$SCRIPT_DIR/../i2p.firefox/i2p.i2p.jpackage-build.tar.gz" "i2p-$VERSION-$EXTRACODE"
git checkout -b "i2p-$VERSION$VERSIONDATE-$EXTRACODE" || :
git commit -am "i2p-$VERSION$VERSIONDATE-$EXTRACODE" || :
git archive --format=tar.gz --output="$SCRIPT_DIR/../i2p.firefox/i2p.i2p.jpackage-build.tar.gz" "i2p-$VERSION$VERSIONDATE-$EXTRACODE"
git checkout "i2p-$VERSION$VERSIONDATE-$EXTRACODE" || :
for i in $COUNT; do
echo -n "$i...."; sleep 1s
@ -89,15 +95,15 @@ mkdir -p "$SCRIPT_DIR/build"
cp "$I2P_JARS"/*.jar "$SCRIPT_DIR/build"
cp "$I2P_JBIGI_JAR" "$SCRIPT_DIR/build"
if [ ! -f "$SCRIPT_DIR/build/jna.jar" ]; then
wget -O "$SCRIPT_DIR/build/jna.jar" "https://repo1.maven.org/maven2/net/java/dev/jna/jna/$JNA_VERSION/jna-$JNA_VERSION.jar"
wget "https://repo1.maven.org/maven2/net/java/dev/jna/jna/$JNA_VERSION/jna-$JNA_VERSION.jar" -O "$SCRIPT_DIR/build/jna.jar"
fi
if [ ! -f "$SCRIPT_DIR/build/jna-platform.jar" ]; then
wget -O "$SCRIPT_DIR/build/jna-platform.jar" "https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/$JNA_VERSION/jna-platform-$JNA_VERSION.jar"
wget "https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/$JNA_VERSION/jna-platform-$JNA_VERSION.jar" -O "$SCRIPT_DIR/build/jna-platform.jar"
fi
if [ ! -f "$SCRIPT_DIR/build/i2pfirefox.jar" ]; then
wget -O "$SCRIPT_DIR/build/i2pfirefox.jar" "https://github.com/eyedeekay/i2p.plugins.firefox/releases/download/$I2PFIREFOX_VERSION/i2pfirefox.jar"
wget "https://github.com/eyedeekay/i2p.plugins.firefox/releases/download/$I2PFIREFOX_VERSION/i2pfirefox.jar" -O "$SCRIPT_DIR/build/i2pfirefox.jar"
fi
for dll in "$I2P_JBIGI/"*windows*.dll; do
@ -105,15 +111,12 @@ for dll in "$I2P_JBIGI/"*windows*.dll; do
done
cd "$SCRIPT_DIR"/java
"$JAVA_HOME"/bin/javac -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" \
"$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/Elevator.java \
net/i2p/router/Shell32X.java \
net/i2p/router/WindowsServiceUtil.java \
net/i2p/router/WinLauncher.java \
net/i2p/router/WindowsUpdatePostProcessor.java \
net/i2p/router/WinLauncher.java \
net/i2p/router/WinUpdateProcess.java \
net/i2p/router/WindowsServiceUtil.java \
net/i2p/router/ZipUpdateProcess.java
cd ..

View File

@ -15,12 +15,7 @@ if [ -f "$SCRIPT_DIR/config_override.sh" ]; then
. "$SCRIPT_DIR/config_override.sh"
fi
MAKENSIS=$(which makensis)
if [ -z "$MAKENSIS" ]; then
MAKENSIS="wsl makensis"
fi
cp "$SCRIPT_DIR"/src/nsis/*.nsi "$SCRIPT_DIR"/build
cp "$SCRIPT_DIR"/src/nsis/*.nsh "$SCRIPT_DIR"/build
cp "$SCRIPT_DIR"/src/icons/*.ico "$SCRIPT_DIR"/build
cd "$SCRIPT_DIR"/build && $MAKENSIS i2pbrowser-installer.nsi && cp I2P-Easy-Install-Bundle-*.exe ../ && echo "built windows installer"
cd "$SCRIPT_DIR"/build && makensisi i2pbrowser-installer.nsi && cp I2P-Easy-Install-Bundle-*.exe ../ && echo "built windows installer"

View File

@ -0,0 +1,55 @@
#! /usr/bin/env bash
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/..
cd "$SCRIPT_DIR" || exit 1
. "$SCRIPT_DIR/i2pversion"
if [ -f i2pversion_override ]; then
. "$SCRIPT_DIR/i2pversion_override"
fi
mv "$SCRIPT_DIR/config_override.sh" "$SCRIPT_DIR/config_override.sh.bak"
. "$SCRIPT_DIR/config.sh"
### How to set up this script:
#
# This script will not work unless you give it a Github API key.
# You need to create a file in your $HOME directory, which on
# Windows will by /c/Users/yourusername, called github-release-config.sh,
# containing this key as the variable GITHUB_TOKEN.
# github-release-config.sh must also contain:
# GITHUB_USERNAME=your github username
git clean -fd
git checkout .
"$SCRIPT_DIR"/buildscripts/unsigned.sh
. "$HOME/github-release-config.sh"
if [ -f ./i2pversion_override ]; then
. ./i2pversion_override
fi
BLANK=$(awk '! NF { print NR; exit }' changelog.txt)
DESCRIPTION="Release build of i2p.firefox for $I2P_VERSION
==========================================================
$(head -n $BLANK changelog.txt)"
echo github-release release -p -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "$I2P_VERSION" -d "$DESCRIPTION" -t "$I2P_VERSION"
github-release release -p -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "$I2P_VERSION" -d "$DESCRIPTION" -t "$I2P_VERSION"
sleep 2s;
EXECHECKSUM=$(sha256sum "I2P-Easy-Install-Bundle-$I2P_VERSION.exe")
echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P-Easy-Install-Bundle-$I2P_VERSION.exe" -l "$EXECHECKSUM" -t "$I2P_VERSION" -n "I2P-Easy-Install-Bundle-$I2P_VERSION.exe"
github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P-Easy-Install-Bundle-$I2P_VERSION.exe" -l "$EXECHECKSUM" -t "$I2P_VERSION" -n "I2P-Easy-Install-Bundle-$I2P_VERSION.exe"
powershell Compress-Archive -force I2P I2P.zip
ZIPCHECKSUM=$(sha256sum "I2P.zip")
echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P.zip" -l "$ZIPCHECKSUM" -t "$I2P_VERSION" -n "I2P.zip"
github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P.zip" -l "$ZIPCHECKSUM" -t "$I2P_VERSION" -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 "$I2P_VERSION" -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 "$I2P_VERSION" -n "i2p.i2p.jpackage-build.tar.gz"
sh -c "powershell Compress-Archive I2P I2P-jpackage-windows-$I2P_VERSION.zip || zip I2P-jpackage-windows-$I2P_VERSION.zip -r I2P"
echo github-release upload -R -u "$GITHUB_USERNAME" -r i2p -t i2p-jpackage-windows-$I2P_VERSION -n "i2p-jpackage-windows-$I2P_VERSION" -f "./I2P-jpackage-windows-$I2P_VERSION.zip"
github-release upload -R -u "$GITHUB_USERNAME" -r i2p -t i2p-jpackage-windows-$I2P_VERSION -n "i2p-jpackage-windows-$I2P_VERSION" -f "./I2P-jpackage-windows-$I2P_VERSION.zip"

View File

@ -10,7 +10,7 @@ if [ -f "$SCRIPT_DIR/config_override.sh" ]; then
fi
export machine=unix
"$SCRIPT_DIR"/buildscripts/clean.sh
wsl "$SCRIPT_DIR"/buildscripts/clean.sh
"$SCRIPT_DIR"/buildscripts/clean.sh
"$SCRIPT_DIR"/buildscripts/build.sh
cd "$SCRIPT_DIR/I2P" || exit 1

View File

@ -10,6 +10,5 @@ if [ -f "$SCRIPT_DIR/config_override.sh" ]; then
fi
"$SCRIPT_DIR"/buildscripts/clean.sh
wsl "$SCRIPT_DIR"/buildscripts/clean.sh
"$SCRIPT_DIR"/buildscripts/build.sh
"$SCRIPT_DIR"/buildscripts/nsis.sh

View File

@ -9,7 +9,7 @@ if [ -f "$SCRIPT_DIR/config_override.sh" ]; then
. "$SCRIPT_DIR/config_override.sh"
fi
"$SCRIPT_DIR"/buildscripts/clean.sh
wsl "$SCRIPT_DIR"/buildscripts/clean.sh
"$SCRIPT_DIR"/buildscripts/clean.sh
"$SCRIPT_DIR"/buildscripts/build.sh
cd "$SCRIPT_DIR/I2P" || exit 1

View File

@ -1,4 +1,4 @@
2022-01-23 idk
2023-01-23 idk
* Move build scripts to their own directory and make them use correct paths when moved
* Add EXTRA to router when generating embedded router jars.

View File

@ -5,24 +5,34 @@
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 OpenJDK18
NSIS_PATH="/c/Program Files (x86)/NSIS/Bin"
PATH="$NSIS_PATH:$PATH:$NSIS_PATH/"
export PATH="$NSIS_PATH:$PATH:$NSIS_PATH/"
wget(){
which wget && wget $@ && return
which powershell && powershell Invoke-WebRequest $@ && return
}
makensisi(){
which makensis && makensis $@ && return
which wsl && wsl makensis $@ && return
}
if [[ -n "$IS_WSL" || -n "$WSL_DISTRO_NAME" ]]; then
PATH="/c/Program Files/Java/jdk-19/bin/:$PATH:/c/Program Files/Java/jdk-19/bin/"
export PATH="/c/Program Files/Java/jdk-19/bin/:$PATH:/c/Program Files/Java/jdk-19/bin/"
JAVA_HOME="/c/Program Files/Java/jdk-19"
export JAVA_HOME="/c/Program Files/Java/jdk-19"
JAVA_HOME=$(java -XshowSettings:properties -version 2>&1 | findstr "java.home" | sed 's| java.home = ||g')
export JAVA_HOME="$JAVA_HOME"
PATH="$JAVA_HOME/bin/:$PATH:$JAVA_HOME/bin/"
export PATH="$JAVA_HOME/bin/:$PATH:$JAVA_HOME/bin/"
HOST=win32
export HOST=win32
fi
if [ "${uname}" != "Linux" ]; then
PATH="/c/Program Files/Java/jdk-19/bin/:$PATH:/c/Program Files/Java/jdk-19/bin/"
export PATH="/c/Program Files/Java/jdk-19/bin/:$PATH:/c/Program Files/Java/jdk-19/bin/"
JAVA_HOME="/c/Program Files/Java/jdk-19"
export JAVA_HOME="/c/Program Files/Java/jdk-19"
JAVA_HOME=$(java -XshowSettings:properties -version 2>&1 | findstr "java.home" | sed 's| java.home = ||g')
export JAVA_HOME="$JAVA_HOME"
PATH="$JAVA_HOME/bin/:$PATH:$JAVA_HOME/bin/"
export PATH="$JAVA_HOME/bin/:$PATH:$JAVA_HOME/bin/"
HOST=win32
export HOST=win32
fi
@ -32,10 +42,10 @@ fi
## This isn't a default install location, obviously, it's where I unzipped it.
## It won't work for you unless you kurtly tell Windows that your name is `user`
## every time you make an account, like I do.
#PATH="/c/Users/user/Downloads/openjdk-19_windows-x64_bin/jdk-19/bin/:$PATH:/c/Users/user/Downloads/openjdk-19_windows-x64_bin/jdk-19/bin/"
#export PATH="/c/Users/user/Downloads/openjdk-19_windows-x64_bin/jdk-19/bin/:$PATH:/c/Users/user/Downloads/openjdk-19_windows-x64_bin/jdk-19/bin/"
#JAVA_HOME=/c/Users/user/Downloads/openjdk-19_windows-x64_bin/jdk-19
#export JAVA_HOME=/c/Users/user/Downloads/openjdk-19_windows-x64_bin/jdk-19
#PATH="/c/Users/user/Downloads/openjdk-20_windows-x64_bin/jdk-20/bin/:$PATH:/c/Users/user/Downloads/openjdk-20_windows-x64_bin/jdk-20/bin/"
#export PATH="/c/Users/user/Downloads/openjdk-20_windows-x64_bin/jdk-20/bin/:$PATH:/c/Users/user/Downloads/openjdk-20_windows-x64_bin/jdk-20/bin/"
#JAVA_HOME=/c/Users/user/Downloads/openjdk-20_windows-x64_bin/jdk-20
#export JAVA_HOME=/c/Users/user/Downloads/openjdk-20_windows-x64_bin/jdk-20
## Other potential values(NOT exhaustive):
@ -72,8 +82,9 @@ fi
# You can also use this to temporarily add applications into the PATH that are
# required to build this if you do not wish to edit your PATH across the entire
# Windows session, and for setting ANT_HOME
#export ANT_HOME="/c/apache-ant-1.10.9"
#export PATH="$PATH:$ANT_HOME/bin/"
ANT_HOME=$(ls -d /c/apache-ant-*)
export ANT_HOME="$ANT_HOME"
export PATH="$PATH:$ANT_HOME/bin/"
if [[ -n "$IS_WSL" || -n "$WSL_DISTRO_NAME" ]]; then
PATH="$PATH:/c/Program Files (x86)/Windows Kits/10/App Certification Kit/"

25
docs/UPDATES.md Normal file
View File

@ -0,0 +1,25 @@
Setting up an Update Server for an I2P Bundle
=============================================
It is important to set up a signed update server so that people are able to
safely and anonymously update your I2P bundle. There are two sort of "Levels"
to what you might do to provide updates to your users. Each of them requires the
generation of a [signed newsfeed](https://eyedeekay.github.io/Hopefully-Holistic-Guide-to-I2P-Dev-Build-Update-Hosting/),
which also serves as a way to provide information to your users about updates,
features, and security events.
This project, `i2p.firefox` a.k.a. the "I2P Easy Install Bundle" uses the "Executable"
update subtype, meaning that it capable of installing itself by executing code as the
user who runs the update, which is usually the main user of a Windows 10 or 11 PC.
This update subtype is highly flexible, but requires the creation of a "Scripted" using
something like `NSIS`, `wixl`, or custom code. Other update types include ZIP (used by
the core I2P product) and DMG(used by Mac OSX).
Static HTTP Update URL over I2P
===============================
Bittorrent Update URL over I2P
==============================
[If you choose to do this, consider using zzzot to host your open tracker instead of a normal site](https://github.com/i2p/i2p.plugins.zzzot),
which you can obtain from [this I2P link](http://stats.i2p/i2p/plugins/zzzot.su3).

View File

@ -2,14 +2,14 @@
JNA_VERSION=5.12.1
export JNA_VERSION=5.12.1
I2PFIREFOX_VERSION=1.0.7
export I2PFIREFOX_VERSION=1.0.7
I2PFIREFOX_VERSION=1.0.9
export I2PFIREFOX_VERSION=1.0.9
# Comment this out to build from an alternate branch or
# the tip of the master branch.
VERSIONMAJOR=2
VERSIONMINOR=1
VERSIONBUILD=0
VERSIONMINOR=2
VERSIONBUILD=1
I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
export I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
VERSION=i2p-2.1.0
export VERSION=i2p-2.1.0
VERSION=i2p-2.2.1
export VERSION=i2p-2.2.1

View File

@ -13,9 +13,9 @@ import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
public class CopyConfigDir extends WindowsServiceUtil {
static final Logger logger = Logger.getLogger("configlog");
final Logger logger = Logger.getLogger("configlog");
public static void initLogger() {
public void initLogger() {
try {
// This block configure the logger with handler and formatter
FileHandler fh = new FileHandler(logFile().toString());
@ -31,13 +31,13 @@ public class CopyConfigDir extends WindowsServiceUtil {
}
}
public static boolean copyDirectory(String baseDir, String workDir) {
public boolean copyDirectory(String baseDir, String workDir) {
File baseFile = new File(baseDir);
File workFile = new File(workDir);
return copyDirectory(baseFile, workFile);
}
public static boolean copyDirectory(File baseDir, File workDir) {
public boolean copyDirectory(File baseDir, File workDir) {
for (File file : baseDir.listFiles()) {
String fPath = file.getAbsolutePath().replace(
file.getParentFile().getAbsolutePath(), "");
@ -52,7 +52,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
return true;
}
public static boolean copyConfigDirectory(File baseDir, File workDir) {
public boolean copyConfigDirectory(File baseDir, File workDir) {
for (File file : baseDir.listFiles()) {
// System.out.println(file.getAbsolutePath());
String fPath = file.getAbsolutePath().replace(
@ -87,17 +87,17 @@ public class CopyConfigDir extends WindowsServiceUtil {
return true;
}
public static int copyFileNeverOverwrite(String basePath, String workPath) {
public int copyFileNeverOverwrite(String basePath, String workPath) {
File baseFile = new File(basePath);
File workFile = new File(workPath);
return copyFileNeverOverwrite(baseFile, workFile);
}
public static int copyFileNeverOverwrite(File basePath, File workPath) {
public int copyFileNeverOverwrite(File basePath, File workPath) {
return copyFile(basePath, workPath, false);
}
public static int copyFile(File basePath, File workPath, boolean overWrite) {
public int copyFile(File basePath, File workPath, boolean overWrite) {
if (!basePath.exists()) {
logger.info(basePath.getAbsolutePath() + " doesn't exist, not copying");
return 0;
@ -135,7 +135,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
}
}
protected static File selectHome() { // throws Exception {
protected File selectHome() { // throws Exception {
String path_override = System.getenv("I2P_CONFIG");
if (path_override != null) {
File path = new File(path_override);
@ -151,7 +151,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
return i2p;
}
protected static File selectProgramFile() {
protected File selectProgramFile() {
String path_override = System.getenv("I2P");
if (path_override != null) {
File path = new File(path_override);
@ -182,7 +182,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
*
* @return
*/
protected static File javaHome() {
protected File javaHome() {
File jrehome = new File(System.getProperty("java.home"));
if (jrehome != null) {
if (jrehome.exists()) {
@ -199,7 +199,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
*
* @return the app-image root
*/
protected static File appImageHome() {
protected File appImageHome() {
File jreHome = javaHome();
if (jreHome != null) {
switch (osName()) {
@ -221,7 +221,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
*
* @return the app-image root
*/
protected static String appImageExe() {
protected String appImageExe() {
File aih = appImageHome();
if (aih != null) {
switch (osName()) {
@ -243,7 +243,7 @@ public class CopyConfigDir extends WindowsServiceUtil {
*
* @return the app-image root
*/
protected static File appImageConfig() {
protected File appImageConfig() {
File aih = appImageHome();
if (aih == null) {
return null;
@ -269,13 +269,13 @@ public class CopyConfigDir extends WindowsServiceUtil {
return null;
}
protected static boolean copyConfigDir() {
protected boolean copyConfigDir() {
File appImageConfigDir = appImageConfig();
File appImageHomeDir = selectHome();
return copyConfigDirectory(appImageConfigDir, appImageHomeDir);
}
protected static String routerConfig() {
protected String routerConfig() {
File appImageHomeDir = selectHome();
File routerConf = new File(appImageHomeDir, "router.config");
if (routerConf != null) {
@ -291,14 +291,14 @@ public class CopyConfigDir extends WindowsServiceUtil {
*
* @return
*/
protected static File logFile() { return logFile("launcher.log"); }
protected File logFile() { return logFile("launcher.log"); }
/**
* set up the path to the log file
*
* @return
*/
protected static File logFile(String p) {
protected File logFile(String p) {
File log = new File(selectProgramFile(), "logs");
if (!log.exists())
log.mkdirs();

View File

@ -1,35 +0,0 @@
package net.i2p.router;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.Kernel32Util;
public class Elevator {
public static void main(String... args) {
executeAsAdministrator("c:\\windows\\system32\\notepad.exe", "");
}
public static void executeAsAdministrator(String command, String args) {
if (command == "" || command == null) {
System.out.println("No command specified");
return;
}
Shell32X.SHELLEXECUTEINFO execInfo = new Shell32X.SHELLEXECUTEINFO();
execInfo.lpFile = new WString(command);
if (args != null)
execInfo.lpParameters = new WString(args);
execInfo.nShow = Shell32X.SW_SHOWDEFAULT;
execInfo.fMask = Shell32X.SEE_MASK_NOCLOSEPROCESS;
execInfo.lpVerb = new WString("runas");
boolean result = Shell32X.INSTANCE.ShellExecuteEx(execInfo);
if (!result) {
int lastError = Kernel32.INSTANCE.GetLastError();
String errorMessage =
Kernel32Util.formatMessageFromLastErrorCode(lastError);
throw new RuntimeException("Error performing elevation: " + lastError +
": " + errorMessage +
" (apperror=" + execInfo.hInstApp + ")");
}
}
}

View File

@ -1,123 +0,0 @@
package net.i2p.router;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.Shell32;
import com.sun.jna.platform.win32.WinDef.HINSTANCE;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.platform.win32.WinReg.HKEY;
import com.sun.jna.win32.W32APIOptions;
import java.util.*;
public interface Shell32X extends Shell32 {
Shell32X INSTANCE = (Shell32X)Native.loadLibrary(
"shell32", Shell32X.class, W32APIOptions.UNICODE_OPTIONS);
int SW_HIDE = 0;
int SW_MAXIMIZE = 3;
int SW_MINIMIZE = 6;
int SW_RESTORE = 9;
int SW_SHOW = 5;
int SW_SHOWDEFAULT = 10;
int SW_SHOWMAXIMIZED = 3;
int SW_SHOWMINIMIZED = 2;
int SW_SHOWMINNOACTIVE = 7;
int SW_SHOWNA = 8;
int SW_SHOWNOACTIVATE = 4;
int SW_SHOWNORMAL = 1;
/** File not found. */
int SE_ERR_FNF = 2;
/** Path not found. */
int SE_ERR_PNF = 3;
/** Access denied. */
int SE_ERR_ACCESSDENIED = 5;
/** Out of memory. */
int SE_ERR_OOM = 8;
/** DLL not found. */
int SE_ERR_DLLNOTFOUND = 32;
/** Cannot share an open file. */
int SE_ERR_SHARE = 26;
int SEE_MASK_NOCLOSEPROCESS = 0x00000040;
int ShellExecute(int i, String lpVerb, String lpFile, String lpParameters,
String lpDirectory, int nShow);
boolean ShellExecuteEx(SHELLEXECUTEINFO lpExecInfo);
public static class SHELLEXECUTEINFO extends Structure {
/*
* DWORD cbSize;
* ULONG fMask;
* HWND hwnd;
* LPCTSTR lpVerb;
* LPCTSTR lpFile;
* LPCTSTR lpParameters;
* LPCTSTR lpDirectory;
* int nShow;
* HINSTANCE hInstApp;
* LPVOID lpIDList;
* LPCTSTR lpClass;
* HKEY hkeyClass;
* DWORD dwHotKey;
* union {
* HANDLE hIcon;
* HANDLE hMonitor;
* } DUMMYUNIONNAME;
* HANDLE hProcess;
*/
public int cbSize = size();
public int fMask;
public HWND hwnd;
public WString lpVerb;
public WString lpFile;
public WString lpParameters;
public WString lpDirectory;
public int nShow;
public HINSTANCE hInstApp;
public Pointer lpIDList;
public WString lpClass;
public HKEY hKeyClass;
public int dwHotKey;
/*
* Actually:
* union {
* HANDLE hIcon;
* HANDLE hMonitor;
* } DUMMYUNIONNAME;
*/
public HANDLE hMonitor;
public HANDLE hProcess;
protected List getFieldOrder() {
return Arrays.asList(new String[] {
"cbSize",
"fMask",
"hwnd",
"lpVerb",
"lpFile",
"lpParameters",
"lpDirectory",
"nShow",
"hInstApp",
"lpIDList",
"lpClass",
"hKeyClass",
"dwHotKey",
"hMonitor",
"hProcess",
});
}
}
}

View File

@ -1,7 +1,5 @@
package net.i2p.router;
import static net.i2p.update.UpdateType.*;
import java.io.*;
import java.net.InetAddress;
import java.net.ServerSocket;
@ -18,10 +16,11 @@ import net.i2p.router.RouterLaunch;
import net.i2p.update.*;
import net.i2p.update.UpdateManager;
import net.i2p.update.UpdatePostProcessor;
import net.i2p.update.UpdateType.*;
/**
* Launches a router from %PROGRAMFILES%/I2P using configuration data in
* %LOCALAPPDATA%/I2P.. Uses Java 9 APIs.
* Launches a router from %WORKINGDIR%/I2P using configuration data in
* %WORKINGDIR%/I2P.. Uses Java 9 APIs.
*
* Sets the following properties:
* i2p.dir.base - this points to the (read-only) resources inside the bundle
@ -30,12 +29,13 @@ import net.i2p.update.UpdatePostProcessor;
* router.pid - the pid of the java process.
*/
public class WinLauncher extends CopyConfigDir {
static WindowsUpdatePostProcessor wupp = null;
private static Router i2pRouter;
WindowsUpdatePostProcessor wupp = null;
private Router i2pRouter;
public static void main(String[] args) {
setupLauncher();
initLogger();
var launcher = new WinLauncher();
launcher.setupLauncher();
launcher.initLogger();
int privateBrowsing = 0;
boolean usabilityMode = false;
boolean chromiumFirst = false;
@ -47,18 +47,18 @@ public class WinLauncher extends CopyConfigDir {
for (String arg : args) {
if (arg.equals("-private")) {
privateBrowsing = 1;
logger.info(
launcher.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.");
launcher.logger.info("Chromium will be selected before Firefox.");
} else if (arg.equals("-usability")) {
usabilityMode = true;
logger.info(
launcher.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");
launcher.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
@ -77,7 +77,7 @@ public class WinLauncher extends CopyConfigDir {
proxyTimeoutTime = 0;
} else if (proxyTimeoutTime > 0) {
newArgsList.add(arg);
} else if (!isAvailable(4444)) {
} else if (!launcher.isAvailable(4444)) {
newArgsList.add(arg);
}
}
@ -85,8 +85,8 @@ public class WinLauncher extends CopyConfigDir {
}
}
File programs = programFile();
File home = homeDir();
File programs = launcher.programFile();
File home = launcher.homeDir();
System.setProperty(
"i2p.dir.base",
@ -101,126 +101,66 @@ public class WinLauncher extends CopyConfigDir {
* to find the JVM and Runtime bundle. This broke Windows 11 installs.
*/
System.setProperty("user.dir", programs.getAbsolutePath());
logger.info("\t" + System.getProperty("user.dir"));
logger.info("\t" + System.getProperty("i2p.dir.base"));
logger.info("\t" + System.getProperty("i2p.dir.config"));
logger.info("\t" + System.getProperty("router.pid"));
boolean continuerunning = promptServiceStartIfAvailable("i2p");
launcher.logger.info("\t" + System.getProperty("user.dir"));
launcher.logger.info("\t" + System.getProperty("i2p.dir.base"));
launcher.logger.info("\t" + System.getProperty("i2p.dir.config"));
launcher.logger.info("\t" + System.getProperty("router.pid"));
boolean continuerunning = launcher.promptServiceStartIfAvailable("i2p");
if (!continuerunning) {
logger.severe(
launcher.logger.severe(
"Service startup failure, please start I2P service with services.msc");
System.exit(2);
} else {
fixServiceConfig();
}
continuerunning = promptUserInstallStartIfAvailable();
continuerunning = launcher.promptUserInstallStartIfAvailable();
if (!continuerunning) {
logger.severe("User-install startup required.");
launcher.logger.severe("User-install startup required.");
System.exit(2);
} else {
fixServiceConfig();
}
// 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 (!copyConfigDir()) {
logger.severe("Cannot copy the configuration directory");
if (!launcher.copyConfigDir()) {
launcher.logger.severe("Cannot copy the configuration directory");
System.exit(1);
}
if (launchBrowser(privateBrowsing, usabilityMode, chromiumFirst,
proxyTimeoutTime, newArgsList)) {
if (launcher.launchBrowser(privateBrowsing, usabilityMode, chromiumFirst,
proxyTimeoutTime, newArgsList)) {
System.exit(0);
}
i2pRouter = new Router(routerConfig(), System.getProperties());
if (!isInstalled("i2p")) {
if (i2pRouter.saveConfig("routerconsole.browser", null)) {
logger.info("removed routerconsole.browser config");
launcher.i2pRouter =
new Router(launcher.routerConfig(), System.getProperties());
if (!launcher.isInstalled("i2p")) {
if (launcher.i2pRouter.saveConfig("routerconsole.browser", null)) {
launcher.logger.info("removed routerconsole.browser config");
}
if (i2pRouter.saveConfig("routerconsole.browser",
appImageExe() + " -noproxycheck")) {
logger.info("updated routerconsole.browser config " + appImageExe());
if (launcher.i2pRouter.saveConfig("routerconsole.browser",
launcher.appImageExe() +
" -noproxycheck")) {
launcher.logger.info("updated routerconsole.browser config " +
launcher.appImageExe());
}
}
logger.info("Router is configured");
launcher.logger.info("Router is configured");
Thread registrationThread = new Thread(REGISTER_UPP);
Thread registrationThread = new Thread(launcher.REGISTER_UPP);
registrationThread.setName("UPP Registration");
registrationThread.setDaemon(true);
registrationThread.start();
setNotStarting();
launcher.setNotStarting();
i2pRouter.runRouter();
launcher.i2pRouter.runRouter();
}
private static void fixServiceConfig() {
if (osName() != "windows")
return;
// If the user installed the Easy bundle before installing the
// IzPack installer, then they have a config file which contains the
// wrong update URL. Check for it, and change it back if necessary.
// closes #23
String routerconf = routerConfig();
if (routerconf != null) {
File routerconffile = new File(routerconf);
if (!routerconffile.exists()) {
return;
}
} else {
return;
}
if (isInstalled("i2p") || checkProgramFilesInstall()) {
i2pRouter = new Router(routerconf, System.getProperties());
String newsURL = i2pRouter.getConfigSetting("router.newsURL");
if (newsURL != null) {
if (newsURL.contains(
"http://dn3tvalnjz432qkqsvpfdqrwpqkw3ye4n4i2uyfr4jexvo3sp5ka.b32.i2p/news/win/beta/news.su3")) {
logger.info(
"checked router.newsURL config, containes win/beta in a service install, invalid update type");
if (i2pRouter.saveConfig("router.newsURL", ServiceUpdaterString())) {
logger.info("updated routerconsole.browser config " +
appImageExe());
}
}
}
String backupNewsURL = i2pRouter.getConfigSetting("router.backupNewsURL");
if (backupNewsURL != null) {
if (backupNewsURL.contains(
"http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/win/beta/news.su3")) {
logger.info(
"checked router.backupNewsURL config, containes win/beta in a service install, invalid update type");
if (i2pRouter.saveConfig("router.backupNewsURL",
ServiceBackupUpdaterString())) {
logger.info("updated routerconsole.browser config " +
appImageExe());
}
}
}
String updateURL = i2pRouter.getConfigSetting("router.updateURL");
if (updateURL != null) {
if (updateURL.contains(
"http://ekm3fu6fr5pxudhwjmdiea5dovc3jdi66hjgop4c7z7dfaw7spca.b32.i2p/i2pwinupdate.su3")) {
logger.info(
"checked router.updateURL config, containes easy-intall update in a service install, invalid update type");
if (i2pRouter.saveConfig("router.updateURL",
ServiceStaticUpdaterString())) {
logger.info("updated routerconsole.browser config " +
appImageExe());
}
}
}
}
}
private static void setupLauncher() {
private void setupLauncher() {
File jrehome = javaHome();
logger.info("jre home is: " + jrehome.getAbsolutePath());
File appimagehome = appImageHome();
logger.info("appimage home is: " + appimagehome.getAbsolutePath());
}
private static File programFile() {
private File programFile() {
File programs = selectProgramFile();
if (!programs.exists())
programs.mkdirs();
@ -233,7 +173,7 @@ public class WinLauncher extends CopyConfigDir {
return programs;
}
private static File homeDir() {
private File homeDir() {
File home = selectHome();
if (!home.exists())
home.mkdirs();
@ -246,11 +186,9 @@ public class WinLauncher extends CopyConfigDir {
return home;
}
private static boolean launchBrowser(int privateBrowsing,
boolean usabilityMode,
boolean chromiumFirst,
int proxyTimeoutTime,
ArrayList<String> newArgsList) {
private boolean launchBrowser(int 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();
@ -273,7 +211,7 @@ public class WinLauncher extends CopyConfigDir {
// see
// https://stackoverflow.com/questions/434718/sockets-discover-port-availability-using-java
private static boolean isAvailable(int portNr) {
private boolean isAvailable(int portNr) {
boolean portFree;
try (var ignored = new ServerSocket(portNr)) {
portFree = true;
@ -283,7 +221,7 @@ public class WinLauncher extends CopyConfigDir {
return portFree;
}
private static boolean i2pIsRunningCheck() {
private boolean i2pIsRunningCheck() {
// check if there's something listening on port 7657(Router Console)
if (!isAvailable(7657))
return true;
@ -295,7 +233,7 @@ public class WinLauncher extends CopyConfigDir {
return false;
}
private static void setNotStarting() {
private void setNotStarting() {
logger.info("removing startup file, the application has started");
File home = selectHome();
File starting = new File(home, "starting");
@ -304,7 +242,7 @@ public class WinLauncher extends CopyConfigDir {
}
}
private static void setStarting() {
private void setStarting() {
logger.info("creating startup file, router is starting up");
File home = selectHome();
File starting = new File(home, "starting");
@ -323,7 +261,7 @@ public class WinLauncher extends CopyConfigDir {
});
}
private static boolean checkStarting() {
private boolean checkStarting() {
logger.info("checking startup file");
File home = selectHome();
File starting = new File(home, "starting");
@ -338,7 +276,7 @@ public class WinLauncher extends CopyConfigDir {
// check for the existence of router.ping file, if it's less then 2
// minutes old, exit
private static boolean checkPing() {
private boolean checkPing() {
File home = selectHome();
File ping = new File(home, "router.ping");
if (ping.exists()) {
@ -355,7 +293,7 @@ public class WinLauncher extends CopyConfigDir {
return false;
}
private static boolean i2pIsRunning() {
private boolean i2pIsRunning() {
if (checkStarting())
return true;
if (checkPing())
@ -370,7 +308,7 @@ public class WinLauncher extends CopyConfigDir {
return false;
}
private static final Runnable REGISTER_UPP = () -> {
private final Runnable REGISTER_UPP = () -> {
RouterContext ctx;
while ((ctx = i2pRouter.getContext()) == null) {
sleep(1000);
@ -395,7 +333,7 @@ public class WinLauncher extends CopyConfigDir {
*
* @param millis
*/
private static void sleep(int millis) {
private void sleep(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException bad) {

View File

@ -47,43 +47,34 @@ class WinUpdateProcess implements Runnable {
File workingDir = workDir();
File logFile = new File(workingDir, "log-" + version + ".txt");
if (logFile.canWrite()) {
// check if we can write to the log file. If we can, use the
// ProcessBuilder to run the installer.
ProcessBuilder pb = new ProcessBuilder(
file.getAbsolutePath(), "/S", "/D=" + workingDir.getAbsolutePath());
Map<String, String> env = pb.environment();
env.put("OLD_I2P_VERSION", version);
env.remove("RESTART_I2P");
// check if we can write to the log file. If we can, use the
// ProcessBuilder to run the installer.
ProcessBuilder pb = new ProcessBuilder(
file.getAbsolutePath(), "/S", "/D=" + workingDir.getAbsolutePath());
Map<String, String> env = pb.environment();
env.put("OLD_I2P_VERSION", version);
env.remove("RESTART_I2P");
int exitCode = ctx.router().scheduledGracefulExitCode();
if (exitCode == Router.EXIT_HARD_RESTART ||
exitCode == Router.EXIT_GRACEFUL_RESTART)
env.put("RESTART_I2P", "true");
int exitCode = ctx.router().scheduledGracefulExitCode();
if (exitCode == Router.EXIT_HARD_RESTART ||
exitCode == Router.EXIT_GRACEFUL_RESTART)
env.put("RESTART_I2P", "true");
try {
Process p = pb.directory(workingDir)
.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");
} catch (IOException ex) {
_log.error(
"Unable to run update program in background. Update will fail.",
ex);
} catch (InterruptedException ex) {
_log.error(
"Unable to run update program in background. Update will fail.",
ex);
}
} else {
// If we cant write to the log file and we're on Windows, use the elevator
// to execute the installer instead of the ProcessBuilder.
Elevator.executeAsAdministrator(file.getAbsolutePath(),
" /S /D=" + workingDir.getAbsolutePath());
try {
Process p = pb.directory(workingDir)
.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");
} catch (IOException ex) {
_log.error(
"Unable to run update program in background. Update will fail.", ex);
} catch (InterruptedException ex) {
_log.error(
"Unable to run update program in background. Update will fail.", ex);
}
}

View File

@ -31,7 +31,7 @@ import javax.swing.JOptionPane;
public class WindowsServiceUtil {
public WindowsServiceUtil() {}
public static String queryService(String serviceName) {
public String queryService(String serviceName) {
String result = "";
String line;
ProcessBuilder pb = new ProcessBuilder("sc", "query", serviceName);
@ -54,7 +54,7 @@ public class WindowsServiceUtil {
}
return result;
}
public static String getStatePrefix(String qResult) {
public String getStatePrefix(String qResult) {
String statePrefix = "STATE : ";
// get the first occurrence of "STATE", then find the
// next occurrence of of ":" after that. Count the
@ -70,7 +70,7 @@ public class WindowsServiceUtil {
}
return statePrefix;
}
public static int getServiceStateInt(String serviceName) {
public int getServiceStateInt(String serviceName) {
// String statePrefix = "STATE : ";
String qResult = queryService(serviceName);
String statePrefix = getStatePrefix(qResult);
@ -86,14 +86,14 @@ public class WindowsServiceUtil {
return -2;
}
public static boolean isInstalled(String serviceName) {
public boolean isInstalled(String serviceName) {
if (getServiceState(serviceName).equals("uninstalled")) {
return false;
}
return true;
}
public static boolean isStart(String serviceName) {
public boolean isStart(String serviceName) {
if (getServiceState(serviceName).equals("started")) {
return true;
}
@ -106,7 +106,7 @@ public class WindowsServiceUtil {
return false;
}
public static boolean promptServiceStartIfAvailable(String serviceName) {
public boolean promptServiceStartIfAvailable(String serviceName) {
if (osName() != "windows") {
return true;
}
@ -152,17 +152,17 @@ public class WindowsServiceUtil {
return true;
}
public static String ServiceUpdaterString() {
public String ServiceUpdaterString() {
return "http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/news.su3";
}
public static String ServiceBackupUpdaterString() {
public String ServiceBackupUpdaterString() {
return "http://dn3tvalnjz432qkqsvpfdqrwpqkw3ye4n4i2uyfr4jexvo3sp5ka.b32.i2p/news.su3";
}
public static String ServiceStaticUpdaterString() {
public String ServiceStaticUpdaterString() {
return "http://echelon.i2p/i2p/i2pupdate.sud,http://stats.i2p/i2p/i2pupdate.sud";
}
public static String getProgramFilesInstall() {
public String getProgramFilesInstall() {
String programFiles = System.getenv("PROGRAMFILES");
if (programFiles != null) {
File programFilesI2P = new File(programFiles, "i2p/i2p.exe");
@ -178,7 +178,7 @@ public class WindowsServiceUtil {
return null;
}
public static boolean checkProgramFilesInstall() {
public boolean checkProgramFilesInstall() {
String programFiles = System.getenv("PROGRAMFILES");
if (programFiles != null) {
File programFilesI2P = new File(programFiles, "i2p/i2p.exe");
@ -194,7 +194,7 @@ public class WindowsServiceUtil {
return false;
}
public static boolean promptUserInstallStartIfAvailable() {
public boolean promptUserInstallStartIfAvailable() {
if (osName() != "windows") {
return true;
}
@ -205,7 +205,7 @@ public class WindowsServiceUtil {
message +=
"However, it is not running yet. Please start it using the shortcut on the desktop.\n";
message +=
"If you click \"No\", the jpackage router will be launched instead.\n";
"If you click \"No\", the Easy-Install router will be launched instead.\n";
a = JOptionPane.showConfirmDialog(null, message,
"I2P Service detected not running",
JOptionPane.YES_NO_OPTION);
@ -216,7 +216,7 @@ public class WindowsServiceUtil {
try {
String pfi = getProgramFilesInstall();
if (pfi != null)
Runtime.getRuntime().exec(pfi);
Runtime.getRuntime().exec(new String[] {pfi});
} catch (IOException e) {
return false;
}
@ -226,7 +226,7 @@ public class WindowsServiceUtil {
return true;
}
public static String getServiceState(String serviceName) {
public String getServiceState(String serviceName) {
String stateString = "uninstalled";
int state = getServiceStateInt(serviceName);
switch (state) {
@ -269,11 +269,12 @@ public class WindowsServiceUtil {
return "linux";
}
public static void main(String args[]) {
WindowsServiceUtil wsu = new WindowsServiceUtil();
// when querying the I2P router service installed by the IzPack installer
// this is the correct call.
String state = getServiceState("i2p");
int stateInt = getServiceStateInt("i2p");
String state = wsu.getServiceState("i2p");
int stateInt = wsu.getServiceStateInt("i2p");
System.out.println("i2p state: " + state + " code: " + stateInt);
promptServiceStartIfAvailable("i2p");
wsu.promptServiceStartIfAvailable("i2p");
}
}

View File

@ -44,20 +44,6 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
_log.warn("Unsupported update type " + type);
return;
}
if (fileType != SU3File.TYPE_ZIP) {
this.positionedFile = moveUpdateInstaller(file);
this.version = version;
if (!hook.compareAndSet(false, true)) {
_log.info("shutdown hook was already set");
return;
}
_log.info("adding shutdown hook");
ctx.addFinalShutdownTask(
new ZipUpdateProcess(ctx, this::getVersion, this::getFile));
}
if (SystemVersion.isWindows()) {
if (fileType != SU3File.TYPE_EXE) {
@ -77,6 +63,21 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
ctx.addFinalShutdownTask(
new WinUpdateProcess(ctx, this::getVersion, this::getFile));
} else {
if (fileType == SU3File.TYPE_ZIP) {
this.positionedFile = moveUpdateInstaller(file);
this.version = version;
if (!hook.compareAndSet(false, true)) {
_log.info("shutdown hook was already set");
return;
}
_log.info("adding shutdown hook");
ctx.addFinalShutdownTask(
new ZipUpdateProcess(ctx, this::getVersion, this::getFile));
}
}
}

View File

@ -1,7 +1,7 @@
# This now requires v3
UniCode true
!define APPNAME "I2PBrowser-Launcher"
!define APPNAME "i2peasy"
!define COMPANYNAME "I2P"
!define DESCRIPTION "This is a tool which contains an I2P router, a bundled JVM, and a tool for automatically configuring a browser to use with I2P."
!define I2P_MESSAGE "Please choose a directory."
@ -10,7 +10,6 @@ UniCode true
!define CONSOLE_URL "http://127.0.0.1:7657/home"
!include i2pbrowser-version.nsi
!include i2pbrowser-jpackage.nsi
!include FindProcess.nsh
#var INSTDIR
@ -18,11 +17,11 @@ UniCode true
SetOverwrite on
!define INSTDIR
!define I2PINSTEXE_USERMODE "$LOCALAPPDATA\i2peasy"
!define I2PINSTEXE_USERMODE "$LOCALAPPDATA\${APPNAME}"
!define RAM_NEEDED_FOR_64BIT 0x80000000
InstallDir "$PROGRAMFILES64\${COMPANYNAME}\${APPNAME}"
InstallDir $LOCALAPPDATA\${APPNAME}
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
LicenseData "licenses\LICENSE.txt"
@ -132,11 +131,6 @@ Function .onInit
# Admin installs have been migrated to user-mode installs.
# But I'm leaving it because I might need it again if I support service installs.
StrCpy $INSTDIR "${I2PINSTEXE_USERMODE}"
UserInfo::GetAccountType
pop $0
${If} $0 != "admin"
StrCpy $INSTDIR "${I2PINSTEXE_USERMODE}"
${EndIf}
!insertmacro MUI_LANGDLL_DISPLAY
#Call ShouldInstall64Bit
# look for user installs
@ -157,8 +151,8 @@ Function routerDetect
createDirectory "$INSTDIR\"
SetOutPath "$INSTDIR\"
File /a /r "I2P/config/certificates"
File /a /r "I2P/config/geoip"
File /a /r "I2P\config\certificates\"
File /a /r "I2P\config\geoip\"
FunctionEnd
Function installerFunction
@ -168,11 +162,6 @@ Function installerFunction
Sleep 500
${LoopWhile} $0 <> 0
${EndIf}
# delete the jpackaged file for safety. Remove this IMMEDIATELY after the next release.
# early-adopters and daily-build users may have to manually delete config files if they
# uninstall.
# RELATED: line 246
Delete "$INSTDIR\jpackaged"
# set the installation directory as the destination for the following actions
createDirectory $INSTDIR
@ -188,7 +177,7 @@ Function installerFunction
# Install the licenses
createDirectory "$INSTDIR\licenses"
SetOutPath "$INSTDIR\licenses"
File /a /r "licenses/*"
File /a /r "licenses\"
SetOutPath "$INSTDIR"
createDirectory "$SMPROGRAMS\${APPNAME}"
@ -285,21 +274,9 @@ Function LaunchLink
${If} ${Silent}
ReadEnvStr $0 RESTART_I2P
${If} $0 != ""
UserInfo::GetAccountType
pop $0
${If} $0 == "admin"
ShellExecAsUser::ShellExecAsUser "open" "$DESKTOP\Browse I2P.lnk"
${Else}
ExecShell "" "$DESKTOP\Browse I2P.lnk"
${EndIf}
${EndIf}
${Else}
UserInfo::GetAccountType
pop $0
${If} $0 == "admin"
ShellExecAsUser::ShellExecAsUser "open" "$DESKTOP\Browse I2P.lnk"
${Else}
ExecShell "" "$DESKTOP\Browse I2P.lnk"
${EndIf}
${EndIf}
FunctionEnd

View File

@ -1 +0,0 @@
!define I2P_VERSION

View File

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

View File

@ -27,6 +27,12 @@ gpgv --keyring ./tor.keyring "torbrowser-install-win64-${version}_${locale}.exe.
#tar xvJf "torbrowser-install-win64-${version}_${locale}.exe"
#for n in `seq 1 2000`; do echo $n; dd ibs=256 if="torbrowser-install-win64-${version}_${locale}.exe" count=2 skip=$n | file - ; done 2>/dev/null |less
#zip -FF "torbrowser-install-win64-${version}_${locale}.exe" --out extracted.zip
export WINEPREFIX=$(pwd)/../tmp
wine "torbrowser-install-win64-${version}_${locale}.exe" /S #/D .
cp -vr "$WINEPREFIX/drive_c/users/idk/Desktop/Tor Browser/" "Tor Browser"
WINE=$(which wine)
if [ -z "$WINE" ]; then
"./torbrowser-install-win64-${version}_${locale}.exe" /S #/D .
cp -vr "$HOME/Desktop/Tor Browser/" "Tor Browser"
else
export WINEPREFIX=$(pwd)/../tmp
$WINE "torbrowser-install-win64-${version}_${locale}.exe" /S #/D .
cp -vr "$WINEPREFIX/drive_c/users/idk/Desktop/Tor Browser/" "Tor Browser"
fi