-
Notifications
You must be signed in to change notification settings - Fork 1
/
ubuntu.sh
61 lines (56 loc) · 1.9 KB
/
ubuntu.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
#!/usr/bin/env bash
set -ex
export DEBIAN_FRONTEND=noninteractive
apt_wait () {{
while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
sleep 1
done
while sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do
sleep 1
done
if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then
while sudo fuser /var/log/unattended-upgrades/unattended-upgrades.log >/dev/null 2>&1 ; do
sleep 1
done
fi
}}
install_xfce (){{
apt-get install -y supervisor xfce4 xfce4-terminal xterm xclip
}}
install_kasmvnc (){{
cd /tmp
KASM_VNC_PATH=/usr/share/kasmvnc
BUILD_URL="https://github.com/kasmtech/KasmVNC/releases/download/v1.2.0/kasmvncserver_focal_1.2.0_amd64.deb"
KASM_VNC_PASSWD={connection_password}
KASM_VNC_USER={connection_username}
wget "$BUILD_URL" -O kasmvncserver.deb
apt-get install -y gettext ssl-cert libxfont2
apt-get install -y /tmp/kasmvncserver.deb
rm -f /tmp/kasmvncserver.deb
ln -s $KASM_VNC_PATH/www/index.html $KASM_VNC_PATH/www/vnc.html
cd /tmp
mkdir -p $KASM_VNC_PATH/www/Downloads
chown -R 0:0 $KASM_VNC_PATH
chmod -R og-w $KASM_VNC_PATH
chown -R 1000:0 $KASM_VNC_PATH/www/Downloads
echo -e "$KASM_VNC_PASSWD\n$KASM_VNC_PASSWD\n" | kasmvncpasswd -u $KASM_VNC_USER -w "/home/$KASM_VNC_USER/.kasmpasswd"
chown -R 1000:0 "/home/$KASM_VNC_USER/.kasmpasswd"
addgroup $KASM_VNC_USER ssl-cert
su -l -c 'vncserver -select-de XFCE' $KASM_VNC_USER
}}
install_tigervnc (){{
apt-get install -y tigervnc-standalone-server
mkdir /home/ubuntu/.vnc
echo "password123abc" | vncpasswd -f > /home/ubuntu/.vnc/passwd
echo -e "#!/bin/sh\nunset SESSION_MANAGER\nunset DBUS_SESSION_BUS_ADDRESS\nexec startxfce4" >> /home/ubuntu/.vnc/xstartup
chown -R ubuntu:ubuntu /home/ubuntu/.vnc
chmod 0600 /home/ubuntu/.vnc/passwd
su -l -c 'vncserver -localhost no' ubuntu
}}
apt_wait
sleep 10
apt_wait
apt-get update
install_xfce
install_kasmvnc
#install_tigervnc