Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Installs Lubuntu desktop and code editors. |
| 4 | # Largely inspired by the P4.org tutorial VM scripts: |
| 5 | # https://github.com/p4lang/tutorials/ |
| 6 | |
| 7 | set -xe |
| 8 | |
| 9 | sudo add-apt-repository ppa:webupd8team/sublime-text-3 -y |
| 10 | sudo add-apt-repository ppa:webupd8team/atom -y |
| 11 | sudo apt-get update |
| 12 | |
| 13 | sudo DEBIAN_FRONTEND=noninteractive apt-get -y install wireshark |
| 14 | echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections |
| 15 | sudo DEBIAN_FRONTEND=noninteractive dpkg-reconfigure wireshark-common |
| 16 | |
| 17 | sudo apt-get -y --no-install-recommends install \ |
| 18 | lubuntu-desktop \ |
| 19 | atom \ |
| 20 | sublime-text-installer \ |
| 21 | vim \ |
| 22 | wget |
| 23 | |
| 24 | # Disable screensaver |
| 25 | sudo apt-get -y remove light-locker |
| 26 | |
| 27 | # Automatically log into the SDN user |
| 28 | cat << EOF | sudo tee -a /etc/lightdm/lightdm.conf.d/10-lightdm.conf |
| 29 | [SeatDefaults] |
| 30 | autologin-user=sdn |
| 31 | autologin-user-timeout=0 |
| 32 | user-session=Lubuntu |
| 33 | EOF |
| 34 | |
| 35 | # Vim |
| 36 | cd /home/sdn |
| 37 | mkdir -p .vim |
| 38 | mkdir -p .vim/ftdetect |
| 39 | mkdir -p .vim/syntax |
| 40 | echo "au BufRead,BufNewFile *.p4 set filetype=p4" >> .vim/ftdetect/p4.vim |
| 41 | echo "set bg=dark" >> .vimrc |
| 42 | wget https://raw.githubusercontent.com/p4lang/tutorials/master/P4D2_2018_East/vm/p4.vim |
| 43 | mv p4.vim .vim/syntax/p4.vim |
| 44 | |
| 45 | # Sublime |
| 46 | cd /home/sdn |
| 47 | mkdir -p ~/.config/sublime-text-3/Packages/ |
| 48 | cd .config/sublime-text-3/Packages/ |
| 49 | git clone https://github.com/c3m3gyanesh/p4-syntax-highlighter.git |
| 50 | |
| 51 | # Atom |
| 52 | apm install language-p4 |
| 53 | |
| 54 | # Adding Desktop icons |
| 55 | DESKTOP=/home/sdn/Desktop |
| 56 | mkdir -p ${DESKTOP} |
| 57 | |
| 58 | cat > ${DESKTOP}/Terminal << EOF |
| 59 | [Desktop Entry] |
| 60 | Encoding=UTF-8 |
| 61 | Type=Application |
| 62 | Name=Terminal |
| 63 | Name[en_US]=Terminal |
| 64 | Icon=konsole |
| 65 | Exec=/usr/bin/x-terminal-emulator |
| 66 | Comment[en_US]= |
| 67 | EOF |
| 68 | |
| 69 | cat > ${DESKTOP}/Wireshark << EOF |
| 70 | [Desktop Entry] |
| 71 | Encoding=UTF-8 |
| 72 | Type=Application |
| 73 | Name=Wireshark |
| 74 | Name[en_US]=Wireshark |
| 75 | Icon=wireshark |
| 76 | Exec=/usr/bin/wireshark |
| 77 | Comment[en_US]= |
| 78 | EOF |
| 79 | |
| 80 | cat > ${DESKTOP}/Sublime\ Text << EOF |
| 81 | [Desktop Entry] |
| 82 | Encoding=UTF-8 |
| 83 | Type=Application |
| 84 | Name=Sublime Text |
| 85 | Name[en_US]=Sublime Text |
| 86 | Icon=sublime-text |
| 87 | Exec=/opt/sublime_text/sublime_text |
| 88 | Comment[en_US]= |
| 89 | EOF |
| 90 | |
| 91 | cat > ${DESKTOP}/Atom << EOF |
| 92 | [Desktop Entry] |
| 93 | Encoding=UTF-8 |
| 94 | Type=Application |
| 95 | Name=Atom |
| 96 | Name[en_US]=Atom |
| 97 | Icon=atom |
| 98 | Exec=/usr/bin/atom |
| 99 | Comment[en_US]= |
| 100 | EOF |