Skip to content

Commit

Permalink
Merge "[CE-49] Adapt setup script to multiple linux distros"
Browse files Browse the repository at this point in the history
  • Loading branch information
hightall authored and Gerrit Code Review committed May 31, 2017
2 parents 4b85887 + 208c470 commit 0d6bb37
Showing 1 changed file with 62 additions and 3 deletions.
65 changes: 62 additions & 3 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,72 @@
# It should be triggered at the upper directory, and safe to repeat.

source scripts/header.sh
# collect ID from /etc/os-release as distribution name
# tested on debian,ubuntu,mint , centos,fedora ,opensuse
function get_distribution {
distribution="Unknown"
while read -r line
do
element=$(echo $line | cut -f1 -d=)
if [ "$element" = "ID" ]
then
distribution=$(echo $line | cut -f2 -d=)
fi
done < "/etc/os-release"
echo "${distribution//\"}"
}

USER=`whoami`

DISTRO=$(get_distribution)
DB_DIR=/opt/${PROJECT}/mongo

sudo apt-get update && sudo apt-get install -y -m curl docker-engine python-pip

case $DISTRO in
ubuntu)
sudo apt-get update && sudo apt-get install -y curl docker-engine python-pip
;;
linuxmint)
sudo apt-get install apt-transport-https ca-certificates -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main >> /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install python-pip
sudo apt-get install linux-image-extra-$(uname -r) -y
sudo apt-get install docker-engine cgroup-lite apparmor -y
sudo service docker start
;;
debian)
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-cache policy docker-engine
sudo apt-get install docker-engine curl python-pip -y
sudo service docker start
;;
centos)
sudo yum install -y epel-release yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum update && sudo yum install -y docker-ce python-pip
sudo systemctl enable docker
sudo systemctl start docker
;;
fedora)
sudo dnf -y update
sudo dnf -y install docker python-pip --allowerasing
sudo systemctl enable docker
sudo systemctl start docker
;;
opensuse)
sudo zypper refresh
sudo zypper install docker docker-compose python-pip
sudo systemctl restart docker
;;
*)
echo "Linux distribution not identified !!! skipping docker & pip installation"
;;
esac
sudo pip install --upgrade pip

sudo pip install --upgrade tox
Expand Down

0 comments on commit 0d6bb37

Please sign in to comment.