#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 \
    --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
RELEASE=$(lsb_release -ics | tail -1 | tr '[:upper:]' '[:lower:]')

# Add the repository
echo "deb http://apt.dockerproject.org/repo ${DISTRO}-${RELEASE} main" | \
    sudo tee /etc/apt/sources.list.d/docker.list
