4 echo "127.0.1.1 $(hostname) # temporary" >> /etc/hosts
9 MAVEN_FILENAME=apache-maven-${MAVEN_VERSION}-bin.tar.gz
10 MAVEN_HOME=/opt/apache/maven
12 mkdir -p ${MAVEN_HOME}
13 tar -C ${MAVEN_HOME} --strip-components 1 -xzf /vagrant/${MAVEN_FILENAME}
18 perl -i -ne 'print unless /^127.0.1.1.*# temporary$/' /etc/hosts
28 deb_enable_modules() {
31 echo ${mod} >> /etc/modules
35 deb_aptconf_batchconf() {
36 cat <<EOF >> /etc/apt/apt.conf
40 allow-change-held-packages "true";
41 allow-downgrades "true";
42 allow-remove-essential "true";
57 echo '---> Updating OS'
58 # Standard update + upgrade dance
65 echo '---> Correcting system shell'
66 # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
67 update-alternatives --install /bin/sh sh /bin/bash 100
71 echo '---> Flushing extra packages and package cache'
77 echo "---> Adding '$1' PPA"
78 apt-get install software-properties-common
80 while [ ${ATTEMPT} -le 4 ]
83 apt-add-repository -y $1 || FAIL=1
88 ATTEMPT=$(expr $ATTEMPT + 1)
94 apt-get install lsb-release
95 LSB_PATH=$(which lsb_release)
97 VERSION=$(lsb_release -r | awk '{print $2}')
98 DIST=$(lsb_release -i | awk '{print $3}')
99 CODENAME=$(lsb_release -c | awk '{print $2}')
101 echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
103 # initialize PACKAGES
104 PACKAGES="cloud-initramfs-dyn-netconf cloud-initramfs-growroot
105 cloud-initramfs-rescuevol"
107 if [ "$VERSION" = '14.04' ]
109 # openjdk-8-jdk is not available in 14.04 repos by default
110 deb_add_ppa ppa:openjdk-r/ppa
112 # Install OpenJDK v8 *and* v7 on Trusty
113 PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk emacs24-nox"
114 elif [ "$VERSION" = '16.04' ]
116 # Install default jdk (v8 on this platform)
117 PACKAGES="$PACKAGES default-jdk-headless emacs-nox"
119 # plymouth-label and plymouth-themes are required to get rid of
120 # initrd warnings / errors on 16.04
121 apt-get install plymouth-themes plymouth-label
124 # Build tools - should match vpp/Makefile DEB_DEPENDS variable
125 PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev
126 ccache debhelper dkms git libtool libganglia1-dev libapr1-dev
127 dh-systemd libconfuse-dev git-review exuberant-ctags cscope indent"
129 # Interface manipulation tools, editors, debugger and lsb
130 PACKAGES="$PACKAGES iproute2 ethtool vlan bridge-utils
133 # Install latest kernel and uio
134 PACKAGES="$PACKAGES linux-image-extra-virtual linux-headers-virtual"
136 # $$$ comment out for the moment
137 # PACKAGES="$PACKAGES maven3"
139 # Install virtualenv for test execution
140 PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
142 echo '---> Installing packages'
143 # disable double quoting check
144 # shellcheck disable=SC2086
145 apt-get install ${PACKAGES}
147 # Specify documentation packages
148 DOC_PACKAGES="doxygen graphviz"
149 apt-get install ${DOC_PACKAGES}
152 deb_enable_hugepages() {
153 # Setup for hugepages using sysctl so it persists across reboots
154 sysctl -w vm.nr_hugepages=1024
157 echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab
160 deb_mount_hugepages() {
165 # update CA certificates
166 echo '---> Forcing CA certificate update'
167 update-ca-certificates -f
171 echo '---> Removing unattended-upgrades packge to avoid it locking /var/lib/dpkg/lock'
172 apt-get remove unattended-upgrades
175 deb_disable_apt_systemd_daily() {
176 echo '---> Stopping and disabling apt.systemd.daily to avoid it locking /var/lib/dpkg/lock'
177 if [ -f /usr/bin/systemctl ]
179 systemctl stop apt.systemd.daily
180 systemctl disable apt.systemd.daily
182 /etc/init.d/unattended-upgrades stop
183 update-rc.d -f unattended-upgrades remove
188 echo '---> Cleaning caches'
193 echo '---> Updating OS'
198 echo '---> Installing tools'
200 # Install build tools
201 yum install -q -y @development redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils \
202 openssl-devel apr-devel indent
204 # Specify documentation packages
205 DOC_PACKAGES="doxygen graphviz"
206 yum install -q -y install ${DOC_PACKAGES}
208 # Install python development
209 OUTPUT=$(yum search python34-devel 2>&1 | grep 'No matches')
212 echo '---> Installing python34-devel'
213 yum install -q -y python34-devel
215 echo '---> Installing python-devel'
216 yum install -q -y python-devel
219 echo '---> Configuring EPEL'
221 OUTPUT=$(rpm -qa epel-release)
224 yum install -q -y /vagrant/epel-release-latest-7.noarch.rpm
227 # Install components to build Ganglia modules
228 yum install -q -y --enablerepo=epel {libconfuse,ganglia}-devel mock
230 # Install debuginfo packages
231 debuginfo-install -q -y glibc-2.17-106.el7_2.4.x86_64 openssl-libs-1.0.1e-51.el7_2.4.x86_64 zlib-1.2.7-15.el7.x86_64