Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 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 | |
| 15 | # Figure out what system we are running on |
| 16 | if [ -f /etc/lsb-release ];then |
| 17 | . /etc/lsb-release |
| 18 | elif [ -f /etc/redhat-release ];then |
| 19 | yum install -y redhat-lsb |
| 20 | DISTRIB_ID=`lsb_release -si` |
| 21 | DISTRIB_RELEASE=`lsb_release -sr` |
| 22 | DISTRIB_CODENAME=`lsb_release -sc` |
| 23 | DISTRIB_DESCRIPTION=`lsb_release -sd` |
| 24 | fi |
| 25 | |
| 26 | # Do initial setup for the system |
| 27 | if [ $DISTRIB_ID == "Ubuntu" ]; then |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 28 | |
| 29 | export DEBIAN_PRIORITY=critical |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 30 | export DEBIAN_FRONTEND=noninteractive |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 31 | export DEBCONF_NONINTERACTIVE_SEEN=true |
| 32 | 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] | 33 | |
| 34 | # Standard update + upgrade dance |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 35 | apt-get update ${APT_OPTS} >/dev/null |
| 36 | apt-get upgrade ${APT_OPTS} >/dev/null |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 37 | |
| 38 | # Fix the silly notion that /bin/sh should point to dash by pointing it to bash |
| 39 | |
| 40 | update-alternatives --install /bin/sh sh /bin/bash 100 |
| 41 | |
| 42 | # Install useful but non-mandatory tools |
Dave Wallace | 3079a64 | 2017-09-06 01:59:43 -0400 | [diff] [blame] | 43 | apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3 |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 44 | elif [ $DISTRIB_ID == "CentOS" ]; then |
Dave Wallace | d51020c | 2017-09-26 18:15:47 -0400 | [diff] [blame] | 45 | if [ "$(echo $DISTRIB_RELEASE | cut -d'.' -f1)" == "7" ]; then |
| 46 | rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm |
| 47 | yum groupinstall "X Window system" -y |
| 48 | yum groupinstall xfce -y |
| 49 | fi |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 50 | # Standard update + upgrade dance |
| 51 | yum check-update |
| 52 | yum update -y |
Ray Kinsella | 1a9b5b7 | 2016-12-21 14:25:40 +0000 | [diff] [blame] | 53 | fi |