From 00899b62dd6aa54d3101b0939622d52bc4d00fbf Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sat, 20 Mar 2021 02:45:23 +0000 Subject: [PATCH] add ability to pass custom options and override the version --- README.md | 9 ++++----- TODO.md | 3 +-- build.sh | 10 +++++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 27b1262..b5c097a 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,12 @@ The I2P router expects to find some resources in specific places. The legacy I2 1. The custom main class will also set any system properties necessary for I2P to work, then invoke the "real" main class `net.i2p.router.RouterLaunch`. 1. The compiled custom main class gets added to the .jar as well. -JPackage gets invoked and pointed to the custom main class. It's operation can be customized by editing the following files: +JPackage gets invoked and pointed to the custom main class. It's operation can be customized by setting the following environment variables: -|File|Purpose|Example| +|Variable|Purpose|Example| |---|---|---| -|jlink.modules|Modules to forcibly include|`jdk.crypto.ec,jdk.unsupported`| -|jpackage.mac|Custom JPackage options for Mac| `--mac-sign --mac-package-name I2P`| -|jpackage.win|Same but for windows|??| +|JPACKAGE_OPTS|Options to pass to jpackage, usualy OS-dependent|`--mac-sign`| +|I2P_VERSION|Overrides the version from the `router.jar` file| `1.2.3`| diff --git a/TODO.md b/TODO.md index 88a856a..5246bf9 100644 --- a/TODO.md +++ b/TODO.md @@ -2,8 +2,7 @@ Items left to do before this can be used for production installers: -* Pass icon to jpackage - this is tricky as formats are different on Mac and Win -* Pass additional OS-specific switches to jpackage (i.e. `--mac-sign`) +* Pass icon to jpackage - done on Mac, need to do it on Win * Should blocklist.txt be overwritten on router upgrades? * Decide on jvm switches (i.e. -Xmx) and pass them through jpackage diff --git a/build.sh b/build.sh index c19bf3d..8732408 100755 --- a/build.sh +++ b/build.sh @@ -63,18 +63,22 @@ cd build $JAVA_HOME/bin/jar -cf launcher.jar net certificates geoip config webapps resources.csv cd .. -VERSION=$($JAVA_HOME/bin/java -cp build/router.jar net.i2p.router.RouterVersion | sed "s/.*: //" | head -n 1) +if [ -z $I2P_VERSION ]; then + I2P_VERSION=$($JAVA_HOME/bin/java -cp build/router.jar net.i2p.router.RouterVersion | sed "s/.*: //" | head -n 1) +fi +echo "preparing to invoke jpackage for I2P version $I2P_VERSION" -echo "preparing to invoke jpackage for I2P version $VERSION" cp $I2P_JARS/*.jar build cp "$I2P_PKG/Start I2P Router.app/Contents/Resources/i2p.icns" build/I2P.icns +cp "$I2P_PKG/Start I2P Router.app/Contents/Resources/i2p.icns" build/I2P-volume.icns cp $I2P_PKG/LICENSE.txt build if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then $JAVA_HOME/bin/jpackage --type app-image --name I2P --input build --main-jar launcher.jar --main-class net.i2p.router.PackageLauncher else - $JAVA_HOME/bin/jpackage --name I2P --app-version $VERSION \ + $JAVA_HOME/bin/jpackage --name I2P --app-version $I2P_VERSION \ --verbose \ + $JPACKAGE_OPTS \ --resource-dir build \ --license-file build/LICENSE.txt \ --input build --main-jar launcher.jar --main-class net.i2p.router.PackageLauncher