pollymc/.github/scripts/prepare_JREs.sh

42 lines
1011 B
Bash
Raw Normal View History

2022-02-07 15:48:47 +05:30
#!/usr/bin/env bash
URL_JDK8="https://api.adoptium.net/v3/binary/version/jdk8u312-b07/linux/x64/jre/hotspot/normal/eclipse"
2022-02-07 15:48:47 +05:30
URL_JDK17="https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jre/hotspot/normal/eclipse"
mkdir -p JREs
pushd JREs
wget --content-disposition "$URL_JDK8"
wget --content-disposition "$URL_JDK17"
for file in *;
do
mkdir temp
2022-02-08 08:55:52 +05:30
re='(OpenJDK([[:digit:]]+)U-jre_x64_linux_hotspot_([[:digit:]]+)(.*).tar.gz)'
2022-02-07 15:48:47 +05:30
if [[ $file =~ $re ]];
then
2022-02-08 08:55:52 +05:30
version_major=${BASH_REMATCH[2]}
version_trailing=${BASH_REMATCH[4]}
if [ $version_major = 17 ];
then
hyphen='-'
else
hyphen=''
fi
version_edit=$(echo $version_trailing | sed -e 's/_/+/g' | sed -e 's/b/-b/g')
dir_name=jdk$hyphen$version_major$version_edit-jre
mkdir jre$version_major
2022-02-07 15:48:47 +05:30
tar -xzf $file -C temp
pushd temp/$dir_name
2022-02-08 08:55:52 +05:30
cp -r . ../../jre$version_major
2022-02-07 15:48:47 +05:30
popd
fi
rm -rf temp
done
popd