update.sh revision 555bf309
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
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
15# Figure out what system we are running on
16if [ -f /etc/lsb-release ];then
17    . /etc/lsb-release
18elif [ -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`
24fi
25
26# Do initial setup for the system
27if [ $DISTRIB_ID == "Ubuntu" ]; then
28    # Fix grub-pc on Virtualbox with Ubuntu
29    export DEBIAN_FRONTEND=noninteractive
30
31    # Standard update + upgrade dance
32    apt-get update
33    apt-get upgrade -y
34
35    # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
36
37    update-alternatives --install /bin/sh sh /bin/bash 100
38
39    # Install useful but non-mandatory tools
40    apt-get install -y emacs  git-review gdb gdbserver
41elif [ $DISTRIB_ID == "CentOS" ]; then
42    # Standard update + upgrade dance
43    yum check-update
44    yum update -y
45fi