2024-01-18 14:51:44 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-04-12 17:34:48 -05:00
|
|
|
|
|
|
|
# Make sure that we get the hugepages we need on provision boot
|
|
|
|
# Note: The package install should take care of this at the end
|
|
|
|
# But sometimes after all the work of provisioning, we can't
|
|
|
|
# get the requested number of hugepages without rebooting.
|
|
|
|
# So do it here just in case
|
|
|
|
sysctl -w vm.nr_hugepages=1024
|
|
|
|
HUGEPAGES=`sysctl -n vm.nr_hugepages`
|
|
|
|
if [ $HUGEPAGES != 1024 ]; then
|
|
|
|
echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2017-10-06 15:07:08 +02:00
|
|
|
if [ "$(uname)" <> "Darwin" ]; then
|
|
|
|
OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
|
|
|
|
OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
|
2016-04-12 17:34:48 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Do initial setup for the system
|
2017-10-06 15:07:08 +02:00
|
|
|
if [ "$OS_ID" == "ubuntu" ]; then
|
2016-12-21 14:25:40 +00:00
|
|
|
|
|
|
|
export DEBIAN_PRIORITY=critical
|
2016-04-12 17:34:48 -05:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2016-12-21 14:25:40 +00:00
|
|
|
export DEBCONF_NONINTERACTIVE_SEEN=true
|
|
|
|
APT_OPTS="--assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
|
2016-04-12 17:34:48 -05:00
|
|
|
|
|
|
|
# Standard update + upgrade dance
|
2016-12-21 14:25:40 +00:00
|
|
|
apt-get update ${APT_OPTS} >/dev/null
|
|
|
|
apt-get upgrade ${APT_OPTS} >/dev/null
|
2016-04-12 17:34:48 -05:00
|
|
|
|
|
|
|
# Fix the silly notion that /bin/sh should point to dash by pointing it to bash
|
|
|
|
|
|
|
|
update-alternatives --install /bin/sh sh /bin/bash 100
|
|
|
|
|
|
|
|
# Install useful but non-mandatory tools
|
2017-09-06 01:59:43 -04:00
|
|
|
apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3
|
2017-10-06 15:07:08 +02:00
|
|
|
elif [ "$OS_ID" == "centos" ]; then
|
2017-09-26 18:15:47 -04:00
|
|
|
if [ "$(echo $DISTRIB_RELEASE | cut -d'.' -f1)" == "7" ]; then
|
|
|
|
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
|
|
|
yum groupinstall "X Window system" -y
|
|
|
|
yum groupinstall xfce -y
|
|
|
|
fi
|
2016-04-12 17:34:48 -05:00
|
|
|
# Standard update + upgrade dance
|
|
|
|
yum check-update
|
|
|
|
yum update -y
|
2016-12-21 14:25:40 +00:00
|
|
|
fi
|