#!/bin/bash

set -e
set -x

if [[ "$(id -u)" != "0" ]]; then
  echo "Script must be run as root"
  exit 0
fi

cd ~

VER=4.2.0-040200rc6
REL=201508092028
PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.2-rc6-unstable
wget ${PREFIX}/linux-headers-${VER}-generic_${VER}.${REL}_amd64.deb
wget ${PREFIX}/linux-headers-${VER}_${VER}.${REL}_all.deb
wget ${PREFIX}/linux-image-${VER}-generic_${VER}.${REL}_amd64.deb
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
dpkg -i linux-*${VER}.${REL}*.deb
rm -f linux-*${VER}.${REL}*.deb

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D4284CDD
echo "deb http://52.8.15.63/apt trusty main" > /etc/apt/sources.list.d/iovisor.list
apt-get update
apt-get -y install libbcc
apt-get -y install python-pip
pip install pyroute2

reboot
