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 |
| 27 | echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections |
| 28 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 29 | apt-get -y --no-install-recommends install \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 30 | avahi-daemon \ |
| 31 | bridge-utils \ |
| 32 | git \ |
| 33 | git-review \ |
| 34 | htop \ |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 35 | oracle-java8-installer \ |
| 36 | oracle-java8-set-default \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 37 | python2.7 \ |
| 38 | python2.7-dev \ |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 39 | valgrind \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 40 | zip unzip \ |
| 41 | tcpdump \ |
| 42 | vlan \ |
| 43 | ntp \ |
| 44 | vim nano emacs \ |
| 45 | |
| 46 | |
| 47 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py |
| 48 | python2.7 get-pip.py --force-reinstall |
| 49 | rm -f get-pip.py |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 50 | |
| 51 | tee -a /etc/ssh/sshd_config <<EOF |
| 52 | |
| 53 | UseDNS no |
| 54 | EOF |
| 55 | |
| 56 | su sdn <<'EOF' |
| 57 | cd /home/sdn |
| 58 | bash /vagrant/user-bootstrap.sh |
| 59 | EOF |