interface: fix check in set_interface_name api
[vpp.git] / extras / vagrant / update.sh
1 #!/usr/bin/env 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 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')
18 fi
19
20 # Do initial setup for the system
21 if [ "$OS_ID" == "ubuntu" ]; then
22
23     export DEBIAN_PRIORITY=critical
24     export DEBIAN_FRONTEND=noninteractive
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\""
27
28     # Standard update + upgrade dance
29     apt-get update ${APT_OPTS} >/dev/null
30     apt-get upgrade ${APT_OPTS} >/dev/null
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
37     apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3
38 elif [ "$OS_ID" == "centos" ]; then
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
44     # Standard update + upgrade dance
45     yum check-update
46     yum update -y
47 fi