Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 1 | #/bin/bash |
| 2 | # vm-setup.sh |
| 3 | # |
| 4 | # This script installs ONOS dependencies and installs a desktop environment on a Miniet VM. |
| 5 | |
| 6 | ONOS_USER=mininet |
| 7 | ONOS_USER_HOME=/home/${ONOS_USER} |
| 8 | |
| 9 | ECLIPSE_URL=http://ftp.osuosl.org/pub/eclipse//technology/epp/downloads/release/kepler/SR1/eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz |
| 10 | |
| 11 | sudo apt-get update |
| 12 | |
| 13 | # ------------- Install ONOS Dependencies ------------- |
| 14 | #sudo -u ${ONOS_USER} ./install_zookeeper.sh |
| 15 | #sudo -u ${ONOS_USER} ./install_cassandra.sh |
| 16 | #sudo -u ${ONOS_USER} ./install_maven.sh |
| 17 | sudo apt-get install -y maven |
| 18 | |
| 19 | # -------------- Setup Desktop ---------------- |
| 20 | sudo apt-get install -y xorg lxde |
| 21 | |
| 22 | #TODO: add backgrounds folder |
| 23 | #TODO: change background |
| 24 | # Remove wallpaper, change background color, and disable screensaver |
| 25 | sudo sed -i 's/wallpaper_mode=1/wallpaper_mode=0/g' /usr/share/lxde/pcmanfm/LXDE.conf |
| 26 | sudo sed -i 's/desktop_bg=#000000/desktop_bg=#104187/g' /usr/share/lxde/pcmanfm/LXDE.conf |
| 27 | sudo sed -i '/screensaver/d' /etc/xdg/lxsession/LXDE/autostart |
| 28 | |
| 29 | DESKTOP=${ONOS_USER_HOME}/Desktop |
| 30 | |
| 31 | mkdir -p ${DESKTOP} |
| 32 | |
| 33 | cat > ${DESKTOP}/Eclipse << EOF |
| 34 | [Desktop Entry] |
| 35 | Encoding=UTF-8 |
| 36 | Type=Application |
| 37 | Name=Eclipse |
| 38 | Name[en_US]=Eclipse |
| 39 | Icon=/opt/eclipse/icon.xpm |
| 40 | Exec=/usr/bin/eclipse |
| 41 | Comment[en_US]= |
| 42 | EOF |
| 43 | |
| 44 | cat > ${DESKTOP}/Terminal << EOF |
| 45 | [Desktop Entry] |
| 46 | Encoding=UTF-8 |
| 47 | Type=Application |
| 48 | Name=Terminal |
| 49 | Name[en_US]=Terminal |
| 50 | Icon=konsole |
| 51 | Exec=/usr/bin/x-terminal-emulator |
| 52 | Comment[en_US]= |
| 53 | EOF |
| 54 | |
| 55 | cat > ${DESKTOP}/Gerrit << EOF |
| 56 | [Desktop Entry] |
| 57 | Encoding=UTF-8 |
| 58 | Type=Application |
| 59 | Name=ONOS Gerrit |
| 60 | Name[en_US]=ONOS Gerrit |
| 61 | Icon=internet-web-browser |
| 62 | Exec=/usr/bin/chromium-browser http://gerrit.onos.onlab.us |
| 63 | Comment[en_US]= |
| 64 | EOF |
| 65 | |
| 66 | cat > ${DESKTOP}/Docs << EOF |
| 67 | [Desktop Entry] |
| 68 | Encoding=UTF-8 |
| 69 | Type=Application |
| 70 | Name=ONOS Docs |
| 71 | Name[en_US]=ONOS Docs |
| 72 | Icon=internet-web-browser |
| 73 | Exec=/usr/bin/chromium-browser http://docs.onos.onlab.us |
| 74 | Comment[en_US]= |
| 75 | EOF |
| 76 | |
| 77 | cat > ${DESKTOP}/Wireshark << EOF |
| 78 | [Desktop Entry] |
| 79 | Encoding=UTF-8 |
| 80 | Type=Application |
| 81 | Name=Wireshark |
| 82 | Name[en_US]=Wireshark |
| 83 | Icon=wireshark |
| 84 | Exec=/usr/bin/wireshark |
| 85 | Comment[en_US]= |
| 86 | EOF |
| 87 | |
| 88 | # ------------- Install Other Tools ------------- |
| 89 | sudo apt-get install -y wireshark |
| 90 | # Enable root-less wireshark and add mininet |
| 91 | echo "Enabling wireshark group" |
| 92 | echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections |
| 93 | sudo dpkg-reconfigure -f noninteractive wireshark-common |
| 94 | sudo usermod -a -G wireshark mininet |
| 95 | |
| 96 | sudo apt-get install -y git-review |
| 97 | |
| 98 | wget -c -N -O /tmp/eclipse.tar.gz ${ECLIPSE_URL} |
| 99 | tar xzf /tmp/eclipse.tar.gz |
| 100 | sudo mv eclipse /opt |
| 101 | sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse |
| 102 | |
| 103 | # ------------ Change username and hostname --------------- |
| 104 | echo 'mininet:onos' | sudo chpasswd |
| 105 | sudo mv /home/mininet /home/onos |
| 106 | sudo sed -i 's/mininet/onos/g' /etc/group /etc/gshadow /etc/hosts /etc/hostname /etc/passwd /etc/shadow /etc/sudoers |
| 107 | |