-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_graalvm17.sh
executable file
·55 lines (45 loc) · 1.99 KB
/
get_graalvm17.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env sh
# downloads and extracts the necessary subfolder from the graalvm macos archive stored at github;
# the archive is not saved locally but is piped to tar;
# we use wget (and not curl), since graalvm github URL points to a HTML redirect that curl cannot process
# (c) Sergejs Kozlovics, 2021
# license: CC BY 4.0
# to find newer releases, visit https://github.com/graalvm/graalvm-ce-builds/releases/
DEST_DIR=graalvm
# We rely on these variables:
# $CPUTYPE in macOS can be "x86_64" or "arm64"
# $OSTYPE can be, e.g., "darwin20.0" in macOS
# $HOSTTYPE in Linux can be "x86_64" or "aarch64"
# $OSTYPE=linux-gnu in Linux
if case $OSTYPE in darwin*) true;; *) false;; esac; then
# macOS
if [ "$CPUTYPE" = "x86_64" ]; then
SRC_URL="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-darwin-amd64-22.2.0.tar.gz"
else
SRC_URL="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-darwin-aarch64-22.2.0.tar.gz"
fi
PATH_PREFIX=graalvm-ce-java17-22.2.0/Contents/Home
PATH_PREFIX_LEN=3
else
# not macOS
# using $SHELL to get variables (since we can be now in a dummy shell))
OSTYPE=$(echo "echo \$OSTYPE" | $SHELL)
HOSTTYPE=$(echo "echo \$HOSTTYPE" | $SHELL)
if [ $OSTYPE = "linux-gnu" ]; then
# GNU/Linux
if [ $HOSTTYPE = "x86_64" ]; then
SRC_URL="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-linux-amd64-22.2.0.tar.gz"
elif [ $HOSTTYPE = "aarch64" ]; then
SRC_URL="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-linux-aarch64-22.2.0.tar.gz"
else
echo Unsupported Linux processor architecture $HOSTTYPE.
fi
PATH_PREFIX=graalvm-ce-java17-22.2.0
PATH_PREFIX_LEN=1
else
echo I do not know how to install GraalVM for your OS $OSTYPE
exit
fi
fi
mkdir -p $DEST_DIR
wget -q -O - $SRC_URL | tar --directory $DEST_DIR --strip-components=$PATH_PREFIX_LEN -xvz $PATH_PREFIX