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