Compare commits

...

18 Commits

Author SHA1 Message Date
idk
4ceddb976d get rid of redundant targz section 2022-11-06 19:37:37 -05:00
idk
8f14378aee move wineprefix and only build portables when I do a Linux daily 2022-11-06 17:44:30 -05:00
idk
c5af86adfd move wineprefix and only build portables when I do a Linux daily 2022-11-06 17:42:59 -05:00
idk
9469293bcf fixups for the windows portable 2022-11-06 16:12:55 -05:00
idk
44ce8335a1 fixups for the windows portable 2022-11-06 16:03:06 -05:00
idk
8a9ce211f3 use powershell zip to update Windows portables 2022-11-06 14:44:35 -05:00
idk
037250ae46 Add zip.sh script to generate Windows portables 2022-11-06 14:39:34 -05:00
idk
f93c4660da Add zip.sh script to generate Windows portables 2022-11-06 14:37:13 -05:00
idk
2f516f0c11 Add zip.sh script to generate Windows portables 2022-11-06 13:38:59 -05:00
idk
f3d871d64b move torbrowser.sh to torbrowser-windows.sh 2022-11-06 13:38:05 -05:00
idk
51a82601f0 Register notStarting shutdown hook 2022-10-31 12:17:30 -04:00
idk
85e30d36d7 update libraries 2022-10-25 22:03:27 -04:00
idk
7e21d86ab4 zip update processing 2022-10-23 16:05:46 -04:00
idk
6fbe64d8e2 monitor execution of update installer for errors 2022-10-23 15:41:59 -04:00
idk
91beec4f75 monitor execution of update installer for errors 2022-10-23 15:35:26 -04:00
idk
5f3a3d46f6 mark GUI component goal complete 2022-10-22 23:43:57 -04:00
idk
23d013765a mark browser.properties goal complete 2022-10-22 22:17:13 -04:00
idk
b3ff2dfdbf add silent TBB downloader script for Windows from Linux 2022-10-18 16:27:12 -04:00
17 changed files with 255 additions and 35 deletions

View File

