appdwarf/apps/mkjava

26 lines
615 B
Bash
Executable file

#!/bin/bash
PATH=$(dirname "$(readlink -f "${0}")")/..:$PATH
DIR=/tmp/appdwarf/java
JRE=$DIR/jre
VER=$1
mkdir -p $DIR
LINK=https://api.adoptium.net/v3/binary/latest/$1/ga/linux/x64/jdk/hotspot/normal/eclipse
curl -L "$LINK" | tar xz -C$DIR
$DIR/jdk*/bin/jlink --add-modules ALL-MODULE-PATH --output $JRE --strip-debug --no-man-pages --no-header-files --compress=0
cat > $JRE/AppRun << 'EOF'
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export LD_LIBRARY_PATH="${HERE}":$PATH
"${HERE}"/bin/java $@
rm -rf ~/javasharedresources
EOF
chmod +x $JRE/AppRun
shift
appdwarf $JRE $@
mv $JRE.sh java"$VER"
rm -rf $DIR