#!/bin/bash
set -eux

install-packages git build-essential python-dev libssl-dev python-netaddr

install -m 0755 -o root -g root -d /opt/stack/boot-stack

# tools
for f in `ls $(dirname $0)/../bin`; do
  install -m 0755 -o root -g root $(dirname $0)/../bin/$f /usr/local/bin/$f
done

# db
install-packages python-mysqldb

function deps {
  if hash apt-get &> /dev/null; then
    apt-get update
  fi
  install-packages screen ccze
  install-packages git ipmitool python-dev python-greenlet libxml2-dev libxslt-dev
  install-packages openvswitch-common openvswitch-controller openvswitch-switch open-iscsi
  install-packages python-numpy python-lxml
}

function ip_forwarding {
  cat > /etc/sysctl.conf <<eof
net.ipv4.ip_forward=1
eof
}

deps
ip_forwarding
