blob: aba8b19cefe9b09a07c4e493e492cb1d102f2d20 [file] [log] [blame]
Andrew Grimbergebc710a2017-01-30 12:59:38 -08001#!/bin/bash
2
3# vim: ts=4 sw=4 sts=4 et tw=72 :
4
Andrew Grimberg8ffb2132017-02-07 10:48:06 -08005# force any errors to cause the script and job to end in failure
Andrew Grimberg7fb50b32017-02-07 10:54:58 -08006set -xeu -o pipefail
Andrew Grimberg8ffb2132017-02-07 10:48:06 -08007
Andrew Grimbergebc710a2017-01-30 12:59:38 -08008rh_systems() {
9 # Install python dependencies
10 yum install -y python-{devel,virtualenv,setuptools,pip}
11
12 # Build dependencies for Python packages
13 yum install -y openssl-devel mysql-devel gcc
14
15 # Autorelease support packages
Jessica Wagantalle0e2e962017-10-25 11:48:58 -070016 yum install -y firefox python-tox xmlstarlet xvfb crudini maven
Andrew Grimbergebc710a2017-01-30 12:59:38 -080017
Gary Wu886ba642017-09-22 12:47:44 -070018 # Install chrome to support ChromeDriver
Jessica Wagantall1e3748f2017-11-01 18:01:10 -070019 cat << EOF > /etc/yum.repos.d/google-chrome.repo
Gary Wu886ba642017-09-22 12:47:44 -070020[google-chrome]
Jessica Wagantall1e3748f2017-11-01 18:01:10 -070021name=google-chrome - \$basearch
22baseurl=http://dl.google.com/linux/chrome/rpm/stable/\$basearch
Gary Wu886ba642017-09-22 12:47:44 -070023enabled=1
24gpgcheck=1
25gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
26EOF
27
28 yum -y update
29 yum -y install google-chrome-stable
30
Andrew Grimbergebc710a2017-01-30 12:59:38 -080031 # Additional libraries for Python ncclient
32 yum install -y libxml2 libxslt libxslt-devel libffi libffi-devel
33
34 # Packer builds happen from the centos flavor images
35 PACKERDIR=$(mktemp -d)
36 # disable double quote checking
37 # shellcheck disable=SC2086
38 cd $PACKERDIR
39 wget https://releases.hashicorp.com/packer/0.12.2/packer_0.12.2_linux_amd64.zip
40 unzip packer_0.12.2_linux_amd64.zip -d /usr/local/bin/
41 # rename packer to avoid conflicts with cracklib
42 mv /usr/local/bin/packer /usr/local/bin/packer.io
43
44 # cleanup from the installation
45 # disable double quote checking
46 # shellcheck disable=SC2086
47 rm -rf $PACKERDIR
48 # cleanup from previous install process
49 if [ -d /tmp/packer ]
50 then
51 rm -rf /tmp/packer
52 fi
53}
54
55ubuntu_systems() {
Jessica Wagantall5763e7c2017-10-13 16:15:28 -070056 # Install python3.6
57 sudo add-apt-repository -y ppa:jonathonf/python-3.6
58 sudo apt-get update
Jessica Wagantall62260462017-10-19 08:51:03 -070059 sudo apt-get install -y python3.6 python3.6-dev
Jessica Wagantall5763e7c2017-10-13 16:15:28 -070060
Andrew Grimbergebc710a2017-01-30 12:59:38 -080061 # Install python dependencies
62 apt-get install -y python-{dev,virtualenv,setuptools,pip}
63
64 # Build dependencies for Python packages
65 apt-get install -y libssl-dev libmysqlclient-dev gcc
66
Gary Wu7cce7fe2017-07-19 12:39:01 -070067 # Autorelease support packages
Jessica Wagantalle0e2e962017-10-25 11:48:58 -070068 apt-get install -y firefox python-tox xmlstarlet xvfb crudini maven
Gary Wu7cce7fe2017-07-19 12:39:01 -070069
Gary Wu886ba642017-09-22 12:47:44 -070070 # Install chrome to support ChromeDriver
71 wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
72 echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
73 apt-get update -y
74 apt-get install -y google-chrome-stable
75
Andrew Grimbergebc710a2017-01-30 12:59:38 -080076 # Additional libraries for Python ncclient
77 apt-get install -y wget unzip python-ncclient
Anaƫl Closson5a40fe42017-03-14 17:05:37 +010078
79 # Add graphviz for documentation building
80 apt-get install -y graphviz
81
Jessica Wagantall53791792017-08-30 14:12:02 -070082 # Erlang and Rebar packages needed for DCAEGEN2
83 apt-get install -y libwxgtk3.0-0v5 libsctp1
84 wget https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_19.3.6-1~ubuntu~trusty_amd64.deb
85 dpkg -i esl-erlang_19.3.6-1~ubuntu~trusty_amd64.deb
86 apt-get install -y libwxbase3.0-0v5
87 apt-get -f install -y
88 git clone https://github.com/erlang/rebar3.git
89 cd rebar3
90 ./bootstrap
91 mv rebar3 /usr/bin/rebar3
92 cd ..
Andrew Grimbergebc710a2017-01-30 12:59:38 -080093}
94
95all_systems() {
96 echo 'No common distribution configuration to perform'
97}
98
99echo "---> Detecting OS"
100ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
101
102case "${ORIGIN}" in
103 fedora|centos|redhat)
104 echo "---> RH type system detected"
105 rh_systems
106 ;;
107 ubuntu)
108 echo "---> Ubuntu system detected"
109 ubuntu_systems
110 ;;
111 *)
112 echo "---> Unknown operating system"
113 ;;
114esac
115
116# execute steps for all systems
117all_systems