Skip to content

Instantly share code, notes, and snippets.

@tahl
Created June 20, 2011 11:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tahl/1035468 to your computer and use it in GitHub Desktop.
Save tahl/1035468 to your computer and use it in GitHub Desktop.
Android SDK + NDK Installer
#!/bin/bash
#
#Installer for Android SDK and NDK
#Twitter: @ArchDukeDoug
i=$(cat /proc/$PPID/cmdline)
if [[ $UID != 0 ]]; then
echo "Please type sudo $0 $*to use this."
exit 1
fi
#Download and install the Android SDK
if [ ! -d "/usr/local/android-sdk" ]; then
for a in $( wget -qO- http://developer.android.com/sdk/index.html | egrep -o "http://dl.google.com[^\"']*linux_x86.tgz" ); do
wget $a && tar --wildcards --no-anchored -xvzf android-sdk_*-linux_x86.tgz; mv android-sdk-linux_x86 /usr/local/android-sdk; chmod 777 -R /usr/local/android-sdk; rm android-sdk_*-linux_x86.tgz;
done
else
echo "Android SDK already installed to /usr/local/android-sdk. Skipping."
fi
#Download and install the Android NDK
if [ ! -d "/usr/local/android-ndk" ]; then
for b in $( wget -qO- http://developer.android.com/sdk/ndk/index.html | egrep -o "http://dl.google.com[^\"']*linux-x86.tar.bz2"
); do wget $b && tar --wildcards --no-anchored -xjvf android-ndk-*-linux-x86.tar.bz2; mv android-ndk-*/ /usr/local/android-ndk; chmod 777 -R /usr/local/android-ndk; rm android-ndk-*-linux-x86.tar.bz2;
done
else
echo "Android NDK already installed to /usr/local/android-ndk. Skipping."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment