blob: 60767a99995d1a73127847f8c8644c1b5ba8a6de [file] [log] [blame]
#!/bin/bash
# vm-setup.sh
#
# This script installs ONOS dependencies and installs a desktop environment on a Miniet VM.
ONOS_USER=mininet
ONOS_USER_HOME=/home/${ONOS_USER}
sudo apt-get update
# -------------- Bufferbloat Install ----------
cd ~
git clone https://bitbucket.org/huangty/cs144_bufferbloat.git
sudo apt-get -y install screen
sudo apt-get -y install python-matplotlib
# -------------- BGP-attack Install -----------
git clone https://bitbucket.org/jvimal/bgp.git
cd bgp
./install.sh
cd ~
# ------------- DHCP demo Install ------------
git clone https://bitbucket.org/lantz/cs144-dhcp.git
cd cs144-dhcp
# TODO fix this
#sudo ./dhcp.py --check-required
cd ~
# -------------- Offline content -------------
sudo apt-get install -y python-pip
sudo pip install grip
git clone https://github.com/mininet/mininet.wiki.git
cd mininet.wiki
grip --gfm --export Bufferbloat.md
grip --gfm --export Dhcp-masquerade-attack.md
# -------------- Setup Desktop ----------------
sudo apt-get install -y xorg lxde
#TODO: add backgrounds folder
#TODO: change background
# Remove wallpaper, change background color, and disable screensaver
sudo sed -i 's/wallpaper_mode=1/wallpaper_mode=0/g' /usr/share/lxde/pcmanfm/LXDE.conf
sudo sed -i 's/desktop_bg=#000000/desktop_bg=#104187/g' /usr/share/lxde/pcmanfm/LXDE.conf
sudo sed -i '/screensaver/d' /etc/xdg/lxsession/LXDE/autostart
DESKTOP=${ONOS_USER_HOME}/Desktop
mkdir -p ${DESKTOP}
#cat > ${DESKTOP}/Eclipse << EOF
#[Desktop Entry]
#Encoding=UTF-8
#Type=Application
#Name=Eclipse
#Name[en_US]=Eclipse
#Icon=/opt/eclipse/icon.xpm
#Exec=/usr/bin/eclipse
#Comment[en_US]=
#EOF
cat > ${DESKTOP}/Terminal << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Terminal
Name[en_US]=Terminal
Icon=konsole
Exec=/usr/bin/x-terminal-emulator
Comment[en_US]=
EOF
cat > ${DESKTOP}/Bufferbloat << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Bufferbloat (Offline)
Name[en_US]=Bufferbloat
Icon=internet-web-browser
Exec=/usr/bin/chromium-browser file:///home/mininet/mininet.wiki/Bufferbloat.html
Comment[en_US]=
EOF
cat > ${DESKTOP}/Wireshark << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Wireshark
Name[en_US]=Wireshark
Icon=wireshark
Exec=/usr/bin/wireshark
Comment[en_US]=
EOF
# ------------- Install Other Tools -------------
sudo apt-get install -y wireshark
# Enable root-less wireshark and add mininet
echo "Enabling wireshark group"
echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
sudo dpkg-reconfigure -f noninteractive wireshark-common
sudo usermod -a -G wireshark mininet
# ------------- Zero Unused Blocks -------------
#TODO investigate zerofree
echo "Zeroing unused blocks"
dd if=/dev/zero of=tmp-zeros
sync
rm tmp-zeros