blob: e56e6ba004ef0d4f5df1615378b4983de196ab23 [file] [log] [blame]
Tom Jonesc3b416c2024-01-18 14:51:44 +00001#!/usr/bin/env bash
Ed Warnicked6a0fc52016-04-12 17:34:48 -05002
3# Make sure that we get the hugepages we need on provision boot
4# Note: The package install should take care of this at the end
5# But sometimes after all the work of provisioning, we can't
6# get the requested number of hugepages without rebooting.
7# So do it here just in case
8sysctl -w vm.nr_hugepages=1024
9HUGEPAGES=`sysctl -n vm.nr_hugepages`
10if [ $HUGEPAGES != 1024 ]; then
11 echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish."
12 exit
13fi
14
Marco Varlesec2e63fe2017-10-06 15:07:08 +020015if [ "$(uname)" <> "Darwin" ]; then
16 OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
17 OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
Ed Warnicked6a0fc52016-04-12 17:34:48 -050018fi
19
20# Do initial setup for the system
Marco Varlesec2e63fe2017-10-06 15:07:08 +020021if [ "$OS_ID" == "ubuntu" ]; then
Ray Kinsella1a9b5b72016-12-21 14:25:40 +000022
23 export DEBIAN_PRIORITY=critical
Ed Warnicked6a0fc52016-04-12 17:34:48 -050024 export DEBIAN_FRONTEND=noninteractive
Ray Kinsella1a9b5b72016-12-21 14:25:40 +000025 export DEBCONF_NONINTERACTIVE_SEEN=true
26 APT_OPTS="--assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
Ed Warnicked6a0fc52016-04-12 17:34:48 -050027
28 # Standard update + upgrade dance
Ray Kinsella1a9b5b72016-12-21 14:25:40 +000029 apt-get update ${APT_OPTS} >/dev/null
30 apt-get upgrade ${APT_OPTS} >/dev/null
Ed Warnicked6a0fc52016-04-12 17:34:48 -050031
32 # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
33
34 update-alternatives --install /bin/sh sh /bin/bash 100
35
36 # Install useful but non-mandatory tools
Dave Wallace3079a642017-09-06 01:59:43 -040037 apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3
Marco Varlesec2e63fe2017-10-06 15:07:08 +020038elif [ "$OS_ID" == "centos" ]; then
Dave Wallaced51020c2017-09-26 18:15:47 -040039 if [ "$(echo $DISTRIB_RELEASE | cut -d'.' -f1)" == "7" ]; then
40 rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
41 yum groupinstall "X Window system" -y
42 yum groupinstall xfce -y
43 fi
Ed Warnicked6a0fc52016-04-12 17:34:48 -050044 # Standard update + upgrade dance
45 yum check-update
46 yum update -y
Ray Kinsella1a9b5b72016-12-21 14:25:40 +000047fi