forked from rgl/xfce-desktop-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-xrdp.sh
46 lines (40 loc) · 1.32 KB
/
provision-xrdp.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
#!/bin/bash
set -eux
# install.
apt-get install -y xrdp
# copy the logo.
install /vagrant/xrdp-xfce-logo.bmp /usr/local/share/xrdp-xfce-logo.bmp
# configure.
# TODO switch to https://github.com/DiffSK/configobj/milestone/5 once 5.1.0 is released (it can handle ";" comments).
python3 <<'EOF'
sections = []
with open('/etc/xrdp/xrdp.ini', 'r') as f:
section = []
for l in f:
line = l.rstrip()
if line.startswith('['):
if section:
sections.append(section)
section = []
section.append(line)
if section:
sections.append(section)
with open('/etc/xrdp/xrdp.ini', 'w') as f:
for section in sections:
write_section = True
if section[0] == '[Globals]':
for n, line in enumerate(section):
if line.startswith('ls_logo_filename='):
section[n] = 'ls_logo_filename=/usr/local/share/xrdp-xfce-logo.bmp'
for line in section:
# only show the Xorg session option.
if line.startswith('name=') and line != 'name=Xorg':
write_section = False
break
if write_section:
for line in section:
f.write(line)
f.write("\n")
EOF
# restart the service to apply the new configuration.
systemctl restart xrdp