appdwarf/mkjava

25 lines
715 B
Plaintext
Raw Normal View History

2021-05-15 19:34:16 +00:00
#!/bin/bash
PATH=$(dirname $(readlink -f "${0}")):$PATH
2021-05-15 19:34:16 +00:00
DIR=/tmp/dwarf-portable-executable/java
mkdir -p $DIR
2021-12-07 19:06:11 +00:00
LINK=$(curl https://api.github.com/repos/adoptium/temurin$1-binaries/releases/latest | jq .assets[].browser_download_url | grep 'jdk_x64_linux_hotspot' | cut -d\" -f2)
curl -L $LINK | tar xz -C$DIR
$DIR/jdk*/bin/jlink --add-modules ALL-MODULE-PATH --output $DIR/jre --strip-debug --no-man-pages --no-header-files --compress=0
JDK=$DIR/jre
2021-10-28 17:20:08 +00:00
ver=$1
2021-05-15 19:34:16 +00:00
cat > $JDK/AppRun << 'EOF'
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export LD_LIBRARY_PATH="${HERE}":$PATH
"${HERE}"/bin/java $@
rm -r ~/javasharedresources
EOF
chmod +x $JDK/AppRun
2021-10-28 17:20:08 +00:00
shift
appdwarf $JDK $@
mv $(basename $JDK).sh java$ver
2021-05-15 19:34:16 +00:00
rm -rf $DIR