CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/vagrant/initvagrant-desktop.sh
Views: 1798
1
#!/usr/bin/env bash
2
echo "---------- $0 start ----------"
3
4
set -e
5
set -x
6
7
/vagrant/Tools/vagrant/initvagrant.sh
8
9
VAGRANT_USER=ubuntu
10
if [ -e /home/vagrant ]; then
11
# prefer vagrant user
12
VAGRANT_USER=vagrant
13
fi
14
15
apt-get update
16
17
RELEASE_CODENAME=$(lsb_release -c -s)
18
19
PACKAGES="ubuntu-desktop"
20
if [ ${RELEASE_CODENAME} == 'jammy' ]; then
21
PACKAGES="$PACKAGES dbus-x11"
22
fi
23
24
apt-get install -y $PACKAGES
25
26
GDB_CONF="/etc/gdm3/custom.conf"
27
perl -pe 's/# AutomaticLoginEnable = true/AutomaticLoginEnable = true/' -i "$GDB_CONF"
28
perl -pe 's/# AutomaticLogin = user1/AutomaticLogin = vagrant/' -i "$GDB_CONF"
29
30
cat >>/etc/xdg/autostart/open-gnome-terminal.desktop <<EOF
31
[Desktop Entry]
32
Type=Application
33
Name=Start gnome terminal
34
TryExec=gnome-terminal
35
Exec=gnome-terminal
36
37
X-GNOME-Autostart-Phase=Application
38
EOF
39
40
# disable the screensaver:
41
sudo -u "$VAGRANT_USER" dbus-launch gsettings set org.gnome.desktop.session idle-delay 0
42
43
# don't show the initial setup crap:
44
sudo -u "$VAGRANT_USER" mkdir -p /home/"$VAGRANT_USER"/.config
45
echo "yes" | sudo -u "$VAGRANT_USER" dd of=/home/"$VAGRANT_USER"/.config/gnome-initial-setup-done
46
47
# sssd is missing config:
48
if [ ${RELEASE_CODENAME} == 'jammy' ]; then
49
systemctl disable sssd
50
fi
51
52
# start the graphical environment right now:
53
systemctl isolate graphical.target
54
55
echo "---------- $0 end ----------"
56
57