@ -50,8 +50,8 @@ Launcher
- `[X]` Wait for router console to be ready to launch router-console browser
- `[X]` Wait for proxy to be ready to launch I2P Web Browser
- `[X]` Launch browser instead of router when a repeat-launch is detected
- `[ ]` [GUI component for launching each available component](http://git.idk.i2p/idk/i2p.plugins.firefox/-/issues/2)
- `[ ]` [Introduce `browser.properties` for customization](http://git.idk.i2p/idk/i2p.plugins.firefox/-/issues/7)
- `[X]` GUI component for launching each available component
- `[X]` Introduce `browser.properties` for customization
- `[ ]` Registry-based browser discovery [Firefox](http://git.idk.i2p/idk/i2p.plugins.firefox/-/issues/3) [Chromium](http://git.idk.i2p/idk/i2p.plugins.firefox/-/issues/4)
Browser Configuration All

View File

@ -11,6 +11,9 @@ PROFILE_VERSION=$(MAJOR).$(MINOR).$(BUILD)
all: version prep install.exe
fmt:
find . -name '*.java' -exec clang-format -i {} \;
tag:
git tag $(PROFILE_VERSION)

View File

@ -1,4 +0,0 @@
#! /usr/bin/env bash
curl -s "https://addons.mozilla.org/api/v5/addons/addon/$1/versions/?page_size=1" | jq '.results | .[0] | .file | .url' | tr -d '"'

View File

@ -47,6 +47,7 @@ rm -rf I2P
make src/I2P/config
if [ ! -d "I2P" ]; then
"$JAVA_HOME"/bin/jpackage --type app-image --name I2P --app-version "$I2P_VERSION" \
--verbose \
--java-options "-Xmx512m" \
@ -59,10 +60,12 @@ make src/I2P/config
--resource-dir build \
--app-content src/I2P/config \
--app-content src/unix/torbrowser.sh \
--app-content src/win/torbrowser-windows.sh \
--app-content src/icons/windowsUIToopie2.png \
--app-content src/icons/ui2pbrowser_icon.ico \
--icon src/icons/windowsUIToopie2.png \
--input build --main-jar launcher.jar --main-class net.i2p.router.WinLauncher
fi
cp "$I2P_PKG/licenses/"* license/
cp "$HERE/../i2p.i2p.jpackage-build/LICENSE.txt" license/I2P.txt

View File

@ -50,3 +50,8 @@ sleep 2s
ZIPCHECKSUM=$(sha256sum "I2P.tar.gz")
echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P.tar.gz" -l "$ZIPCHECKSUM" -t "$TODAYSDATE" -n "I2P.tar.gz"
github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P.tar.gz" -l "$ZIPCHECKSUM" -t "$TODAYSDATE" -n "I2P.tar.gz"
./zip.sh
WINZIPCHECKSUM=$(sha256sum "I2P-windows-portable.zip")
echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P-windows-portable.zip" -l "$WINZIPCHECKSUM" -t "$TODAYSDATE" -n "I2P-windows-portable.zip"
github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "I2P-windows-portable.zip" -l "$WINZIPCHECKSUM" -t "$TODAYSDATE" -n "I2P-windows-portable.zip"

View File

@ -51,7 +51,6 @@ 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 "$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"

View File

@ -18,8 +18,11 @@ fi
. "$HOME/github-release-config.sh"
TODAYSDATE=$(date -d '-1 day' '+%Y%m%d')
if [ -z $TODAYSDATE ]; then
TODAYSDATE=$(date -d '-1 day' '+%Y%m%d')
fi
echo github-release download -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "I2P.zip" -t "$TODAYSDATE"
github-release download -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "I2P.zip" -t "$TODAYSDATE"
unzip I2P.zip
unzip I2P.zip
find I2P -type d -exec chmod 755 {} \;

View File

@ -1,9 +1,9 @@
#! /usr/bin/env sh
JNA_VERSION=5.11.0
export JNA_VERSION=5.11.0
I2PFIREFOX_VERSION=1.0.1
export I2PFIREFOX_VERSION=1.0.1
JNA_VERSION=5.12.1
export JNA_VERSION=5.12.1
I2PFIREFOX_VERSION=1.0.3
export I2PFIREFOX_VERSION=1.0.3
# Comment this out to build from an alternate branch or
# the tip of the master branch.
VERSIONMAJOR=1

View File

@ -66,18 +66,21 @@ public class CopyConfigDir extends WindowsServiceUtil {
if (0 == cnr)
return false;
if (1 == cnr) {
logger.info("using jpackaged configs in a jpackaged install, creating jpackaged file");
logger.info(
"using jpackaged configs in a jpackaged install, creating jpackaged file");
File jpackagedConfigsInUse = new File(appImageHome(), "jpackaged");
if (!jpackagedConfigsInUse.exists()){
try{
if (!jpackagedConfigsInUse.exists()) {
try {
jpackagedConfigsInUse.createNewFile();
}catch(IOException e){
logger.warning("Error creating jpackaged file, delete config files manually when uninstalling");
} catch (IOException e) {
logger.warning(
"Error creating jpackaged file, delete config files manually when uninstalling");
}
}
}
if (-1 == cnr) {
logger.info("not overwriting existing config file, not creating jpackaged file");
logger.info(
"not overwriting existing config file, not creating jpackaged file");
}
}
}

View File

@ -172,7 +172,8 @@ public class WinLauncher extends CopyConfigDir {
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")) {
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())) {
@ -183,7 +184,8 @@ public class WinLauncher extends CopyConfigDir {
}
String backupNewsURL = i2pRouter.getConfigSetting("router.backupNewsURL");
if (backupNewsURL != null) {
if (backupNewsURL.contains("http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/win/beta/news.su3")) {
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",
@ -195,7 +197,8 @@ public class WinLauncher extends CopyConfigDir {
}
String updateURL = i2pRouter.getConfigSetting("router.updateURL");
if (updateURL != null) {
if (updateURL.contains("http://ekm3fu6fr5pxudhwjmdiea5dovc3jdi66hjgop4c7z7dfaw7spca.b32.i2p/i2pwinupdate.su3")) {
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",
@ -310,6 +313,12 @@ public class WinLauncher extends CopyConfigDir {
logger.info(e.toString());
}
}
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
setNotStarting();
}
});
}
private static boolean checkStarting() {

View File

@ -62,13 +62,22 @@ class WinUpdateProcess implements Runnable {
env.put("RESTART_I2P", "true");
try {
pb.directory(workingDir)
.redirectErrorStream(true)
.redirectOutput(logFile)
.start();
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.");
"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

View File

@ -39,14 +39,27 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
String version, File file)
throws IOException {
_log.info("Got an update to post-process");
if (SystemVersion.isWindows()) {
if (type != UpdateType.ROUTER_SIGNED_SU3 &&
type != UpdateType.ROUTER_DEV_SU3) {
_log.warn("Unsupported update type " + type);
return;
}
if (fileType != SU3File.TYPE_ZIP) {
this.positionedFile = moveUpdateInstaller(file);
this.version = version;
if (type != UpdateType.ROUTER_SIGNED_SU3 &&
type != UpdateType.ROUTER_DEV_SU3) {
_log.warn("Unsupported update type " + type);
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) {
_log.warn("Unsupported file type " + fileType);
return;

View File

@ -0,0 +1,112 @@
package net.i2p.router;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import java.util.function.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import net.i2p.I2PAppContext;
import net.i2p.router.*;
import net.i2p.util.Log;
public class ZipUpdateProcess implements Runnable {
private final RouterContext ctx;
private final Supplier<String> versionSupplier;
private final Supplier<File> fileSupplier;
private final Log _log;
ZipUpdateProcess(RouterContext ctx, Supplier<String> versionSupplier,
Supplier<File> fileSupplier) {
this.ctx = ctx;
this.versionSupplier = versionSupplier;
this.fileSupplier = fileSupplier;
this._log = ctx.logManager().getLog(ZipUpdateProcess.class);
}
private File workDir() throws IOException {
if (ctx != null) {
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");
return workDir;
} else {
workDir.mkdirs();
}
return workDir;
}
return null;
}
private void unzipUpdateInstaller() throws IOException {
String version = versionSupplier.get();
File file = fileSupplier.get();
if (file == null)
return;
File workingDir = workDir();
File zipFile = new File(workingDir, "i2pupdate_portable.zip");
File destDir = ctx.getConfigDir();
String errors = unzip(zipFile.getAbsolutePath(), destDir.getAbsolutePath());
_log.error(errors);
}
@Override
public void run() {
try {
unzipUpdateInstaller();
} catch (IOException ioe) {
_log.error("Error running updater, update may fail." + ioe);
}
}
// copied wholesale from this example:
// https://www.digitalocean.com/community/tutorials/java-unzip-file-example
// It doesn't check for zip-slips, but that's fine because if somebody's able
// to deliver a malicious update then they can just run code anyway so there's
// no point.
private static String unzip(String zipFilePath, String destDir) {
File dir = new File(destDir);
// create output directory if it doesn't exist
if (!dir.exists())
dir.mkdirs();
FileInputStream fis;
// buffer for read and write data to file
byte[] buffer = new byte[1024];
try {
fis = new FileInputStream(zipFilePath);
ZipInputStream zis = new ZipInputStream(fis);
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
String fileName = ze.getName();
File newFile = new File(destDir + File.separator + fileName);
System.out.println("Unzipping to " + newFile.getAbsolutePath());
// create directories for sub directories in zip
new File(newFile.getParent()).mkdirs();
FileOutputStream fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
// close this ZipEntry
zis.closeEntry();
ze = zis.getNextEntry();
}
// close last ZipEntry
zis.closeEntry();
zis.close();
fis.close();
} catch (IOException e) {
return e.toString();
}
return null;
}
}

View File

@ -76,10 +76,12 @@ cd java
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/WinUpdateProcess.java \
net/i2p/router/WindowsServiceUtil.java
net/i2p/router/WindowsServiceUtil.java \
net/i2p/router/ZipUpdateProcess.java
cd ..

32
src/win/torbrowser-windows.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
TORSOCKS=$(which torsocks)
#if [ -f "${TORSOCKS}" ]; then
# . "${TORSOCKS}" on
#fi
version="$(curl -s https://aus1.torproject.org/torbrowser/update_3/release/downloads.json | jq -r ".version")"
locale="en-US" # mention your locale. default = en-US
if [ -d /etc/default/locale ]; then
. /etc/default/locale
locale=$(echo "${LANG}" | cut -d . -f1)
fi
if [ ! -f ./tor.keyring ]; then
gpg --auto-key-locate nodefault,wkd --locate-keys torbrowser@torproject.org
gpg --output ./tor.keyring --export torbrowser@torproject.org
fi
if [ ! -f "tor-browser-linux64-${version}_${locale}.exe" ]; then
wget -cv "https://www.torproject.org/dist/torbrowser/${version}/torbrowser-install-win64-${version}_${locale}.exe"
wget -cv "https://www.torproject.org/dist/torbrowser/${version}/torbrowser-install-win64-${version}_${locale}.exe.asc"
fi
gpgv --keyring ./tor.keyring "torbrowser-install-win64-${version}_${locale}.exe.asc" "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"

View File

@ -29,7 +29,4 @@ fi
rm -vrf "tor-browser_${locale}"
cd "$SCRIPT_DIR" || exit 1
tar czvf I2P.tar.gz I2P

34
zip.sh Executable file
View File

@ -0,0 +1,34 @@
#! /usr/bin/env bash
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
cd "$SCRIPT_DIR" || exit 1
. "$SCRIPT_DIR/config.sh"
if [ -f "$SCRIPT_DIR/config_override.sh" ]; then
. "$SCRIPT_DIR/config_override.sh"
fi
./clean.sh
wsl make distclean
./build.sh
cd "$SCRIPT_DIR/I2P" || exit 1
TORSOCKS=$(which torsocks)
if [ -f "${TORSOCKS}" ]; then
. "${TORSOCKS}" on
fi
#./torbrowser-windows.sh
../src/win/torbrowser-windows.sh
version="$(curl -s https://aus1.torproject.org/torbrowser/update_3/release/downloads.json | jq -r ".version")"
. "${TORSOCKS}" off
locale="en-US" # mention your locale. default = en-US
if [ -d /etc/default/locale ]; then
. /etc/default/locale
locale=$(echo "${LANG}" | cut -d . -f1)
fi
rm -vrf "tor-browser_${locale}"
cd "$SCRIPT_DIR" || exit 1
rm -rf I2P-portable && cp -r I2P I2P-portable
#powershell Compress-Archive -force I2P-portable I2P-windows-portable.zip
zip -r I2P-windows-portable.zip I2P-portable