summaryrefslogtreecommitdiffstats
path: root/vagrant/basebuild
diff options
context:
space:
mode:
authorC.J. Adams-Collier <cjac@colliertech.org>2016-05-03 18:46:44 -0700
committerC.J. Collier <cjcollier@linuxfoundation.org>2016-05-05 08:30:26 -0700
commita17378d2b7e38330703b1fa8b82a1fba598a6b05 (patch)
tree5e04f6393f9047e8fed9c449e2d0d776beb4260d /vagrant/basebuild
parent5c19b29bcccc4df02bedf9d4e92f3e286847d2e6 (diff)
Re-factor vagrant bootstrap
* created new file to hold functions * moved sections of bootstrap in to functions * called functions from case statement block * integrate changes from Andrew Grimberg <agrimberg@linuxfoundation.org> (change 994) * integrate changes from Ed Warnicke <eaw@cisco.com> (change 996) * update debian package list after installing PPA * synchronized redhat package list with VPP Makefile Change-Id: I3d005c0fe01211c78c8b120b266964d873ee25b7 Signed-off-by: C.J. Adams-Collier <cjac@colliertech.org>
Diffstat (limited to 'vagrant/basebuild')
-rw-r--r--vagrant/basebuild/Vagrantfile2
-rw-r--r--vagrant/basebuild/bootstrap.sh196
2 files changed, 27 insertions, 171 deletions
diff --git a/vagrant/basebuild/Vagrantfile b/vagrant/basebuild/Vagrantfile
index 37ce73f12..ccca7c239 100644
--- a/vagrant/basebuild/Vagrantfile
+++ b/vagrant/basebuild/Vagrantfile
@@ -38,7 +38,7 @@ Vagrant.configure(2) do |config|
config.vm.synced_folder "../lib/", "/vagrant/lib"
# Do a full system update and set enforcing on
- config.vm.provision 'shell', path: 'bootstrap.sh'
+ config.vm.provision 'shell', path: './bootstrap.sh'
#################
# FINAL CLEANUP #
diff --git a/vagrant/basebuild/bootstrap.sh b/vagrant/basebuild/bootstrap.sh
index 42f68f085..016be616e 100644
--- a/vagrant/basebuild/bootstrap.sh
+++ b/vagrant/basebuild/bootstrap.sh
@@ -1,189 +1,45 @@
-#!/bin/bash -x
+#!/bin/bash
# die on errors
set -e
-# Redirect stdout ( 1> ) and stderr ( 2> ) into named pipes ( >() ) running "tee"
-#exec 1> >(tee -i /tmp/bootstrap-out.log)
-#exec 2> >(tee -i /tmp/bootstrap-err.log)
+# pull in bootstrap functions
+. /vagrant/lib/bootstrap-functions.sh
-ubuntu_systems() {
-
- PACKAGES="" # initialize PACKAGES
-
- if [ $? == 0 ]
- then
- VERSION=$(lsb_release -r | awk '{print $2}')
- DIST=$(lsb_release -i | awk '{print $3}')
- CODENAME=$(lsb_release -c | awk '{print $2}')
- else
- ISSUE_TXT=$(head -1 /etc/issue)
- DIST=$(echo "${ISSUE_TXT}" | awk '{print $1}')
- if [ "$DIST" = "Ubuntu" ]
- then
- VERSION=$(echo "${ISSUE_TXT}" | awk '{print $2}' | sed -e 's/^(\d+\.\d+)(\.\d+)?$/\1/')
- elif [ "$DIST" = "Debian" ]
- then
- VERSION=$(echo "${ISSUE_TXT}" | awk '{print $3}')
- else
- echo "Unrecognized distribution: ${DIST}"
- fi
- fi
-
- echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
+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
+elif [ -f /usr/bin/apt-get ]
+then
+ echo "---> Debian type system detected"
export DEBIAN_FRONTEND=noninteractive
- cat <<EOF >> /etc/apt/apt.conf
-APT {
- Get {
- Assume-Yes "true";
- allow-change-held-packages "true";
- allow-downgrades "true";
- allow-remove-essential "true";
- };
-};
-
-Dpkg::Options {
- "--force-confdef";
- "--force-confold";
-};
-
-EOF
-
- # Install plymouth labels and themes to get rid of initrd warnings / errors
- if [ "$VERSION" = '14.04' ]
- then
-
- # openjdk-8-jdk is not available in 14.04 repos by default
- add-apt-repository ppa:openjdk-r/ppa
-
- # Install OpenJDK
- PACKAGES="$PACKAGES openjdk-8-jdk-headless"
-
- # Install Oracle's jdk version 8
-# apt-add-repository -y ppa:webupd8team/java
-# apt-get -qq update
-# echo "debconf shared/accepted-oracle-license-v1-1 select true
-# debconf shared/accepted-oracle-license-v1-1 seen true" | sudo debconf-set-selections
-# PACKAGES="$PACKAGES oracle-java8-installer"
- else
- # Install default jdk and plymouth packages
- PACKAGES="$PACKAGES plymouth-themes plymouth-label default-jdk-headless"
- fi
-
-
- echo '---> Updating OS'
- # Standard update + upgrade dance
- apt-get -qq update
- apt-get -qq upgrade
- apt-get -qq dist-upgrade
-
- # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
-
- update-alternatives --install /bin/sh sh /bin/bash 100
-
- # Install build tools - should match vpp/Makefile DEB_DEPENDS variable
- PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev ccache "
- PACKAGES="$PACKAGES debhelper dkms openjdk-8-jdk git libtool dkms debhelper libganglia1-dev libapr1-dev dh-systemd"
- PACKAGES="$PACKAGES libconfuse-dev git-review exuberant-ctags cscope"
- # Add openjdk-7-jdk because it catches some bugs in Ubuntu1404
- PACKAGES="$PACKAGES openjdk-7-jdk"
+ deb_aptconf_batchconf
+ deb_sync_minor
+ deb_correct_shell
+ deb_install_pkgs
+ deb_flush
+ deb_reup_certs
- # Install interface manipulation tools, editor, debugger and lsb
- PACKAGES="$PACKAGES iproute2 bridge-utils vim gdb lsb-release"
-
- # Install latest kernel and uio
- PACKAGES="$PACKAGES linux-image-extra-virtual"
-
- # $$$ comment out for the moment
- # PACKAGES="$PACKAGES maven3"
-
- # Install virtualenv for test execution
- PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
-
- echo '---> Installing packages'
- # disable double quoting check
- # shellcheck disable=SC2086
- apt-get -qq install ${PACKAGES}
- apt-get -qq autoremove
- apt-get -qq clean
-
- # update CA certificates
- echo '---> Forcing CA certificate update'
- update-ca-certificates -f
-
- # It is not necessary to load the uio kernel module during the bootstrap phase
-# modprobe uio_pci_generic
+ # 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
-
- # Setup for hugepages using sysctl 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
-
-}
-
-rh_systems() {
- echo '---> Updating OS'
- yum clean all -q
- yum upgrade -q -y
+ deb_enable_modules 'uio_pci_generic'
- echo '---> Installing tools'
- yum install -q -y @development openssl-devel glibc-static redhat-lsb
+ deb_enable_hugepages
- # Install jdk and maven
- yum install -q -y java-1.8.0-openjdk-devel yum-utils openssl-devel
+ # It is not necessary to mount hugepages during bootstrap phase
+ # deb_mount_hugepages
- # Install python development
- yum search python34-devel 2>&1 | grep -q 'No matches'
- if [ $? -eq 0 ]
- then
- echo '---> Installing python-devel'
- yum install -q -y python-devel
- else
- echo '---> Installying python34-devel'
- yum install -q -y python34-devel
- fi
-
- echo '---> Configuring EPEL'
- # Install EPEL
- yum install -q -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-
- # Install components to build Ganglia modules
- yum install -q -y {apr,libconfuse,ganglia}-devel mock
-}
-
-echo "---> Attempting to detect OS"
-# OS selector
-if [ -f /usr/bin/yum ]
-then
- OS='RH'
-else
- OS='UBUNTU'
fi
-case "$OS" in
- RH)
- echo "---> RH type system detected"
- rh_systems
- ;;
- UBUNTU)
- echo "---> Ubuntu system detected"
- ubuntu_systems
- ;;
- *)
- echo "---> Unknown operating system"
- ;;
-esac
-
echo "bootstrap process (PID=$$) complete."
-#exec 1>&- # close STDOUT
-#exec 2>&- # close STDERR
-
exit 0