This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
a64.sh
executable file
·245 lines (225 loc) · 7.72 KB
/
a64.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/data/data/com.termux/files/usr/bin/bash
#Setup
shopt -s expand_aliases
alias ee='echo -e'
#Greetings
echo
ee "\e[93mThis script will install openjdk-11 in Termux."
echo
#Checking for existing Java installation
if [ -e "$PREFIX"/bin/java ] || [ -e "$PREFIX"/share/jvm/openjdk-11.0.1/bin/java ] || [ -e "$PREFIX"/share/jdk8/bin/java ]
then
ee "\e[32mJava is already installed!"
java --version
echo
exit
else
archname=$(dpkg --print-architecture)
tag="v2.0"
ex="deb"
file="openjdk11"
read -p "There are two java files for this cpu architecture.. choose one...
1) Full Openjdk[~231MB]
2) Partial implementation (not standalone may be buggy)[~20MB]
3) JDK8 by hax4us, compiled into deb by me
4) JDK9
(1|2|3|4)" in
if [[ $in -eq 1 ]]
then
#Actual installation
ee "\e[32m[*] \e[34mInstalling openjdk-11 for ${archname}..."
ee "\e[32m[*] \e[34mPlease wait for some time....\e[0m"
pkg install wget -y
wget https://github.com/suhan-paradkar/java-in-termux/releases/download/v2.0/openjdk11.deb
wgetreturn=$?
if [[ $wgetreturn -eq 0 ]]
then
dpkg -i openjdk11."$ex"
cd $PREFIX/share/jvm/openjdk-11.0.1/bin/
chmod +x *
echo
ee "\e[32mJava was successfully installed!"
ee "Check it by running \e[34mjava --version from terminal after restarting termux\e[0m"
echo
else
echo
ee "\e[31mwget exited with an error code : $wgetreturn"
case $wgetreturn in
1)d
ee "\e[31mError : Generic code error\e[0m"
;;
2)
ee "\e[31mError : Parse error-for instance, when parsing command-line options, the .wgetrc or .netrc...\e[0m"
;;
3)
ee "\e[31mError : File I/O error.\e[0m"
;;
4)
ee "\e[31mError : Network failure.\e[0m"
;;
5)
ee "\e[31mError : SSL verification failure.\e[0m"
;;
6)
ee "\e[31mError : Username/password authentication failure\e[0m"
;;
7)
ee "\e[31mError : Protocol errors.\e[0m"
;;
8)
ee "\e[31mError : Server issued an error response.\e[0m"
;;
esac
echo
exit
fi
elif [[ $in -eq 2 ]]
then
#Actual installation
ee "\e[32m[*] \e[34mInstalling partial openjdk-11 for ${archname}..."
ee "\e[32m[*] \e[34mPlease wait for some time....\e[0m"
pkg install wget -y
wget https://github.com/suhan-paradkar/java-in-termux/releases/download/v2.0/openjdk11_jvdroid.deb
wgetreturn=$?
if [[ $wgetreturn -eq 0 ]]
then
dpkg -i openjdk11_jvdroid."$ex"
echo
ee "\e[32mPartial Java was successfully installed!"
ee "Check it by running \e[34mjava --version from terminal after restarting termux\e[0m"
echo
else
echo
ee "\e[31mwget exited with an error code : $wgetreturn"
case $wgetreturn in
1)d
ee "\e[31mError : Generic code error\e[0m"
;;
2)
ee "\e[31mError : Parse error-for instance, when parsing command-line options, the .wgetrc or .netrc...\e[0m"
;;
3)
ee "\e[31mError : File I/O error.\e[0m"
;;
4)
ee "\e[31mError : Network failure.\e[0m"
;;
5)
ee "\e[31mError : SSL verification failure.\e[0m"
;;
6)
ee "\e[31mError : Username/password authentication failure\e[0m"
;;
7)
ee "\e[31mError : Protocol errors.\e[0m"
;;
8)
ee "\e[31mError : Server issued an error response.\e[0m"
;;
esac
echo
exit
fi
elif [[ $in -eq 3 ]]
then
#Actual installation
ee "\e[32m[*] \e[34mInstalling openjdk8 for ${archname}..."
ee "\e[32m[*] \e[34mPlease wait for some time....\e[0m"
pkg install wget -y
wget https://github.com/suhan-paradkar/java-in-termux/releases/download/v2.5/openjdk_8.0_aarch64.deb
wgetreturn=$?
if [[ $wgetreturn -eq 0 ]]
then
dpkg -i openjdk_8.0_aarch64."$ex"
export JAVA_HOME=$PREFIX/share/jdk8
echo "export JAVA_HOME=""$PREFIX""/share/jdk8" >> "$HOME"/.profile
PATH=$PREFIX/share/jdk8/bin:$PATH
echo "PATH=""$PREFIX""/share/jdk8/bin:""$PATH"" " >> "$HOME"/.profile
cd $PREFIX/share/jdk8/bin
chmod +x *
cd $HOME/java-in-termux/
echo
ee "\e[32mJava8 was successfully installed!"
ee "Check it by running \e[34mjava --version from terminal after restarting termux\e[0m"
echo
else
echo
ee "\e[31mwget exited with an error code : $wgetreturn"
case $wgetreturn in
1)d
ee "\e[31mError : Generic code error\e[0m"
;;
2)
ee "\e[31mError : Parse error-for instance, when parsing command-line options, the .wgetrc or .netrc...\e[0m"
;;
3)
ee "\e[31mError : File I/O error.\e[0m"
;;
4)
ee "\e[31mError : Network failure.\e[0m"
;;
5)
ee "\e[31mError : SSL verification failure.\e[0m"
;;
6)
ee "\e[31mError : Username/password authentication failure\e[0m"
;;
7)
ee "\e[31mError : Protocol errors.\e[0m"
;;
8)
ee "\e[31mError : Server issued an error response.\e[0m"
;;
esac
echo
exit
fi
elif [[ $in -eq 4 ]]
#Actual installation
ee "\e[32m[*] \e[34mInstalling openjdk9 for ${archname}$
ee "\e[32m[*] \e[34mPlease wait for some time....\e[0m"
pkg install wget -y
wget https://github.com/suhan-paradkar/java-in-termux/releases/download/OpenJDK9/alsa-lib_1.1.3_${archname}.deb
wget https://github.com/suhan-paradkar/java-in-termux/releases/download/OpenJDK9/openjdk-9-jre-headless_9.2017.8.20-1_${archname}.deb
wget https://github.com/suhan-paradkar/java-in-termux/releases/download/OpenJDK9/openjdk-9-jdk-headless_9.2017.8.20-1_${archname}.deb
pkg in ./alsa-lib_1.1.3_${archname}.deb ./openjdk-9-jre-headless_9.2017.8.20-1_${archname}.deb ./openjdk-9-jdk-headless_9.2017.8.20-1_${archname}.deb
echo
ee "\e[32mJava8 was successfully installed!"
ee "Check it by running \e[34mjava --version from terminal after restarting termux\e[0m"
echo
else
echo
ee "\e[31mwget exited with an error code : $wgetreturn"
case $wgetreturn in
1)d
ee "\e[31mError : Generic code error\e[0m"
;;
2)
ee "\e[31mError : Parse error-for instance, when parsing command-line options, the .wgetrc or .netrc...\e[0m"
;;
3)
ee "\e[31mError : File I/O error.\e[0m"
;;
4)
ee "\e[31mError : Network failure.\e[0m"
;;
5)
ee "\e[31mError : SSL verification failure.\e[0m"
;;
6)
ee "\e[31mError : Username/password authentication failure\e[0m"
;;
7)
ee "\e[31mError : Protocol errors.\e[0m"
;;
8)
ee "\e[31mError : Server issued an error response.\e[0m"
;;
esac
echo
exit
fi
else
ee "\e[31mInvalid input.\e[0m"
fi
fi