forked from dynodroid/dynodroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·81 lines (62 loc) · 1.95 KB
/
build.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
#!/usr/bin/env bash
if [ $# -eq 0 ] || [ $# -gt 3 ]; then
echo "Usage: ${0} <ANDROID_HOME> <SHOWEMU> [TOOLDIRNAME]"
exit 1
fi
ANDROID_HOME=$1
if [[ ! -e ${ANDROID_HOME} ]]; then
echo "This ANDROID_HOME: ${ANDROID_HOME} - Doesn't exist."
echo "Run again with a correct folder."
exit 1
fi
SHOWEMU=$2
TOOLDIRNAME=${3:-deploy}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TOOLDIR=${DIR}/${TOOLDIRNAME}/
echo "-- PREPARING ${TOOL}"
echo -n " * Downloading sdcard.img"
# Thanks to https://stackoverflow.com/a/38937732/8091456
ggID='1mf4kKCNgz059C5hzRKOT5Wk_e9WccmFk'
ggURL='https://drive.google.com/uc?export=download'
filename="$(curl -sc /tmp/gcokie "${ggURL}&id=${ggID}" | grep -o '="uc-name.*</span>' | sed 's/.*">//;s/<.a> .*//')"
echo ${filename}
getcode="$(awk '/_warning_/ {print $NF}' /tmp/gcokie)"
URL="${ggURL}&confirm=${getcode}&id=${ggID}"
curl -Lb /tmp/gcokie ${URL} -o ${filename}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"
echo -n " * "
CMD="mv ${filename} ${DIR}/dynodroidsetup/freshavd/emu.avd/"
echo -n "${CMD}: "
eval ${CMD}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"
echo "-- BUILDING ${TOOL}"
echo -n " * "
CMD="export SDK_INSTALL=${ANDROID_HOME}"
echo -n "${CMD}: "
eval ${CMD}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"
cd ${DIR}
echo -n " * cleaning ${TOOLDIR}"
rm -rf ${TOOLDIR}
mkdir -p ${TOOLDIR}
echo -n " * building... "
CMD="python dynodroidsetup.py ${DIR} ${TOOLDIR} ${SHOWEMU}"
echo -n "${CMD}: "
eval ${CMD}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"
cd ${TOOLDIR}
echo -n " * "
CMD="ant -diagnostics"
echo -n "${CMD}: "
eval ${CMD}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"
echo -n " * "
CMD="ant -verbose -debug clean"
echo -n "${CMD}: "
eval ${CMD}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"
echo -n " * "
CMD="ant -verbose -debug compile"
echo -n "${CMD}: "
eval ${CMD}
[[ $? -ne 0 ]] && echo "ERROR" && exit 1 || echo "OK"