1#!/usr/bin/env bash 2 3# Script to install the depenencies for LISA on an Ubuntu-like system. 4 5# This is intended to be used for setting up containers and virtual machines to 6# run LISA (e.g. for CI infrastructure or for Vagrant installation). However for 7# the brave, it could be used to set up LISA directly on a real machine. 8 9SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 10 11usage() { 12 echo Usage: "$0" [--install-android-sdk] 13} 14 15set -eu 16 17install_android_sdk=n 18 19for arg in "$@"; do 20 if [ "$arg" == "--install-android-sdk" ]; then 21 install_android_sdk=y 22 else 23 echo "Unrecognised argument: $arg" 24 usage 25 exit 1 26 fi 27done 28 29apt-get update 30 31apt-get -y remove ipython ipython-notebook 32 33apt-get -y install build-essential autoconf automake libtool pkg-config \ 34 trace-cmd sshpass kernelshark nmap net-tools tree python-matplotlib \ 35 python-numpy libfreetype6-dev libpng12-dev python-nose python-pip \ 36 python-dev iputils-ping git wget expect 37 38# Upgrade pip so we can use wheel packages instead of compiling stuff, this is 39# much faster. 40pip install --upgrade pip 41 42# Incantation to fix broken pip packages 43/usr/local/bin/pip install --upgrade packaging appdirs 44 45# Use IPython 5.x because 6.0+ only supports Python 3.3 46/usr/local/bin/pip install --upgrade "ipython<6.0.0" Cython trappy bart-py devlib psutil wrapt jupyter 47 48if [ "$install_android_sdk" == y ]; then 49 apt-get -y install openjdk-7-jre openjdk-7-jdk 50 ANDROID_SDK_URL="https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz" 51 mkdir -p "$SCRIPT_DIR"/tools 52 if [ ! -e "$SCRIPT_DIR"/tools/android-sdk-linux ]; then 53 echo "Downloading Android SDK [$ANDROID_SDK_URL]..." 54 wget -qO- $ANDROID_SDK_URL | tar xz -C $SCRIPT_DIR/tools/ 55 expect -c " 56 set timeout -1; 57 spawn $SCRIPT_DIR/tools/android-sdk-linux/tools/android update sdk --no-ui 58 expect { 59 \"Do you accept the license\" { exp_send \"y\r\" ; exp_continue } 60 eof 61 } 62 " 63 fi 64fi 65