make the build.sh script a little nicer, also apparently windows requires classpath jars to be absolute, or at least I had to make them that to make them work

This commit is contained in:
idk
2021-04-03 16:23:26 -04:00
parent 87f8dbf0e0
commit f06a8b11e0
3 changed files with 30 additions and 23 deletions

View File

@ -24,14 +24,28 @@ I2P_PKG="$HERE/../i2p.i2p/pkg-temp"
echo "preparing resources.csv"
mkdir -p build
cd "$RES_DIR"
mkdir -p build build/config build/geoip
cp -rv "$RES_DIR/certificates" build/certificates
cp -rv "$I2P_PKG/webapps" build/webapps
cp -v "$I2P_PKG/"*.config build/config
cp -v "$I2P_PKG/"hosts.txt build/config
cp "$RES_DIR"/GeoLite2-Country.mmdb.gz build/geoip
gunzip build/geoip/GeoLite2-Country.mmdb.gz
#cd "$RES_DIR"
cd build
find certificates -name *.crt -exec echo '{},{},true' >> "$HERE"/build/resources.csv \;
cd portable/configs
cd config
find . -name '*.config' -exec echo 'config/{},{},false' >> "$HERE"/build/resources.csv \;
cd ..
echo "config/hosts.txt,hosts.txt,false" >> "$HERE"/build/resources.csv
echo "preparing webapps"
cd "$I2P_PKG"
#cd "$I2P_PKG"
find webapps -name '*.war' -exec echo '{},{},true' >> "$HERE"/build/resources.csv \;
# TODO add others
cd "$HERE"
@ -40,22 +54,10 @@ echo "geoip/GeoLite2-Country.mmdb,geoip/GeoLite2-Country.mmdb,true" >> build/res
sed -i.bak 's|\./||g' build/resources.csv
echo "copying certificates"
cp -R "$RES_DIR"/certificates build/
echo "copying config"
cp -R "$RES_DIR"/portable/configs build/config
cp -R "$RES_DIR"/hosts.txt build/config/hosts.txt
cp -R "$I2P_PKG"/webapps build/
echo "copying GeoIP"
mkdir -p build/geoip
cp "$RES_DIR"/GeoLite2-Country.mmdb.gz build/geoip
gunzip build/geoip/GeoLite2-Country.mmdb.gz
echo "compiling custom launcher"
cp "$I2P_JARS"/*.jar build
cd java
"$JAVA_HOME"/bin/javac -d ../build -classpath ../build/i2p.jar:../build/router.jar net/i2p/router/PackageLauncher.java
"$JAVA_HOME"/bin/javac -d ../build -classpath "$HERE"/build/i2p.jar:"$HERE"/build/router.jar net/i2p/router/PackageLauncher.java
cd ..
echo "building launcher.jar"
@ -68,13 +70,17 @@ if [ -z $I2P_VERSION ]; then
fi
echo "preparing to invoke jpackage for I2P version $I2P_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
#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
"$JAVA_HOME"/bin/jpackage --type app-image --name I2P --app-version "$I2P_VERSION" \
--verbose \
$JPACKAGE_OPTS \
--resource-dir build \
--input build --main-jar launcher.jar --main-class net.i2p.router.PackageLauncher
elif uname | grep -i mingw; then
"$JAVA_HOME"/bin/jpackage --type app-image --name I2P --app-version "$I2P_VERSION" \
--verbose \

View File

@ -1,6 +1,6 @@
#! /usr/bin/env sh
rm -rfv \
rm -rf \
build \
eventlog.txt \
hostsdb.blockfile \

View File

@ -80,6 +80,7 @@ public class PackageLauncher {
throw new Exception(targetDir + " exists but not a directory. Please get it out of the way");
if (!targetFile.exists() || overwrite)
System.out.println(targetFile.toPath());
Files.copy(resource, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}