forked from MasterDevX/Termux-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installjava
45 lines (44 loc) · 1.21 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
#!/data/data/com.termux/files/usr/bin/bash
shopt -s expand_aliases
alias ee='echo -e'
echo
ee "\e[93mThis script will install Java in Termux."
ee "\e[93mLibraries compiled by \e[32mHax4us\e[93m, script written by \e[32mHax4us \e[93mand \e[32mMasterDevX\e[93m."
echo
if [ -e $PREFIX/bin/java ]
then
ee "\e[32mJava is already installed!"
echo
exit
else
case `dpkg --print-architecture` in
aarch64)
archname="aarch64" ;;
arm64)
archname="aarch64" ;;
armhf)
archname="arm" ;;
armv7l)
archname="arm" ;;
arm)
archname="arm" ;;
*)
ee "\e[91mERROR: Unknown architecture."; echo; exit ;;
esac
ee "\e[32m[*] \e[34mDownloading JDK-8 (~70Mb) for ${archname}..."
wget https://github.com/Hax4us/java/releases/download/v8/jdk8_${archname}.tar.gz -q
ee "\e[32m[*] \e[34mMoving JDK to system..."
mv jdk8_${archname}.tar.gz $PREFIX/share
ee "\e[32m[*] \e[34mExtracting JDK..."
cd $PREFIX/share
tar -xhf jdk8_${archname}.tar.gz
ee "\e[32m[*] \e[34mMoving Java wrapper scripts to bin..."
mv bin/* $PREFIX/bin
ee "\e[32m[*] \e[34mCleaning up temporary files..."
rm -rf $HOME/installjava
rm -rf $PREFIX/share/jdk8_${archname}.tar.gz
rm -rf $PREFIX/share/bin
echo
ee "\e[32mJava was successfully installed!\e[39m"
echo
fi