In setting up the custom Linux images for Thali builds, I created a script that would install of all Thali's pre-requisites.

The main things to figure out were:

  • auto-accepting the Java and Android SDK licenses
  • setting the correct environment variables
# Java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo apt-get install oracle-java8-installer -y
sudo apt-get install oracle-java8-set-default -y
# Android
cd /usr/local/lib
tar xvfz android-sdk_r23.0.2-linux.tgz
# Auto-Accept License. Installing Android SDK 19.
(while [ 1 ]; do sleep 5; echo y; done) | android-sdk-linux/tools/android update sdk -u -a -t 1,2,5,7,8,16,36,55,56,70,71,92,98,99
echo export ANDROID_HOME=`pwd`/android-sdk-linux > ~/.bashrc

The script in its entirety is available as a Github Gist.