#!/bin/bash
+do_setup() {
+ echo "127.0.1.1 $(hostname) # temporary" >> /etc/hosts
+}
+
+do_mvn_install() {
+ MAVEN_VERSION=3.3.9
+ MAVEN_FILENAME=apache-maven-${MAVEN_VERSION}-bin.tar.gz
+ MAVEN_HOME=/opt/apache/maven
+
+ mkdir -p ${MAVEN_HOME}
+ tar -C ${MAVEN_HOME} --strip-components 1 -xzf /vagrant/${MAVEN_FILENAME}
+}
+
+
+do_cleanup() {
+ perl -i -ne 'print unless /^127.0.1.1.*# temporary$/' /etc/hosts
+}
+
deb_probe_modules() {
for mod in "$@"
do
- modprobe ${mod}
+ modprobe ${mod}
done
}
deb_enable_modules() {
for mod in "$@"
do
- echo ${mod} >> /etc/modules
+ echo ${mod} >> /etc/modules
done
}
"--force-confold";
};
+quiet "2";
+
EOF
}
deb_sync_minor() {
echo '---> Updating OS'
# Standard update + upgrade dance
- apt-get -qq update
- apt-get -qq upgrade
- apt-get -qq dist-upgrade
+ apt-get update
+ apt-get upgrade
+ apt-get dist-upgrade
}
deb_correct_shell() {
deb_flush() {
echo '---> Flushing extra packages and package cache'
- apt-get -qq autoremove
- apt-get -qq clean
+ apt-get autoremove
+ apt-get clean
}
deb_add_ppa() {
echo "---> Adding '$1' PPA"
- apt-get -qq install software-properties-common
- apt-add-repository -y $1
- apt-get -qq update
+ apt-get install software-properties-common
+ ATTEMPT=0
+ while [ ${ATTEMPT} -le 4 ]
+ do
+ FAIL=0
+ apt-add-repository -y $1 || FAIL=1
+ if [ ${FAIL} -eq 0 ]
+ then
+ break
+ fi
+ ATTEMPT=$(expr $ATTEMPT + 1)
+ done
+ apt-get update
}
deb_install_pkgs() {
+ apt-get install lsb-release
LSB_PATH=$(which lsb_release)
- 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
+ VERSION=$(lsb_release -r | awk '{print $2}')
+ DIST=$(lsb_release -i | awk '{print $3}')
+ CODENAME=$(lsb_release -c | awk '{print $2}')
echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
- PACKAGES="" # initialize PACKAGES
+ # initialize PACKAGES
+ PACKAGES="cloud-initramfs-dyn-netconf cloud-initramfs-growroot
+ cloud-initramfs-rescuevol"
+
if [ "$VERSION" = '14.04' ]
then
# openjdk-8-jdk is not available in 14.04 repos by default
- deb_add_ppa ppa:openjdk-r/ppa
+ deb_add_ppa ppa:openjdk-r/ppa
- # Install OpenJDK v8 and v7
- PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk"
- else
- # Install default jdk
- PACKAGES="$PACKAGES default-jdk-headless"
+ # Install OpenJDK v8 *and* v7 on Trusty
+ PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk emacs24-nox"
+ elif [ "$VERSION" = '16.04' ]
+ then
+ # Install default jdk (v8 on this platform)
+ PACKAGES="$PACKAGES default-jdk-headless emacs-nox"
- # Install plymouth label and themes to get rid of initrd warnings / errors
- apt-get -qq install plymouth-themes plymouth-label
+ # plymouth-label and plymouth-themes are required to get rid of
+ # initrd warnings / errors on 16.04
+ apt-get install plymouth-themes plymouth-label
fi
- # 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 git libtool libganglia1-dev libapr1-dev dh-systemd"
- PACKAGES="$PACKAGES libconfuse-dev git-review exuberant-ctags cscope"
+ # Build tools - should match vpp/Makefile DEB_DEPENDS variable
+ PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev
+ ccache debhelper dkms git libtool libganglia1-dev libapr1-dev
+ dh-systemd libconfuse-dev git-review exuberant-ctags cscope indent"
-
- # Install interface manipulation tools, editor, debugger and lsb
- PACKAGES="$PACKAGES iproute2 bridge-utils vim gdb lsb-release"
+ # Interface manipulation tools, editors, debugger and lsb
+ PACKAGES="$PACKAGES iproute2 ethtool vlan bridge-utils
+ vim gdb lsb-release"
# Install latest kernel and uio
PACKAGES="$PACKAGES linux-image-extra-virtual linux-headers-virtual"
echo '---> Installing packages'
# disable double quoting check
# shellcheck disable=SC2086
- apt-get -qq install ${PACKAGES}
+ apt-get install ${PACKAGES}
+ # Specify documentation packages
+ DOC_PACKAGES="doxygen graphviz"
+ apt-get install ${DOC_PACKAGES}
}
deb_enable_hugepages() {
update-ca-certificates -f
}
+deb_remove_pkgs() {
+ echo '---> Removing unattended-upgrades packge to avoid it locking /var/lib/dpkg/lock'
+ apt-get remove unattended-upgrades
+}
+
+deb_disable_apt_systemd_daily() {
+ echo '---> Stopping and disabling apt.systemd.daily to avoid it locking /var/lib/dpkg/lock'
+ if [ -f /usr/bin/systemctl ]
+ then
+ systemctl stop apt.systemd.daily
+ systemctl disable apt.systemd.daily
+ else
+ /etc/init.d/unattended-upgrades stop
+ update-rc.d -f unattended-upgrades remove
+ fi
+}
+
rh_clean_pkgs() {
echo '---> Cleaning caches'
yum clean all -q
# Install build tools
yum install -q -y @development redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils \
- openssl-devel apr-devel
+ openssl-devel apr-devel indent
+
+ # Specify documentation packages
+ DOC_PACKAGES="doxygen graphviz"
+ yum install -q -y install ${DOC_PACKAGES}
# Install python development
- yum search python34-devel 2>&1 | grep -q 'No matches'
- if [ $? -eq 0 ]
+ OUTPUT=$(yum search python34-devel 2>&1 | grep 'No matches')
+ if [ -z "$OUTPUT" ]
then
- echo '---> Installing python-devel'
- yum install -q -y python-devel
- else
- echo '---> Installing python34-devel'
+ echo '---> Installing python34-devel'
yum install -q -y python34-devel
+ else
+ echo '---> Installing python-devel'
+ yum install -q -y python-devel
fi
echo '---> Configuring EPEL'
# Install EPEL
- yum install -q -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+ OUTPUT=$(rpm -qa epel-release)
+ if [ -z "$OUTPUT" ]
+ then
+ yum install -q -y /vagrant/epel-release-latest-7.noarch.rpm
+ fi
# Install components to build Ganglia modules
yum install -q -y --enablerepo=epel {libconfuse,ganglia}-devel mock