4 echo "127.0.1.1 $(hostname) # temporary" >> /etc/hosts
7 echo "TCPKeepAlive true" >> /etc/ssh/ssh_config
8 echo "ServerAliveCountMax 30" >> /etc/ssh/ssh_config
9 echo "ServerAliveInterval 10" >> /etc/ssh/ssh_config
14 MAVEN_FILENAME=apache-maven-${MAVEN_VERSION}-bin.tar.gz
15 MAVEN_HOME=/opt/apache/maven
17 mkdir -p ${MAVEN_HOME}
18 tar -C ${MAVEN_HOME} --strip-components 1 -xzf /vagrant/${MAVEN_FILENAME}
23 perl -i -ne 'print unless /^127.0.1.1.*# temporary$/' /etc/hosts
33 deb_enable_modules() {
36 echo ${mod} >> /etc/modules
40 deb_aptconf_batchconf() {
41 cat <<EOF >> /etc/apt/apt.conf
45 allow-change-held-packages "true";
46 allow-downgrades "true";
47 allow-remove-essential "true";
62 echo '---> Updating OS'
63 # Standard update + upgrade dance
70 echo '---> Correcting system shell'
71 # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
72 update-alternatives --install /bin/sh sh /bin/bash 100
76 echo '---> Flushing extra packages and package cache'
82 echo "---> Adding '$1' PPA"
83 apt-get install software-properties-common
85 while [ ${ATTEMPT} -le 4 ]
88 apt-add-repository -y $1 || FAIL=1
93 ATTEMPT=$(expr $ATTEMPT + 1)
99 apt-get install lsb-release
100 LSB_PATH=$(which lsb_release)
102 VERSION=$(lsb_release -r | awk '{print $2}')
103 DIST=$(lsb_release -i | awk '{print $3}')
104 CODENAME=$(lsb_release -c | awk '{print $2}')
106 echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
108 # initialize PACKAGES
109 PACKAGES="cloud-initramfs-dyn-netconf cloud-initramfs-growroot
110 cloud-initramfs-rescuevol"
112 if [ "$VERSION" = '14.04' ]
114 # openjdk-8-jdk is not available in 14.04 repos by default
115 deb_add_ppa ppa:openjdk-r/ppa
117 # Install OpenJDK v8 *and* v7 on Trusty
118 PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk emacs24-nox"
119 elif [ "$VERSION" = '16.04' ]
121 # Install default jdk (v8 on this platform)
122 PACKAGES="$PACKAGES default-jdk-headless emacs-nox"
124 # plymouth-label and plymouth-themes are required to get rid of
125 # initrd warnings / errors on 16.04
126 apt-get install plymouth-themes plymouth-label
129 # Build tools - should match vpp/Makefile DEB_DEPENDS variable
130 PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev
131 ccache debhelper dkms git libtool libganglia1-dev libapr1-dev
132 dh-systemd libconfuse-dev git-review exuberant-ctags cscope indent"
134 # Interface manipulation tools, editors, debugger and lsb
135 PACKAGES="$PACKAGES iproute2 ethtool vlan bridge-utils
138 # Install latest kernel and uio
139 PACKAGES="$PACKAGES linux-image-extra-virtual linux-headers-virtual"
141 # $$$ comment out for the moment
142 # PACKAGES="$PACKAGES maven3"
144 # Install virtualenv for test execution
145 PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
147 # Install to allow the vpp-docs job to zip up docs to push them
148 PACKAGES="$PACKAGES zip"
150 # Install for deb_dpdk debian package buiding
151 PACKAGES="$PACKAGES dpkg-dev dh-python inkscape libcap-dev libpcap-dev"
152 PACKAGES="$PACKAGES libxen-dev libxenstore3.0 python-sphinx python-sphinx-rtd-theme"
153 PACKAGES="$PACKAGES texlive-fonts-recommended texlive-latex-extra"
155 echo '---> Installing packages'
156 # disable double quoting check
157 # shellcheck disable=SC2086
158 apt-get install ${PACKAGES}
160 # Specify documentation packages
161 DOC_PACKAGES="doxygen graphviz python-pyparsing python-jinja2"
162 apt-get install ${DOC_PACKAGES}
165 deb_enable_hugepages() {
166 # Setup for hugepages using sysctl so it persists across reboots
167 AVP="vm.nr_hugepages=1024"
169 echo "${AVP}" >> /etc/sysctl.conf
172 echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab
175 deb_mount_hugepages() {
180 # update CA certificates
181 echo '---> Forcing CA certificate update'
182 update-ca-certificates -f
186 echo '---> Removing unattended-upgrades packge to avoid it locking /var/lib/dpkg/lock'
187 apt-get remove unattended-upgrades
190 deb_disable_apt_systemd_daily() {
191 echo '---> Stopping and disabling apt.systemd.daily to avoid it locking /var/lib/dpkg/lock'
192 if [ -f /usr/bin/systemctl ]
194 systemctl stop apt.systemd.daily
195 systemctl disable apt.systemd.daily
197 /etc/init.d/unattended-upgrades stop
198 update-rc.d -f unattended-upgrades remove
203 echo '---> Cleaning caches'
208 echo '---> Updating OS'
213 echo '---> Installing tools'
215 # Install build tools
216 yum install -q -y @development redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils \
217 openssl-devel apr-devel indent
219 # Specify documentation packages
220 DOC_PACKAGES="doxygen graphviz pyparsing python-jinja2"
221 yum install -q -y install ${DOC_PACKAGES}
223 # Install python development
224 OUTPUT=$(yum search python34-devel 2>&1 | grep 'No matches')
227 echo '---> Installing python34-devel'
228 yum install -q -y python34-devel
230 echo '---> Installing python-devel'
231 yum install -q -y python-devel
234 echo '---> Configuring EPEL'
236 OUTPUT=$(rpm -qa epel-release)
239 yum install -q -y /vagrant/epel-release-latest-7.noarch.rpm
242 # Install components to build Ganglia modules
243 yum install -q -y --enablerepo=epel {libconfuse,ganglia}-devel mock
245 # Install debuginfo packages
246 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