3 deb_enable_serial_console() {
4 # enable grub and login on serial console
6 echo <<EOF>> /etc/default/grub
8 GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
20 deb_enable_modules() {
23 echo ${mod} >> /etc/modules
27 deb_aptconf_batchconf() {
28 cat <<EOF >> /etc/apt/apt.conf
32 allow-change-held-packages "true";
33 allow-downgrades "true";
34 allow-remove-essential "true";
47 echo '---> Updating OS'
48 # Standard update + upgrade dance
51 apt-get -qq dist-upgrade
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'
62 apt-get -qq autoremove
67 echo "---> Adding '$1' PPA"
68 apt-get -qq install software-properties-common
69 apt-add-repository -y $1
74 LSB_PATH=$(which lsb_release)
78 VERSION=$(lsb_release -r | awk '{print $2}')
79 DIST=$(lsb_release -i | awk '{print $3}')
80 CODENAME=$(lsb_release -c | awk '{print $2}')
82 ISSUE_TXT=$(head -1 /etc/issue)
83 DIST=$(echo "${ISSUE_TXT}" | awk '{print $1}')
84 if [ "$DIST" = "Ubuntu" ]
86 VERSION=$(echo "${ISSUE_TXT}" | awk '{print $2}' | sed -e 's/^(\d+\.\d+)(\.\d+)?$/\1/')
87 elif [ "$DIST" = "Debian" ]
89 VERSION=$(echo "${ISSUE_TXT}" | awk '{print $3}')
91 echo "Unrecognized distribution: ${DIST}"
95 echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
97 PACKAGES="" # initialize PACKAGES
98 if [ "$VERSION" = '14.04' ]
100 # openjdk-8-jdk is not available in 14.04 repos by default
101 deb_add_ppa ppa:openjdk-r/ppa
103 # Install OpenJDK v8 and v7
104 PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk"
106 # Install default jdk
107 PACKAGES="$PACKAGES default-jdk-headless"
109 # Install plymouth label and themes to get rid of initrd warnings / errors
110 apt-get -qq install plymouth-themes plymouth-label
113 # Install build tools - should match vpp/Makefile DEB_DEPENDS variable
114 PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev ccache"
115 PACKAGES="$PACKAGES debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd"
116 PACKAGES="$PACKAGES libconfuse-dev git-review exuberant-ctags cscope"
119 # Install interface manipulation tools, editor, debugger and lsb
120 PACKAGES="$PACKAGES iproute2 bridge-utils vim gdb lsb-release"
122 # Install latest kernel and uio
123 PACKAGES="$PACKAGES linux-image-extra-virtual linux-headers-virtual"
125 # $$$ comment out for the moment
126 # PACKAGES="$PACKAGES maven3"
128 # Install virtualenv for test execution
129 PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
131 echo '---> Installing packages'
132 # disable double quoting check
133 # shellcheck disable=SC2086
134 apt-get -qq install ${PACKAGES}
138 deb_enable_hugepages() {
139 # Setup for hugepages using sysctl so it persists across reboots
140 sysctl -w vm.nr_hugepages=1024
143 echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab
146 deb_mount_hugepages() {
151 # update CA certificates
152 echo '---> Forcing CA certificate update'
153 update-ca-certificates -f
157 echo '---> Cleaning caches'
162 echo '---> Updating OS'
167 echo '---> Installing tools'
169 # Install build tools
170 yum install -q -y @development redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils \
171 openssl-devel apr-devel
173 # Install python development
174 yum search python34-devel 2>&1 | grep -q 'No matches'
177 echo '---> Installing python-devel'
178 yum install -q -y python-devel
180 echo '---> Installing python34-devel'
181 yum install -q -y python34-devel
184 echo '---> Configuring EPEL'
186 yum install -q -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
188 # Install components to build Ganglia modules
189 yum install -q -y --enablerepo=epel {libconfuse,ganglia}-devel mock
191 # Install debuginfo packages
192 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