-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathreproduce.sh
More file actions
executable file
·40 lines (29 loc) · 1.21 KB
/
reproduce.sh
File metadata and controls
executable file
·40 lines (29 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# Reproducible JDK 9+ JAR generation script
# Downloads OpenJDK, extracts modules and creates rt.jar
set -euo pipefail # Exit on error, undefined vars, pipe failures
# Configuration
DOWNLOAD_LINK="https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz"
FILENAME="jdk.tar.gz"
EXPECTED_SHA256="0022753d0cceecacdd3a795dd4cea2bd7ffdf9dc06e22ffd1be98411742fbb44"
# Download JDK if not exists
[ ! -f "$FILENAME" ] && wget "$DOWNLOAD_LINK" -O "$FILENAME"
# Verify SHA256 checksum
echo "$EXPECTED_SHA256 $FILENAME" | sha256sum -c || exit 1
# Extract JDK to temp directory
rm -rf temp && mkdir temp
tar -xzf "$FILENAME" --strip-components=1 -C temp
cd temp
# Extract all .jmod files directly to temp directory
mkdir extracted
for jmod in jmods/*.jmod; do
./bin/jmod extract --dir extracted "$jmod"
done
# Package classes into rt.jar
./bin/jar -cf rt.jar -C extracted/classes .
# Copy output files and cleanup
cp rt.jar lib/jrt-fs.jar release ../
cd .. && rm -rf temp "$FILENAME"
echo "Generated: rt.jar ($(du -h rt.jar | cut -f1))"
echo "Generated: jrt-fs.jar ($(du -h jrt-fs.jar | cut -f1))"
echo "Generated: release ($(du -h release | cut -f1))"