appdwarf/apps/mkjava

19 lines
540 B
Bash
Executable file

#!/bin/sh
PATH=$(dirname "$(readlink -f "${0}")")/..:$PATH
DIR=/tmp/appdwarf/java
mkdir -p $DIR
VER=$1
shift
LINK=https://api.adoptium.net/v3/binary/latest/$VER/ga/linux/x64/jdk/hotspot/normal/eclipse
curl -L "$LINK" | tar xz -C$DIR
mv $DIR/jdk* $DIR/jdk
$DIR/jdk/bin/jlink --add-modules ALL-MODULE-PATH --output $DIR/jre --strip-debug --no-man-pages --no-header-files --compress=0
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/jre
sed -i 5s#/#/bin/# $DIR/jre/AppRun
appdwarf $DIR/jre "$@"
mv $DIR/jre.sh java"$VER"
rm -rf $DIR