-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathinstalljava
executable file
·59 lines (50 loc) · 1.15 KB
/
installjava
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
56
57
58
59
#!/usr/bin/env sh
if ! hash wget > /dev/null
then
apt install wget -y
fi
print_status() {
printf "(>) ${1}...\n"
}
set_arch() {
case "$(uname -m)" in
aarch64|armv8l)
ARCH=aarch64
;;
armv7l|arm)
ARCH=arm
;;
*)
printf "(!) Your device architecture not supported yet.\n"
exit 1
;;
esac
}
get_tar() {
wget -q --show-progress -c https://github.com/Hax4us/java/releases/download/v8/jdk8_${ARCH}.tar.gz -O jdk8_$ARCH.tar.gz
tar -xf jdk8_$ARCH.tar.gz -C $PREFIX/share
chmod +x $PREFIX/share/bin/*
}
get_java()
{
cat <<- CONF > $PREFIX/bin/java
#!/usr/bin/bash
unset LD_PRELOAD
export JAVA_HOME="$PREFIX/share/jdk8"
export LIB_DIR="\$PREFIX/share/glib"
export LD_LIBRARY_PATH="\$LIB_DIR"
exec proot -0 \$JAVA_HOME/bin/java "\$@"
CONF
}
cleanup() {
rm -f jdk8_${ARCH}.tar.gz
rm -rf $PREFIX/share/bin
}
set_arch
print_status "Getting system architecture"
get_tar
print_status "Extracting tar files to specific directory"
print_status "Setting up java program for execution"
get_java
print_status "Cleaning up unwanted files"
cleanup