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 | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 14 | if [ ${VM_TYPE} = "tutorial" ] |
| 15 | then |
| 16 | cp /vagrant/tutorial-bootstrap.sh /home/sdn/tutorial.sh |
| 17 | sudo chown sdn:sdn /home/sdn/tutorial.sh |
| 18 | su sdn <<'EOF' |
| 19 | bash /home/sdn/tutorial.sh |
| 20 | EOF |
| 21 | rm -rf /home/sdn/tutorial.sh |
| 22 | fi |
| 23 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 24 | # Java 8 |
| 25 | apt-get install software-properties-common -y |
| 26 | add-apt-repository ppa:webupd8team/java -y |
| 27 | apt-get update |
| 28 | echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections |
| 29 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 30 | # Workaround to: https://stackoverflow.com/questions/46815897/jdk-8-is-not-installed-error-404-not-found |
| 31 | set +e |
| 32 | apt-get install -y oracle-java8-installer |
| 33 | set -e |
| 34 | sed -i 's|JAVA_VERSION=8u161|JAVA_VERSION=8u171|' /var/lib/dpkg/info/oracle-java8-installer.* |
| 35 | sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/|' /var/lib/dpkg/info/oracle-java8-installer.* |
| 36 | sed -i 's|SHA256SUM_TGZ="6dbc56a0e3310b69e91bb64db63a485bd7b6a8083f08e48047276380a0e2021e"|SHA256SUM_TGZ="b6dd2837efaaec4109b36cfbb94a774db100029f98b0d78be68c27bec0275982"|' /var/lib/dpkg/info/oracle-java8-installer.* |
| 37 | sed -i 's|J_DIR=jdk1.8.0_161|J_DIR=jdk1.8.0_171|' /var/lib/dpkg/info/oracle-java8-installer.* |
| 38 | |
| 39 | apt-get -y --no-install-recommends install \ |
| 40 | oracle-java8-installer \ |
| 41 | oracle-java8-set-default \ |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 42 | zip unzip \ |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 43 | bridge-utils \ |
| 44 | avahi-daemon \ |
| 45 | htop \ |
| 46 | valgrind \ |
| 47 | git-review |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 48 | |
| 49 | tee -a /etc/ssh/sshd_config <<EOF |
| 50 | |
| 51 | UseDNS no |
| 52 | EOF |
| 53 | |
| 54 | su sdn <<'EOF' |
| 55 | cd /home/sdn |
| 56 | bash /vagrant/user-bootstrap.sh |
| 57 | EOF |