summaryrefslogtreecommitdiffstats
path: root/packer/provision/basebuild.sh
diff options
context:
space:
mode:
authorAndrew Grimberg <agrimberg@linuxfoundation.org>2017-01-30 12:59:38 -0800
committerAndrew Grimberg <agrimberg@linuxfoundation.org>2017-01-30 13:20:32 -0800
commitebc710af742601214491c5b2b9a4f6847d235d6c (patch)
tree49e8acc7c5b170d186ac65d88debe94a4d935b16 /packer/provision/basebuild.sh
parentdcd560890f549f999e0ebe437dcc180bbc628d0b (diff)
Initial ci-management upload
* Configure initial jobs and validate Jenkins environment * Do not hook up packer build jobs at this time Change-Id: I1818e8680d215318410f6beff5af054db03e7fa1 Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
Diffstat (limited to 'packer/provision/basebuild.sh')
-rw-r--r--packer/provision/basebuild.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/packer/provision/basebuild.sh b/packer/provision/basebuild.sh
new file mode 100644
index 000000000..68ba71cc6
--- /dev/null
+++ b/packer/provision/basebuild.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# vim: ts=4 sw=4 sts=4 et tw=72 :
+
+rh_systems() {
+ # Install python dependencies
+ yum install -y python-{devel,virtualenv,setuptools,pip}
+
+ # Build dependencies for Python packages
+ yum install -y openssl-devel mysql-devel gcc
+
+ # Autorelease support packages
+ yum install -y xmlstarlet
+
+ # Additional libraries for Python ncclient
+ yum install -y libxml2 libxslt libxslt-devel libffi libffi-devel
+
+ # Packer builds happen from the centos flavor images
+ PACKERDIR=$(mktemp -d)
+ # disable double quote checking
+ # shellcheck disable=SC2086
+ cd $PACKERDIR
+ wget https://releases.hashicorp.com/packer/0.12.2/packer_0.12.2_linux_amd64.zip
+ unzip packer_0.12.2_linux_amd64.zip -d /usr/local/bin/
+ # rename packer to avoid conflicts with cracklib
+ mv /usr/local/bin/packer /usr/local/bin/packer.io
+
+ # cleanup from the installation
+ # disable double quote checking
+ # shellcheck disable=SC2086
+ rm -rf $PACKERDIR
+ # cleanup from previous install process
+ if [ -d /tmp/packer ]
+ then
+ rm -rf /tmp/packer
+ fi
+}
+
+ubuntu_systems() {
+ # Install python dependencies
+ apt-get install -y python-{dev,virtualenv,setuptools,pip}
+
+ # Build dependencies for Python packages
+ apt-get install -y libssl-dev libmysqlclient-dev gcc
+
+ # Additional libraries for Python ncclient
+ apt-get install -y wget unzip python-ncclient
+}
+
+all_systems() {
+ echo 'No common distribution configuration to perform'
+}
+
+echo "---> Detecting OS"
+ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
+
+case "${ORIGIN}" in
+ fedora|centos|redhat)
+ echo "---> RH type system detected"
+ rh_systems
+ ;;
+ ubuntu)
+ echo "---> Ubuntu system detected"
+ ubuntu_systems
+ ;;
+ *)
+ echo "---> Unknown operating system"
+ ;;
+esac
+
+# execute steps for all systems
+all_systems