forked from eduvpn/android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ar_builder_setup.sh
executable file
·68 lines (61 loc) · 2.55 KB
/
ar_builder_setup.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
###############################################################################
# ANDROID-REBUILDS SDK CONFIGURATION
###############################################################################
AR_SDK_DIR=${HOME}/android-rebuilds-sdk
# Android-Rebuilds F-Droid Mirror, will have to be changed to something hosted by SURF or the original AR repo considering the NDK is already unavailable
AR_SDK_URL=https://mirror.f-droid.org/android-free/repository/
# Android-Rebuilds NDK mirror, temporary host because F-Droid does not host NDK version R21
AR_NDK_URL=https://aaio.eu/ndk/
AR_NDK_FILE=android-ndk-0-linux-x86_64.tar.bz2
declare -a arr=(
"sdk-repo-linux-tools-26.1.1.zip" # Includes sdkmanager
"sdk-repo-linux-platforms-eng.11.0.0_r27.zip" # To compile ics-openvpn
"sdk-repo-linux-platforms-eng.10.0.0_r36.zip" # To compile eduvpn
"sdk-repo-linux-platform-tools-eng.10.0.0_r14.zip" # Contains tools like adb and fastboot
"sdk-repo-linux-build-tools-eng.10.0.0_r14.zip" # Contains tools like apksigner
)
# Creating necessary folder structure
(
mkdir -p "${AR_SDK_DIR}" "${AR_SDK_DIR}"/platforms "${AR_SDK_DIR}"/build-tools "${AR_SDK_DIR}"/ndk "${AR_SDK_DIR}"/ndk/21.4.0
)
# Downloading and extracting SDK
(
cd "${AR_SDK_DIR}" || exit
for i in "${arr[@]}"
do
echo "Downloading $i"
curl -L -O ${AR_SDK_URL}/$i
echo "Unzipping $i"
unzip -o -q $i -d ${AR_SDK_DIR} | pv -l > /dev/null
rm $i
# Some of these zips need to be either placed in subfolders or have to be
# renamed due to gradle warnings
if [ $i = sdk-repo-linux-tools-26.1.1.zip ]
then
mv tools/ cmdline-tools/
elif [ $i = sdk-repo-linux-build-tools-eng.10.0.0_r14.zip ]
then
mv android-10/ build-tools/29.0.2
elif [ $i = sdk-repo-linux-platforms-eng.10.0.0_r36.zip ]
then
mv android-10/ platforms/android-29
elif [ $i = sdk-repo-linux-platforms-eng.11.0.0_r27.zip ]
then
mv android-11/ platforms/android-30
fi
echo "Content of $i in place"
echo ""
done
)
# Downloading and extracting NDK
(
echo "Downloading ${AR_NDK_FILE}. This might take a while depending on your connection"
curl -L -O ${AR_NDK_URL}/${AR_NDK_FILE}
echo "Extracting ${AR_NDK_FILE}. This might take a while depending on your system."
pv ${AR_NDK_FILE} | tar xj
rm ${AR_NDK_FILE}
cp -rlf android-ndk-r21e/* "${AR_SDK_DIR}"/ndk/21.4.0/
rm -rf android-ndk-r21e/
echo "Content of ${AR_NDK_FILE} in place"
echo ""
)