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