Files
i2p-jpackage/README.md

62 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

2021-03-18 21:29:22 +00:00
# I2P JPackage
2021-03-18 22:24:49 +00:00
** This is work in progress. Even this readme may change rapidly. **
2021-04-04 20:58:10 -04:00
** Work on this project has largely been moved to platform-specific repositories **
Find them:
- [Windows All-in-One Installer](https://i2pgit.org/i2p-hackers/i2p.firefox/) Gitlab Repository on i2pgit.org
- [Mac OSX .dmg Installer](https://i2pgit.org/i2p-hackers/i2p-jpackage-mac/) Gitlab Repository on i2pgit.org
If you just want to get an experimental jpackaged router on Windows or Mac OSX,
just visit this [Informational page](https://eyedeekay.github.io/i2p).
If you want to use a `jpackaged` router on Linux you can use this repository,
but there is no guarantee of support. There are at least a couple of things
about the approach used here that are arguably more complicated than they
need to be, and the configuration it uses is not ideal. You're probably much
better off with a `.deb` package or a JVM and a `jar` install.
This project aims to contain scripts and code necessary to build all-in-one installers for Windows, Mac, and Linux using the [JPackage] tool.
2021-03-18 22:24:49 +00:00
### Requirements
You need JDK 14 or newer installed on your system. On Windows you also need the [Wix] tool and a bash-like environment like [Cygwin] or [GitBash].
### Building
1. Set the `JAVA_HOME` variable to point to the installation of the JDK
1. Clone the i2p.i2p module as a sibling to this module.
1. Build it using `ant clean pkg`
1. Run `build.sh`
### How does it work
The I2P router expects to find some resources in specific places. The legacy I2P installer deployes those resources where they are exxpected to be. However with installers built with JPackage, and more specifically with Mac AppBundles it is not possible to execute arbitrary code during installation. The way to get around this is:
1. Create a .jar file containing the following resources
* All router certificates
* GeoIP database
* Custom Launcher
1. Enumerate these resources and generate a file called `resources.csv`. The format is CSV file where the first entry is the path that the classloader will use to locate the file, the second entry is the path under the preferences directory where the resource should be copied, and the third entry indicates whether to overwrite any existing files (true|false). Add this file in the .jar built in step 1.
2021-03-18 22:24:49 +00:00
1. Use a custom main class `net.i2p.router.PackageLauncher` which reads the above list and copies each resource to the appropriate path under the current user's preferences directory, which is OS-dependent.
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 setting the following environment variables:
2021-03-18 22:24:49 +00:00
|Variable|Purpose|Example|
2021-03-18 22:24:49 +00:00
|---|---|---|
|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`|
2021-03-18 22:24:49 +00:00
[JPackage]: https://openjdk.java.net/jeps/392
[Wix]: https://wixtoolset.org/
[Cygwin]: https://cygwin.com
[GitBash]: https://gitforwindows.org