Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # vim: ts=4 sw=4 sts=4 et tw=72 : |
| 4 | |
Andrew Grimberg | 8ffb213 | 2017-02-07 10:48:06 -0800 | [diff] [blame] | 5 | # force any errors to cause the script and job to end in failure |
Andrew Grimberg | 7fb50b3 | 2017-02-07 10:54:58 -0800 | [diff] [blame] | 6 | set -xeu -o pipefail |
Andrew Grimberg | 8ffb213 | 2017-02-07 10:48:06 -0800 | [diff] [blame] | 7 | |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 8 | rh_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 Wagantall | e0e2e96 | 2017-10-25 11:48:58 -0700 | [diff] [blame] | 16 | yum install -y firefox python-tox xmlstarlet xvfb crudini maven |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 17 | |
Gary Wu | 886ba64 | 2017-09-22 12:47:44 -0700 | [diff] [blame] | 18 | # Install chrome to support ChromeDriver |
Jessica Wagantall | 1e3748f | 2017-11-01 18:01:10 -0700 | [diff] [blame] | 19 | cat << EOF > /etc/yum.repos.d/google-chrome.repo |
Gary Wu | 886ba64 | 2017-09-22 12:47:44 -0700 | [diff] [blame] | 20 | [google-chrome] |
Jessica Wagantall | 1e3748f | 2017-11-01 18:01:10 -0700 | [diff] [blame] | 21 | name=google-chrome - \$basearch |
| 22 | baseurl=http://dl.google.com/linux/chrome/rpm/stable/\$basearch |
Gary Wu | 886ba64 | 2017-09-22 12:47:44 -0700 | [diff] [blame] | 23 | enabled=1 |
| 24 | gpgcheck=1 |
| 25 | gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub |
| 26 | EOF |
| 27 | |
| 28 | yum -y update |
| 29 | yum -y install google-chrome-stable |
| 30 | |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 31 | # 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 | |
| 55 | ubuntu_systems() { |
Jessica Wagantall | 5763e7c | 2017-10-13 16:15:28 -0700 | [diff] [blame] | 56 | # Install python3.6 |
| 57 | sudo add-apt-repository -y ppa:jonathonf/python-3.6 |
| 58 | sudo apt-get update |
Jessica Wagantall | 6226046 | 2017-10-19 08:51:03 -0700 | [diff] [blame] | 59 | sudo apt-get install -y python3.6 python3.6-dev |
Jessica Wagantall | 5763e7c | 2017-10-13 16:15:28 -0700 | [diff] [blame] | 60 | |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 61 | # 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 Wu | 7cce7fe | 2017-07-19 12:39:01 -0700 | [diff] [blame] | 67 | # Autorelease support packages |
Jessica Wagantall | e0e2e96 | 2017-10-25 11:48:58 -0700 | [diff] [blame] | 68 | apt-get install -y firefox python-tox xmlstarlet xvfb crudini maven |
Gary Wu | 7cce7fe | 2017-07-19 12:39:01 -0700 | [diff] [blame] | 69 | |
Gary Wu | 886ba64 | 2017-09-22 12:47:44 -0700 | [diff] [blame] | 70 | # 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 Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 76 | # Additional libraries for Python ncclient |
| 77 | apt-get install -y wget unzip python-ncclient |
Anaƫl Closson | 5a40fe4 | 2017-03-14 17:05:37 +0100 | [diff] [blame] | 78 | |
| 79 | # Add graphviz for documentation building |
| 80 | apt-get install -y graphviz |
| 81 | |
Jessica Wagantall | 5379179 | 2017-08-30 14:12:02 -0700 | [diff] [blame] | 82 | # 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 Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | all_systems() { |
| 96 | echo 'No common distribution configuration to perform' |
| 97 | } |
| 98 | |
| 99 | echo "---> Detecting OS" |
| 100 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 101 | |
| 102 | case "${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 | ;; |
| 114 | esac |
| 115 | |
| 116 | # execute steps for all systems |
| 117 | all_systems |