resolve merge conflict
This commit is contained in:
@ -25,7 +25,7 @@ The I2P router expects to find some resources in specific places. The legacy I2
|
|||||||
* All router certificates
|
* All router certificates
|
||||||
* GeoIP database
|
* GeoIP database
|
||||||
* Custom Launcher
|
* 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, and the second entry is the path under the preferences directory where the resource should be copied. Add this file in the .jar built in step 1.
|
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.
|
||||||
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. 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 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.
|
1. The compiled custom main class gets added to the .jar as well.
|
||||||
|
13
build.sh
13
build.sh
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ -z "${JAVA_HOME}" ]; then
|
if [ -z "${JAVA_HOME}" ]; then
|
||||||
echo "JAVA_HOME needs to point to Java 14+"
|
echo "JAVA_HOME needs to point to Java 14+"
|
||||||
@ -17,15 +18,17 @@ I2P_PKG=$HERE/../i2p.i2p/pkg-temp
|
|||||||
echo "preparing resources.csv"
|
echo "preparing resources.csv"
|
||||||
mkdir build
|
mkdir build
|
||||||
cd $RES_DIR
|
cd $RES_DIR
|
||||||
find certificates -name *.crt -exec echo '{},{}' >> $HERE/build/resources.csv \;
|
find certificates -name *.crt -exec echo '{},{},true' >> $HERE/build/resources.csv \;
|
||||||
cd portable/configs
|
cd portable/configs
|
||||||
find . -name '*.config' -exec echo 'config/{},{}' >> $HERE/build/resources.csv \;
|
find . -name '*.config' -exec echo 'config/{},{},false' >> $HERE/build/resources.csv \;
|
||||||
echo "config/hosts.txt,hosts.txt" >> $HERE/build/resources.csv
|
echo "config/hosts.txt,hosts.txt,false" >> $HERE/build/resources.csv
|
||||||
echo "preparing webapps"
|
echo "preparing webapps"
|
||||||
cd $I2P_PKG
|
cd $I2P_PKG
|
||||||
find webapps -name '*.war' -exec echo '{},{}' >> $HERE/build/resources.csv \;
|
find webapps -name '*.war' -exec echo '{},{},true' >> $HERE/build/resources.csv \;
|
||||||
|
# TODO add others
|
||||||
cd $HERE
|
cd $HERE
|
||||||
echo "geoip/GeoLite2-Country.mmdb,geoip/GeoLite2-Country.mmdb" >> build/resources.csv
|
echo "geoip/GeoLite2-Country.mmdb,geoip/GeoLite2-Country.mmdb,true" >> build/resources.csv
|
||||||
|
# TODO: decide on blocklist.txt
|
||||||
|
|
||||||
sed -i 's|\./||g' build/resources.csv
|
sed -i 's|\./||g' build/resources.csv
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ public class PackageLauncher {
|
|||||||
String []split = description.split(",");
|
String []split = description.split(",");
|
||||||
String url = split[0];
|
String url = split[0];
|
||||||
String target = split[1];
|
String target = split[1];
|
||||||
|
boolean overwrite = Boolean.parseBoolean(split[2]);
|
||||||
|
|
||||||
var resource = PackageLauncher.class.getClassLoader().getResourceAsStream(url);
|
var resource = PackageLauncher.class.getClassLoader().getResourceAsStream(url);
|
||||||
|
|
||||||
@ -77,8 +78,14 @@ public class PackageLauncher {
|
|||||||
targetDir.mkdirs();
|
targetDir.mkdirs();
|
||||||
else if (!targetDir.isDirectory())
|
else if (!targetDir.isDirectory())
|
||||||
throw new Exception(targetDir + " exists but not a directory. Please get it out of the way");
|
throw new Exception(targetDir + " exists but not a directory. Please get it out of the way");
|
||||||
|
<<<<<<< HEAD
|
||||||
System.out.println(targetFile.toPath());
|
System.out.println(targetFile.toPath());
|
||||||
Files.copy(resource, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(resource, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
=======
|
||||||
|
|
||||||
|
if (!targetFile.exists() || overwrite)
|
||||||
|
Files.copy(resource, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
>>>>>>> 52dbe4c90a0a27229bc391318dcd06254b6936e6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user