#!/bin/bash

ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source $ABSOLUTE_PATH/../inc/vars.sh
source $ABSOLUTE_PATH/../inc/functions.sh


######################################################################
## Installation of docker-machine                                   ##
######################################################################

if [ `uname -r | grep -E '3.2|3.3|3.4|3.5|3.6|3.7|3.8|3.9|3.10' | wc -l` -gt 0 ]; then
    notice "Linux kernel must be updated!" "warning";
	notice "Kernel version greater than 3.10 needed, your version is: `uname -r`" "warning";

    if `ask "Cancel installation?"`
	then
		exit 1;
	fi
fi

if [ `which docker | wc -l` -eq 0 ]; then
	apt-get -y install curl
	curl -sSL https://get.docker.com/gpg | sudo apt-key add -
	curl -sSL https://get.docker.com/ | sh
	if [ $? -ne 0 ]; then
		error "Docker install failed"
		exit 1
	fi
fi 