4 echo "127.0.1.1 $(hostname) # temporary" >> /etc/hosts
8 perl -i -ne 'print unless /^127.0.1.1.*# temporary$/' /etc/hosts
18 deb_enable_modules() {
21 echo ${mod} >> /etc/modules
25 deb_aptconf_batchconf() {
26 cat <<EOF >> /etc/apt/apt.conf
30 allow-change-held-packages "true";
31 allow-downgrades "true";
32 allow-remove-essential "true";
47 echo '---> Updating OS'
48 # Standard update + upgrade dance
55 echo '---> Correcting system shell'
56 # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
57 update-alternatives --install /bin/sh sh /bin/bash 100
61 echo '---> Flushing extra packages and package cache'
67 echo "---> Adding '$1' PPA"
68 apt-get install software-properties-common
70 while [ ${ATTEMPT} -le 4 ]
73 apt-add-repository -y $1 || FAIL=1
78 ATTEMPT=$(expr $ATTEMPT + 1)
84 apt-get install lsb-release
85 LSB_PATH=$(which lsb_release)
87 VERSION=$(lsb_release -r | awk '{print $2}')
88 DIST=$(lsb_release -i | awk '{print $3}')
89 CODENAME=$(lsb_release -c | awk '{print $2}')
91 echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
94 PACKAGES="cloud-initramfs-dyn-netconf cloud-initramfs-growroot
95 cloud-initramfs-rescuevol"
97 if [ "$VERSION" = '14.04' ]
99 # openjdk-8-jdk is not available in 14.04 repos by default
100 deb_add_ppa ppa:openjdk-r/ppa
102 # Install OpenJDK v8 *and* v7 on Trusty
103 PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk emacs24-nox"
104 elif [ "$VERSION" = '16.04' ]
106 # Install default jdk (v8 on this platform)
107 PACKAGES="$PACKAGES default-jdk-headless emacs-nox"
109 # plymouth-label and plymouth-themes are required to get rid of
110 # initrd warnings / errors on 16.04
111 apt-get install plymouth-themes plymouth-label
114 # Build tools - should match vpp/Makefile DEB_DEPENDS variable
115 PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev
116 ccache debhelper dkms git libtool libganglia1-dev libapr1-dev
117 dh-systemd libconfuse-dev git-review exuberant-ctags cscope"
119 # Interface manipulation tools, editors, debugger and lsb
120 PACKAGES="$PACKAGES iproute2 ethtool vlan bridge-utils
123 # Install latest kernel and uio
124 PACKAGES="$PACKAGES linux-image-extra-virtual linux-headers-virtual"
126 # $$$ comment out for the moment
127 # PACKAGES="$PACKAGES maven3"
129 # Install virtualenv for test execution
130 PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
132 echo '---> Installing packages'
133 # disable double quoting check
134 # shellcheck disable=SC2086
135 apt-get install ${PACKAGES}
137 # Specify documentation packages
138 DOC_PACKAGES="doxygen graphviz"
139 apt-get install ${DOC_PACKAGES}
142 deb_enable_hugepages() {
143 # Setup for hugepages using sysctl so it persists across reboots
144 sysctl -w vm.nr_hugepages=1024
147 echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab
150 deb_mount_hugepages() {
155 # update CA certificates
156 echo '---> Forcing CA certificate update'
157 update-ca-certificates -f
161 echo '---> Removing unattended-upgrades packge to avoid it locking /var/lib/dpkg/lock'
162 apt-get remove unattended-upgrades
165 deb_disable_apt_systemd_daily() {
166 echo '---> Stopping and disabling apt.systemd.daily to avoid it locking /var/lib/dpkg/lock'
167 if [ -f /usr/bin/systemctl ]
169 systemctl stop apt.systemd.daily
170 systemctl disable apt.systemd.daily
172 /etc/init.d/unattended-upgrades stop
173 update-rc.d -f unattended-upgrades remove
178 echo '---> Cleaning caches'
183 echo '---> Updating OS'
188 echo '---> Installing tools'
190 # Install build tools
191 yum install -q -y @development redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils \
192 openssl-devel apr-devel
194 # Specify documentation packages
195 DOC_PACKAGES="doxygen graphviz"
196 yum install -q -y install ${DOC_PACKAGES}
198 # Install python development
199 OUTPUT=$(yum search python34-devel 2>&1 | grep 'No matches')
202 echo '---> Installing python34-devel'
203 yum install -q -y python34-devel
205 echo '---> Installing python-devel'
206 yum install -q -y python-devel
209 echo '---> Configuring EPEL'
211 OUTPUT=$(rpm -qa epel-release)
214 yum install -q -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
217 # Install components to build Ganglia modules
218 yum install -q -y --enablerepo=epel {libconfuse,ganglia}-devel mock
220 # Install debuginfo packages
221 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