blob: dfbfd46c96e2f28196affe432060d8d9391985fa [file] [log] [blame]
Carmelo Casconed6615072017-12-15 00:53:43 -08001#!/bin/bash
2set -xe
3
Carmelo Casconec5569c22018-04-18 10:09:15 +09004VM_TYPE=${1:-dev}
5
Carmelo Casconed6615072017-12-15 00:53:43 -08006# Create user sdn
7useradd -m -d /home/sdn -s /bin/bash sdn
8echo "sdn:rocks" | chpasswd
9echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn
10chmod 440 /etc/sudoers.d/99_sdn
11usermod -aG vboxsf sdn
Carmelo Casconef11513d2018-01-16 00:31:14 -080012update-locale LC_ALL="en_US.UTF-8"
Carmelo Casconed6615072017-12-15 00:53:43 -080013
Carmelo Casconec5569c22018-04-18 10:09:15 +090014if [ ${VM_TYPE} = "tutorial" ]
15then
16 cp /vagrant/tutorial-bootstrap.sh /home/sdn/tutorial.sh
17 sudo chown sdn:sdn /home/sdn/tutorial.sh
18 su sdn <<'EOF'
19bash /home/sdn/tutorial.sh
20EOF
21 rm -rf /home/sdn/tutorial.sh
22fi
23
Carmelo Casconed6615072017-12-15 00:53:43 -080024# Java 8
25apt-get install software-properties-common -y
26add-apt-repository ppa:webupd8team/java -y
27apt-get update
28echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
29
Carmelo Casconec5569c22018-04-18 10:09:15 +090030# Workaround to: https://stackoverflow.com/questions/46815897/jdk-8-is-not-installed-error-404-not-found
31set +e
32apt-get install -y oracle-java8-installer
33set -e
34sed -i 's|JAVA_VERSION=8u161|JAVA_VERSION=8u171|' /var/lib/dpkg/info/oracle-java8-installer.*
35sed -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.*
36sed -i 's|SHA256SUM_TGZ="6dbc56a0e3310b69e91bb64db63a485bd7b6a8083f08e48047276380a0e2021e"|SHA256SUM_TGZ="b6dd2837efaaec4109b36cfbb94a774db100029f98b0d78be68c27bec0275982"|' /var/lib/dpkg/info/oracle-java8-installer.*
37sed -i 's|J_DIR=jdk1.8.0_161|J_DIR=jdk1.8.0_171|' /var/lib/dpkg/info/oracle-java8-installer.*
38
39apt-get -y --no-install-recommends install \
40 oracle-java8-installer \
41 oracle-java8-set-default \
Carmelo Casconed6615072017-12-15 00:53:43 -080042 zip unzip \
Carmelo Casconef11513d2018-01-16 00:31:14 -080043 bridge-utils \
44 avahi-daemon \
45 htop \
46 valgrind \
47 git-review
Carmelo Casconed6615072017-12-15 00:53:43 -080048
49tee -a /etc/ssh/sshd_config <<EOF
50
51UseDNS no
52EOF
53
54su sdn <<'EOF'
55cd /home/sdn
56bash /vagrant/user-bootstrap.sh
57EOF