2016-06-14 16:34:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-07-04 14:20:42 +02:00
|
|
|
echo $0
|
2016-06-14 16:34:13 +02:00
|
|
|
set -e
|
2016-06-22 08:06:07 +02:00
|
|
|
set -x
|
2016-06-14 16:34:13 +02:00
|
|
|
|
|
|
|
if [ -z $ANDROID_HOME ]; then
|
|
|
|
echo "ANDROID_HOME env var must be set!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-09-15 11:29:31 +02:00
|
|
|
# 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
|
2017-03-16 11:43:46 +01:00
|
|
|
# there are currently zero user repos
|
|
|
|
echo 'count=0' > ${HOME}/.android/repositories.cfg
|
2016-09-15 11:29:31 +02:00
|
|
|
for line in $disabled; do
|
|
|
|
echo $line >> ${HOME}/.android/sites-settings.cfg
|
|
|
|
done
|
|
|
|
|
2022-04-22 10:28:25 +02:00
|
|
|
# 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
|
2016-06-14 16:34:13 +02:00
|
|
|
done
|
2022-04-22 10:28:25 +02:00
|
|
|
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
|
2022-10-12 20:14:27 +02:00
|
|
|
build-tools;32.0.0
|
|
|
|
build-tools;33.0.0
|
2022-04-22 10:28:25 +02:00
|
|
|
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
|
2022-10-12 20:14:27 +02:00
|
|
|
platforms;android-32
|
|
|
|
platforms;android-33
|
2022-04-22 10:28:25 +02:00
|
|
|
"
|
2016-06-14 16:34:13 +02:00
|
|
|
|
2022-04-22 10:28:25 +02:00
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
echo found args
|
|
|
|
packages=$@
|
|
|
|
fi
|
2016-06-14 16:34:13 +02:00
|
|
|
|
2022-04-22 10:28:25 +02:00
|
|
|
# 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
|
2016-06-14 16:34:13 +02:00
|
|
|
|
2022-04-22 10:28:25 +02:00
|
|
|
# this hacked cache should not end up in the Vagrant box or Docker image
|
|
|
|
rm -rf $cachedir
|
2016-06-14 16:34:13 +02:00
|
|
|
|
2017-03-13 16:31:27 +01:00
|
|
|
mkdir -p $ANDROID_HOME/licenses/
|
2017-11-24 09:21:28 +01:00
|
|
|
|
2017-11-14 10:38:48 +01:00
|
|
|
cat << EOF > $ANDROID_HOME/licenses/android-sdk-license
|
|
|
|
|
|
|
|
8933bad161af4178b1185d1a37fbf41ea5269c55
|
2017-11-24 09:21:28 +01:00
|
|
|
|
2017-11-14 10:38:48 +01:00
|
|
|
d56f5187479451eabf01fb78af6dfcb131a6481e
|
2019-03-30 22:10:21 +01:00
|
|
|
|
|
|
|
24333f8a63b6825ea9c5514f83c2829b004d1fee
|
2017-11-14 10:38:48 +01:00
|
|
|
EOF
|
2017-11-24 09:21:28 +01:00
|
|
|
|
|
|
|
cat <<EOF > $ANDROID_HOME/licenses/android-sdk-preview-license
|
|
|
|
|
|
|
|
84831b9409646a918e30573bab4c9c91346d8abd
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<EOF > $ANDROID_HOME/licenses/android-sdk-preview-license-old
|
2019-03-30 22:10:21 +01:00
|
|
|
|
2017-11-24 09:21:28 +01:00
|
|
|
79120722343a6f314e0719f863036c702b0e6b2a
|
|
|
|
|
|
|
|
84831b9409646a918e30573bab4c9c91346d8abd
|
|
|
|
EOF
|
|
|
|
|
2021-11-29 12:15:46 +01:00
|
|
|
cat <<EOF > $ANDROID_HOME/licenses/intel-android-extra-license
|
|
|
|
|
|
|
|
d975f751698a77b662f1254ddbeed3901e976f5a
|
|
|
|
EOF
|
|
|
|
|
2021-05-28 09:02:19 +02:00
|
|
|
chmod a+X $(dirname $ANDROID_HOME/)
|
2016-06-14 16:34:13 +02:00
|
|
|
chmod -R a+rX $ANDROID_HOME/
|
2017-03-22 10:59:44 +01:00
|
|
|
chgrp vagrant $ANDROID_HOME
|
|
|
|
chmod g+w $ANDROID_HOME
|
2016-06-14 16:34:13 +02:00
|
|
|
find $ANDROID_HOME/ -type f -executable -print0 | xargs -0 chmod a+x
|
2017-03-14 12:39:03 +01:00
|
|
|
|
2017-11-14 10:29:21 +01:00
|
|
|
# allow gradle to install newer build-tools and platforms
|
2022-04-22 10:28:25 +02:00
|
|
|
mkdir -p $ANDROID_HOME/{build-tools,platforms}
|
2017-11-14 10:29:21 +01:00
|
|
|
chgrp vagrant $ANDROID_HOME/{build-tools,platforms}
|
|
|
|
chmod g+w $ANDROID_HOME/{build-tools,platforms}
|
2017-03-16 11:43:46 +01:00
|
|
|
|
|
|
|
# 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
|
2023-10-11 14:16:02 +02:00
|
|
|
|
|
|
|
# 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
|