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 |
| 16 | yum install -y xmlstarlet |
| 17 | |
| 18 | # Additional libraries for Python ncclient |
| 19 | yum install -y libxml2 libxslt libxslt-devel libffi libffi-devel |
| 20 | |
| 21 | # Packer builds happen from the centos flavor images |
| 22 | PACKERDIR=$(mktemp -d) |
| 23 | # disable double quote checking |
| 24 | # shellcheck disable=SC2086 |
| 25 | cd $PACKERDIR |
| 26 | wget https://releases.hashicorp.com/packer/0.12.2/packer_0.12.2_linux_amd64.zip |
| 27 | unzip packer_0.12.2_linux_amd64.zip -d /usr/local/bin/ |
| 28 | # rename packer to avoid conflicts with cracklib |
| 29 | mv /usr/local/bin/packer /usr/local/bin/packer.io |
| 30 | |
| 31 | # cleanup from the installation |
| 32 | # disable double quote checking |
| 33 | # shellcheck disable=SC2086 |
| 34 | rm -rf $PACKERDIR |
| 35 | # cleanup from previous install process |
| 36 | if [ -d /tmp/packer ] |
| 37 | then |
| 38 | rm -rf /tmp/packer |
| 39 | fi |
| 40 | } |
| 41 | |
| 42 | ubuntu_systems() { |
| 43 | # Install python dependencies |
| 44 | apt-get install -y python-{dev,virtualenv,setuptools,pip} |
| 45 | |
| 46 | # Build dependencies for Python packages |
| 47 | apt-get install -y libssl-dev libmysqlclient-dev gcc |
| 48 | |
| 49 | # Additional libraries for Python ncclient |
| 50 | apt-get install -y wget unzip python-ncclient |
Anaƫl Closson | 5a40fe4 | 2017-03-14 17:05:37 +0100 | [diff] [blame] | 51 | |
| 52 | # Add graphviz for documentation building |
| 53 | apt-get install -y graphviz |
| 54 | |
Andrew Grimberg | ebc710a | 2017-01-30 12:59:38 -0800 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | all_systems() { |
| 58 | echo 'No common distribution configuration to perform' |
| 59 | } |
| 60 | |
| 61 | echo "---> Detecting OS" |
| 62 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 63 | |
| 64 | case "${ORIGIN}" in |
| 65 | fedora|centos|redhat) |
| 66 | echo "---> RH type system detected" |
| 67 | rh_systems |
| 68 | ;; |
| 69 | ubuntu) |
| 70 | echo "---> Ubuntu system detected" |
| 71 | ubuntu_systems |
| 72 | ;; |
| 73 | *) |
| 74 | echo "---> Unknown operating system" |
| 75 | ;; |
| 76 | esac |
| 77 | |
| 78 | # execute steps for all systems |
| 79 | all_systems |