Tom Jones | c3b416c | 2024-01-18 14:51:44 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 2 | |
| 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 |
| 8 | sysctl -w vm.nr_hugepages=1024 |
| 9 | HUGEPAGES=`sysctl -n vm.nr_hugepages` |
| 10 | if [ $HUGEPAGES != 1024 ]; then |
| 11 | echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish." |
| 12 | exit |
| 13 | fi |
| 14 | |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame] | 15 | if [ "$(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 Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 18 | fi |
| 19 | |
| 20 | # Do initial setup for the system |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame] | 21 | if [ "$OS_ID" == "ubuntu" ]; then |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 22 | |
| 23 | export DEBIAN_PRIORITY=critical |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 24 | export DEBIAN_FRONTEND=noninteractive |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 25 | 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 Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 27 | |
| 28 | # Standard update + upgrade dance |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 29 | apt-get update ${APT_OPTS} >/dev/null |
| 30 | apt-get upgrade ${APT_OPTS} >/dev/null |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 31 | |
| 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 Wallace | 3079a64 | 2017-09-06 01:59:43 -0400 | [diff] [blame] | 37 | apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3 |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame] | 38 | elif [ "$OS_ID" == "centos" ]; then |
Dave Wallace | d51020c | 2017-09-26 18:15:47 -0400 | [diff] [blame] | 39 | 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 Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 44 | # Standard update + upgrade dance |
| 45 | yum check-update |
| 46 | yum update -y |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 47 | fi |