7 if [ -z $ANDROID_HOME ]; then
8 echo "ANDROID_HOME env var must be set!"
12 # TODO remove the rm, this should work with an existing ANDROID_HOME
13 if [ ! -x $ANDROID_HOME/tools/android ]; then
16 mkdir ${ANDROID_HOME}/temp
17 mkdir ${ANDROID_HOME}/platforms
18 mkdir ${ANDROID_HOME}/build-tools
21 tools=`ls -1 /vagrant/cache/tools_*.zip | sort -n | tail -1`
27 # make links for `android update sdk` to use and delete
28 for f in android_*.zip android-[0-9]*.zip platform-[0-9]*.zip build-tools_r*-linux.zip; do
29 rm -f ${ANDROID_HOME}/temp/$f
30 ln -s /vagrant/cache/$f ${ANDROID_HOME}/temp/
33 # install all cached platforms
35 for f in `ls -1 android-[0-9]*.zip platform-[0-9]*.zip`; do
36 sdk=`unzip -c $f "*/build.prop" | sed -n 's,^ro.build.version.sdk=,,p'`
37 cached=,android-${sdk}${cached}
40 # install all cached build-tools
41 for f in `ls -1 build-tools*.zip`; do
42 ver=`unzip -c $f "*/source.properties" | sed -n 's,^Pkg.Revision=,,p'`
43 cached=,build-tools-${ver}${cached}
46 ${ANDROID_HOME}/tools/android update sdk --no-ui --all \
47 --filter platform-tools,extra-android-m2repository${cached} <<EOH
53 chmod -R a+rX $ANDROID_HOME/
54 find $ANDROID_HOME/ -type f -executable -print0 | xargs -0 chmod a+x