appdwarf/mkjava

26 lines
634 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
2021-12-14 06:45:43 +00:00
JRE=$DIR/jre
VER=$1
2021-05-15 19:34:16 +00:00
mkdir -p $DIR
2021-12-14 06:45:43 +00:00
LINK=https://api.adoptium.net/v3/binary/latest/$1/ga/linux/x64/jdk/hotspot/normal/eclipse
2021-12-07 19:06:11 +00:00
curl -L $LINK | tar xz -C$DIR
2021-12-14 06:45:43 +00:00
$DIR/jdk*/bin/jlink --add-modules ALL-MODULE-PATH --output $JRE --strip-debug --no-man-pages --no-header-files --compress=0
2021-05-15 19:34:16 +00:00
2021-12-14 06:45:43 +00:00
cat > $JRE/AppRun << 'EOF'
2021-05-15 19:34:16 +00:00
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export LD_LIBRARY_PATH="${HERE}":$PATH
"${HERE}"/bin/java $@
rm -r ~/javasharedresources
EOF
2021-12-14 06:45:43 +00:00
chmod +x $JRE/AppRun
2021-05-15 19:34:16 +00:00
2021-10-28 17:20:08 +00:00
shift
2021-12-14 06:45:43 +00:00
appdwarf $JRE $@
mv $(basename $JRE).sh java$VER
2021-05-15 19:34:16 +00:00
rm -rf $DIR