forked from metomi/metomi-vms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-desktop.sh
executable file
·72 lines (72 loc) · 3.6 KB
/
install-desktop.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#### Install the LXDE desktop
sudo -u vagrant mkdir -p /home/vagrant/Desktop
if [[ $dist == ubuntu ]]; then
if [[ $release == 1404 ]]; then
apt-get install -q -y lightdm-gtk-greeter xorg lxde
elif [[ $release == 1604 ]]; then
apt-get install -q -y xorg lxdm lxde lxsession-logout
else
apt-get install -q -y lxde xinput
fi
apt-get remove -q -y --auto-remove --purge xscreensaver xscreensaver-data gnome-keyring
if [[ $release == 1804 ]]; then
apt-get remove -q -y --auto-remove --purge gnome-screensaver lxlock light-locker network-manager-gnome gnome-online-accounts
fi
# Set language
if [[ $release == 1404 ]]; then
apt-get install -q -y language-pack-en
fi
update-locale LANG=en_GB.utf8
# Set UK keyboard
perl -pi -e 's/XKBLAYOUT="us"/XKBLAYOUT="gb"/;' /etc/default/keyboard
if [[ $release == 1404 ]]; then
# Move panel to top (works better when resizing the screen)
perl -pi -e 's/edge=bottom/edge=top/;' /usr/share/lxpanel/profile/LXDE/panels/panel
fi
# Create a desktop shortcut
sudo -u vagrant cp /usr/share/applications/lxterminal.desktop /home/vagrant/Desktop
if [[ $release == 1404 ]]; then
# Allow shutdown to work (https://tracker.zentyal.org/issues/360)
echo "session required pam_systemd.so" >> /etc/pam.d/lxdm
fi
elif [[ $dist == redhat ]]; then
yum install -y @lxde-desktop @base-x
yum remove -y gnome-keyring xscreensaver-base
systemctl set-default graphical.target
# Set UK keyboard
localectl set-x11-keymap gb
fi
# Enable auto login
if [[ $dist == ubuntu && $release == 1804 ]]; then
echo "[SeatDefaults]" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf
echo "user-session=LXDE" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf
echo "autologin-user=vagrant" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf
echo "autologin-user-timeout=0" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf
else
perl -pi -e 's/^.*autologin=.*$/autologin=vagrant/;' /etc/lxdm/lxdm.conf
fi
# Create a desktop shortcut to the local documentation
sudo -u vagrant dos2unix -n /vagrant/home/Desktop/docs.desktop /home/vagrant/Desktop/docs.desktop
# Open a terminal on startup
sudo -u vagrant mkdir -p /home/vagrant/.config/autostart
sudo -u vagrant cp /usr/share/applications/lxterminal.desktop /home/vagrant/.config/autostart
# Configure middle button emulation
if [[ $dist == ubuntu && $release == 1604 ]]; then
sudo -u vagrant bash -c 'echo "[Desktop Entry]" >/home/vagrant/.config/autostart/xinput.desktop'
sudo -u vagrant bash -c 'echo "Exec=xinput set-prop 11 \"Evdev Middle Button Emulation\" 1" >>/home/vagrant/.config/autostart/xinput.desktop'
elif [[ ($dist == ubuntu && $release == 1804) || ($dist == redhat && $release == fedora*) ]]; then
sudo -u vagrant bash -c 'echo "[Desktop Entry]" >/home/vagrant/.config/autostart/xinput.desktop'
sudo -u vagrant bash -c 'echo "Exec=xinput set-prop 11 \"libinput Middle Emulation Enabled\" 1" >>/home/vagrant/.config/autostart/xinput.desktop'
fi
# Prevent prompt from clipit on first use
if [[ $dist == redhat || ($dist == ubuntu && $release != 1404) ]]; then
sudo -u vagrant mkdir -p /home/vagrant/.config/clipit
sudo -u vagrant bash -c 'echo "[rc]" >/home/vagrant/.config/clipit/clipitrc'
sudo -u vagrant bash -c 'echo "offline_mode=false" >>/home/vagrant/.config/clipit/clipitrc'
fi
# Setup desktop background colour
if [[ $dist == ubuntu && $release == 1804 ]]; then
sudo -u vagrant mkdir -p /home/vagrant/.config/pcmanfm/LXDE
sudo -u vagrant bash -c 'echo "[*]" >/home/vagrant/.config/pcmanfm/LXDE/desktop-items-0.conf'
sudo -u vagrant bash -c 'echo "desktop_bg=#2f4266" >>/home/vagrant/.config/pcmanfm/LXDE/desktop-items-0.conf'
fi