#!/bin/bash

bail() {
  echo "Error executing command, exiting"
  exit 1
}

exec_cmd_nobail() {
  echo "+ $1"
  bash -c "$1"
}

exec_cmd() {
  exec_cmd_nobail "$1" || bail
}

exec_cmd "sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D"
exec_cmd "sudo rm -f /etc/apt/sources.list.d/docker.list"
exec_cmd "sudo sh -c \"echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list\""
exec_cmd "sudo apt-get update"
