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