forked from metomi/metomi-vms
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-desktop.sh
executable file
·58 lines (58 loc) · 3.08 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
#### Install the LXDE desktop
sudo -u $(logname) mkdir -p /home/vagrant/Desktop
if [[ $dist == ubuntu ]]; then
apt-get install -q -y lxde xinput || error
apt-get remove -q -y --auto-remove --purge xscreensaver xscreensaver-data gnome-keyring || error
apt-get remove -q -y --auto-remove --purge gnome-screensaver lxlock light-locker network-manager-gnome gnome-online-accounts || error
# Set language
update-locale LANG=en_GB.utf8 || {
# have an error updating the locale - need to generate first
locale-gen "en_GB.utf8" || error
dpkg-reconfigure --frontend=noninteractive locales || error
update-locale LANG=en_GB.utf8 || error
}
# Set UK keyboard
perl -pi -e 's/XKBLAYOUT="us"/XKBLAYOUT="gb"/;' /etc/default/keyboard
# Create a desktop shortcut
sudo -u $(logname) cp /usr/share/applications/lxterminal.desktop /home/vagrant/Desktop
elif [[ $dist == redhat ]]; then
yum install -y @lxde-desktop @base-x || error
yum remove -y gnome-keyring xscreensaver-base || error
systemctl set-default graphical.target || error
# Set UK keyboard
localectl set-x11-keymap gb || error
fi
# Enable auto login
if [[ $dist == ubuntu ]]; 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 $(logname) dos2unix -n /vagrant/home/Desktop/docs.desktop /home/vagrant/Desktop/docs.desktop
# Open a terminal on startup
sudo -u $(logname) mkdir -p /home/vagrant/.config/autostart
sudo -u $(logname) cp /usr/share/applications/lxterminal.desktop /home/vagrant/.config/autostart
# Configure middle button emulation
if [[ $dist == ubuntu && $release == 1804 ]]; then
sudo -u $(logname) bash -c 'echo "[Desktop Entry]" >/home/vagrant/.config/autostart/xinput.desktop'
sudo -u $(logname) 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
sudo -u $(logname) mkdir -p /home/vagrant/.config/clipit
sudo -u $(logname) bash -c 'echo "[rc]" >/home/vagrant/.config/clipit/clipitrc'
sudo -u $(logname) bash -c 'echo "offline_mode=false" >>/home/vagrant/.config/clipit/clipitrc'
# Setup desktop background colour
if [[ $dist == ubuntu ]]; then
sudo -u $(logname) mkdir -p /home/vagrant/.config/pcmanfm/LXDE
sudo -u $(logname) bash -c 'echo "[*]" >/home/vagrant/.config/pcmanfm/LXDE/desktop-items-0.conf'
sudo -u $(logname) bash -c 'echo "desktop_bg=#2f4266" >>/home/vagrant/.config/pcmanfm/LXDE/desktop-items-0.conf'
fi
if [[ $dist == ubuntu && $release == 2204 ]]; then
sudo -u $(logname) mkdir -p /home/vagrant/.config/libfm
sudo -u $(logname) bash -c 'echo "[config]" >/home/vagrant/.config/libfm/libfm.conf'
sudo -u $(logname) bash -c 'echo "quick_exec=1" >>/home/vagrant/.config/libfm/libfm.conf'
fi