Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -xe |
| 3 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 4 | VM_TYPE=${1:-dev} |
| 5 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 6 | # Create user sdn |
| 7 | useradd -m -d /home/sdn -s /bin/bash sdn |
| 8 | echo "sdn:rocks" | chpasswd |
| 9 | echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn |
| 10 | chmod 440 /etc/sudoers.d/99_sdn |
| 11 | usermod -aG vboxsf sdn |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 12 | update-locale LC_ALL="en_US.UTF-8" |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 13 | |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 14 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 15 | if [ ${VM_TYPE} = "tutorial" ] |
| 16 | then |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 17 | su sdn <<'EOF' |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 18 | cd /home/sdn |
| 19 | bash /vagrant/tutorial-bootstrap.sh |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 20 | EOF |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 21 | fi |
| 22 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 23 | # Java 8 |
| 24 | apt-get install software-properties-common -y |
| 25 | add-apt-repository ppa:webupd8team/java -y |
| 26 | apt-get update |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 27 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 28 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade |
| 29 | |
| 30 | echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 31 | apt-get -y --no-install-recommends install \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 32 | avahi-daemon \ |
| 33 | bridge-utils \ |
| 34 | git \ |
| 35 | git-review \ |
| 36 | htop \ |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 37 | oracle-java8-installer \ |
| 38 | oracle-java8-set-default \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 39 | python2.7 \ |
| 40 | python2.7-dev \ |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 41 | valgrind \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 42 | zip unzip \ |
| 43 | tcpdump \ |
| 44 | vlan \ |
| 45 | ntp \ |
| 46 | vim nano emacs \ |
| 47 | |
| 48 | |
| 49 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py |
| 50 | python2.7 get-pip.py --force-reinstall |
| 51 | rm -f get-pip.py |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 52 | |
| 53 | tee -a /etc/ssh/sshd_config <<EOF |
| 54 | |
| 55 | UseDNS no |
| 56 | EOF |
| 57 | |
| 58 | su sdn <<'EOF' |
| 59 | cd /home/sdn |
| 60 | bash /vagrant/user-bootstrap.sh |
| 61 | EOF |