Skip to content

Commit 00899b6

Browse files
committed
add ability to pass custom options and override the version
1 parent ee74696 commit 00899b6

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ The I2P router expects to find some resources in specific places. The legacy I2
3030
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`.
3131
1. The compiled custom main class gets added to the .jar as well.
3232

33-
JPackage gets invoked and pointed to the custom main class. It's operation can be customized by editing the following files:
33+
JPackage gets invoked and pointed to the custom main class. It's operation can be customized by setting the following environment variables:
3434

35-
|File|Purpose|Example|
35+
|Variable|Purpose|Example|
3636
|---|---|---|
37-
|jlink.modules|Modules to forcibly include|`jdk.crypto.ec,jdk.unsupported`|
38-
|jpackage.mac|Custom JPackage options for Mac| `--mac-sign --mac-package-name I2P`|
39-
|jpackage.win|Same but for windows|??|
37+
|JPACKAGE_OPTS|Options to pass to jpackage, usualy OS-dependent|`--mac-sign`|
38+
|I2P_VERSION|Overrides the version from the `router.jar` file| `1.2.3`|
4039

4140

4241

TODO.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Items left to do before this can be used for production installers:
44

5-
* Pass icon to jpackage - this is tricky as formats are different on Mac and Win
6-
* Pass additional OS-specific switches to jpackage (i.e. `--mac-sign`)
5+
* Pass icon to jpackage - done on Mac, need to do it on Win
76
* Should blocklist.txt be overwritten on router upgrades?
87
* Decide on jvm switches (i.e. -Xmx) and pass them through jpackage
98

build.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,22 @@ cd build
6363
$JAVA_HOME/bin/jar -cf launcher.jar net certificates geoip config webapps resources.csv
6464
cd ..
6565

66-
VERSION=$($JAVA_HOME/bin/java -cp build/router.jar net.i2p.router.RouterVersion | sed "s/.*: //" | head -n 1)
66+
if [ -z $I2P_VERSION ]; then
67+
I2P_VERSION=$($JAVA_HOME/bin/java -cp build/router.jar net.i2p.router.RouterVersion | sed "s/.*: //" | head -n 1)
68+
fi
69+
echo "preparing to invoke jpackage for I2P version $I2P_VERSION"
6770

68-
echo "preparing to invoke jpackage for I2P version $VERSION"
6971
cp $I2P_JARS/*.jar build
7072
cp "$I2P_PKG/Start I2P Router.app/Contents/Resources/i2p.icns" build/I2P.icns
73+
cp "$I2P_PKG/Start I2P Router.app/Contents/Resources/i2p.icns" build/I2P-volume.icns
7174
cp $I2P_PKG/LICENSE.txt build
7275

7376
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
7477
$JAVA_HOME/bin/jpackage --type app-image --name I2P --input build --main-jar launcher.jar --main-class net.i2p.router.PackageLauncher
7578
else
76-
$JAVA_HOME/bin/jpackage --name I2P --app-version $VERSION \
79+
$JAVA_HOME/bin/jpackage --name I2P --app-version $I2P_VERSION \
7780
--verbose \
81+
$JPACKAGE_OPTS \
7882
--resource-dir build \
7983
--license-file build/LICENSE.txt \
8084
--input build --main-jar launcher.jar --main-class net.i2p.router.PackageLauncher

0 commit comments

Comments
 (0)