Add build dependencies for documentation
[ci-management.git] / vagrant / basebuild / bootstrap.sh
index 649a47f..c8cc874 100644 (file)
@@ -1,84 +1,52 @@
+#!/bin/bash
 
-ubuntu_systems() {
-    # Standard update + upgrade dance
-    apt-get update
-    apt-get upgrade -y
+# die on errors
+set -e
 
-    # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
+# pull in bootstrap functions
+. /vagrant/lib/bootstrap-functions.sh
 
-    sudo update-alternatives --install /bin/sh sh /bin/bash 100
+do_setup
 
-    # Install build tools
-    apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper libganglia1-dev libapr1-dev libconfuse-dev dh-systemd
-
-    # Install other stuff
-    apt-get install -y --force-yes bridge-utils vim gdb iproute2
-
-    # Install debian packaging tools
-    apt-get install -y debhelper dkms
-
-    # Install uio
-    apt-get install -y linux-image-extra-`uname -r`
-
-    # Install jdk and maven
-    apt-get install -y openjdk-7-jdk
-    # $$$ comment out for the moment
-    # apt-get install -y --force-yes maven3
+echo "---> Attempting to detect OS"
+# OS selector
+if [ -f /usr/bin/yum ]
+then
+    echo "---> RH type system detected"
+    rh_clean_pkgs
+    rh_update_pkgs
+    rh_install_pkgs
 
-    # Load the uio kernel module
-    modprobe uio_pci_generic
+elif [ -f /usr/bin/apt-get ]
+then
+    echo "---> Debian type system detected"
+    export DEBIAN_FRONTEND=noninteractive
+
+    deb_enable_serial_console
+    deb_aptconf_batchconf
+    deb_sync_minor
+    deb_correct_shell
+    deb_install_pkgs
+    deb_remove_pkgs
+    deb_disable_apt_systemd_daily
+    deb_flush
+    deb_reup_certs
+
+    # It is not necessary to load uio module during bootstrap phase
+    # deb_probe_modules uio_pci_generic
 
     # Make sure uio loads at boot time
-    echo uio_pci_generic >> /etc/modules
+    deb_enable_modules 'uio_pci_generic'
 
-    # Setup for hugepages using upstart so it persists across reboots
-    sysctl -w vm.nr_hugepages=1024
-    mkdir -p /mnt/huge
-    echo "hugetlbfs       /mnt/huge  hugetlbfs       defaults        0 0" >> /etc/fstab
-    mount /mnt/huge
+    deb_enable_hugepages
 
-    # Install virtualenv for test execution
-    apt-get install -y --force-yes python-virtualenv python-pip python-dev
-}
+    # It is not necessary to mount hugepages during bootstrap phase
+    # deb_mount_hugepages
 
-rh_systems() {
-    # Install build tools
-    yum groupinstall 'Development Tools' -y
-    yum install openssl-devel -y
-    yum install glibc-static -y
-
-    # Install jdk and maven
-    yum install -y java-1.8.0-openjdk-devel
-
-    # Install EPEL
-    yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+fi
 
-    # Install components to build Ganglia modules
-    yum install -y apr-devel
-    yum install -y --enablerepo=epel libconfuse-devel
-    yum install -y --enablerepo=epel ganglia-devel
-    yum install -y --enablerepo=epel mock
-}
+do_cleanup
 
-echo "---> Attempting to detect OS"
-# OS selector
-if [ -f /usr/bin/yum ]
-then
-    OS='RH'
-else
-    OS='UBUNTU'
-fi
+echo "bootstrap process (PID=$$) complete."
 
-case "$OS" in
-    RH)
-        echo "---> RH type system detected"
-        rh_systems
-    ;;
-    UBUNTU)
-        echo "---> Ubuntu system detected"
-        ubuntu_systems
-    ;;
-    *)
-        echo "---> Unknown operating system"
-    ;;
-esac
+exit 0