add ability to pass custom options and override the version

This commit is contained in:
Zlatin Balevsky
2021-03-20 02:45:23 +00:00
parent ee74696042
commit 00899b62dd
3 changed files with 12 additions and 10 deletions

View File

@ -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`|

View File

@ -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

View File

@ -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