File: provision-android-sdk

package info (click to toggle)
fdroidserver 2.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,948 kB
  • sloc: python: 34,139; xml: 2,186; sh: 1,362; java: 293; makefile: 54; javascript: 23
file content (167 lines) | stat: -rw-r--r-- 4,547 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

echo $0
set -e
set -x

if [ -z $ANDROID_HOME ]; then
    echo "ANDROID_HOME env var must be set!"
    exit 1
fi

# disable the repositories of proprietary stuff
disabled="
@version@=1
@disabled@https\://dl.google.com/android/repository/extras/intel/addon.xml=disabled
@disabled@https\://dl.google.com/android/repository/glass/addon.xml=disabled
@disabled@https\://dl.google.com/android/repository/sys-img/android/sys-img.xml=disabled
@disabled@https\://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml=disabled
@disabled@https\://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml=disabled
@disabled@https\://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml=disabled
"
test -d ${HOME}/.android || mkdir ${HOME}/.android
# there are currently zero user repos
echo 'count=0' > ${HOME}/.android/repositories.cfg
for line in $disabled; do
    echo $line >> ${HOME}/.android/sites-settings.cfg
done

# Include old makebuildserver cache that is a Vagrant synced_folder
# for sdkmanager to use.
cachedir=$HOME/.cache/sdkmanager
mkdir -p $cachedir
pushd $cachedir
for f in /vagrant/cache/*.zip; do
    test -e $f && ln -s $f
done
popd

# TODO do not preinstall 'tools' or 'platform-tools' at all, app builds don't need them
packages="
  tools;25.2.5
  platform-tools
  build-tools;19.1.0
  build-tools;20.0.0
  build-tools;21.1.2
  build-tools;22.0.1
  build-tools;23.0.1
  build-tools;23.0.2
  build-tools;23.0.3
  build-tools;24.0.0
  build-tools;24.0.1
  build-tools;24.0.2
  build-tools;24.0.3
  build-tools;25.0.0
  build-tools;25.0.1
  build-tools;25.0.2
  build-tools;25.0.3
  build-tools;26.0.0
  build-tools;26.0.1
  build-tools;26.0.2
  build-tools;26.0.3
  build-tools;27.0.0
  build-tools;27.0.1
  build-tools;27.0.2
  build-tools;27.0.3
  build-tools;28.0.0
  build-tools;28.0.1
  build-tools;28.0.2
  build-tools;28.0.3
  build-tools;29.0.2
  build-tools;29.0.3
  build-tools;30.0.0
  build-tools;30.0.1
  build-tools;30.0.2
  build-tools;30.0.3
  build-tools;31.0.0
  build-tools;32.0.0
  build-tools;33.0.0
  platforms;android-10
  platforms;android-11
  platforms;android-12
  platforms;android-13
  platforms;android-14
  platforms;android-15
  platforms;android-16
  platforms;android-17
  platforms;android-18
  platforms;android-19
  platforms;android-20
  platforms;android-21
  platforms;android-22
  platforms;android-23
  platforms;android-24
  platforms;android-25
  platforms;android-26
  platforms;android-27
  platforms;android-28
  platforms;android-29
  platforms;android-30
  platforms;android-31
  platforms;android-32
  platforms;android-33
"

if [ $# -gt 0 ]; then
    echo found args
    packages=$@
fi

# temporary test of whether this script ran. It will change once
# 'tools' is no longer installed by default.
if [ ! -x $ANDROID_HOME/tools/bin/sdkmanager ]; then
    mkdir -p ${ANDROID_HOME}/
    sdkmanager $packages
fi

# this hacked cache should not end up in the Vagrant box or Docker image
rm -rf $cachedir

mkdir -p $ANDROID_HOME/licenses/

cat << EOF > $ANDROID_HOME/licenses/android-sdk-license

8933bad161af4178b1185d1a37fbf41ea5269c55

d56f5187479451eabf01fb78af6dfcb131a6481e

24333f8a63b6825ea9c5514f83c2829b004d1fee
EOF

cat <<EOF > $ANDROID_HOME/licenses/android-sdk-preview-license

84831b9409646a918e30573bab4c9c91346d8abd
EOF

cat <<EOF > $ANDROID_HOME/licenses/android-sdk-preview-license-old

79120722343a6f314e0719f863036c702b0e6b2a

84831b9409646a918e30573bab4c9c91346d8abd
EOF

cat <<EOF > $ANDROID_HOME/licenses/intel-android-extra-license

d975f751698a77b662f1254ddbeed3901e976f5a
EOF

chmod a+X $(dirname $ANDROID_HOME/)
chmod -R a+rX $ANDROID_HOME/
chgrp vagrant $ANDROID_HOME
chmod g+w $ANDROID_HOME
find $ANDROID_HOME/ -type f -executable -print0 | xargs -0 chmod a+x

# allow gradle to install newer build-tools and platforms
mkdir -p $ANDROID_HOME/{build-tools,platforms}
chgrp vagrant $ANDROID_HOME/{build-tools,platforms}
chmod g+w $ANDROID_HOME/{build-tools,platforms}

# allow gradle/sdkmanager to install into the new m2repository
test -d $ANDROID_HOME/extras/m2repository || mkdir -p $ANDROID_HOME/extras/m2repository
find $ANDROID_HOME/extras/m2repository -type d | xargs chgrp vagrant
find $ANDROID_HOME/extras/m2repository -type d | xargs chmod g+w

# allow gradle/sdkmanager to install extras;android;m2repository
test -d $ANDROID_HOME/extras/android || mkdir -p $ANDROID_HOME/extras/android
find $ANDROID_HOME/extras/android -type d | xargs chgrp vagrant
find $ANDROID_HOME/extras/android -type d | xargs chmod g+w