Skip to content

Commit ecf4f44

Browse files
author
Yutaro-B18016
authored
Merge pull request #8 from Yutaro-B18016:Add-install.sh-for-Linux-Mint-20-Cinnamon
Add install.sh for Linux Mint 20 Cinnamon
2 parents 92e4845 + ff666d3 commit ecf4f44

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

linuxmint/20/cinnamon/install.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/bash
2+
3+
#
4+
# This script is for Linux Mint 20 Ulyana Cinnamon Edition to install and
5+
# configure xrdp to be used with Hyper-V's Enhanced Mode.
6+
#
7+
#
8+
9+
###############################################################################
10+
# Use HWE kernel packages
11+
#
12+
HWE=""
13+
14+
###############################################################################
15+
# Update our machine to the latest code if we need to.
16+
#
17+
18+
if [ "$(id -u)" -ne 0 ]; then
19+
echo 'This script must be run with root privileges' >&2
20+
exit 1
21+
fi
22+
23+
apt update && apt upgrade -y
24+
25+
if [ -f /var/run/reboot-required ]; then
26+
echo "A reboot is required in order to proceed with the install." >&2
27+
echo "Please reboot and re-run this script to finish the install." >&2
28+
exit 1
29+
fi
30+
31+
###############################################################################
32+
# XRDP
33+
#
34+
35+
# Install hv_kvp utils
36+
apt install -y linux-tools-virtual${HWE}
37+
apt install -y linux-cloud-tools-virtual${HWE}
38+
39+
# Install the xrdp service so we have the auto start behavior
40+
apt install -y xrdp
41+
42+
systemctl stop xrdp
43+
systemctl stop xrdp-sesman
44+
45+
# Configure the installed XRDP ini files.
46+
# use vsock transport.
47+
sed -i_orig -e 's/port=3389/port=vsock://-1:3389/g' /etc/xrdp/xrdp.ini
48+
# use rdp security.
49+
sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini
50+
# remove encryption validation.
51+
sed -i_orig -e 's/crypt_level=high/crypt_level=none/g' /etc/xrdp/xrdp.ini
52+
# disable bitmap compression since its local its much faster
53+
sed -i_orig -e 's/bitmap_compression=true/bitmap_compression=false/g' /etc/xrdp/xrdp.ini
54+
55+
# Add script to setup the ubuntu session properly
56+
if [ ! -e /etc/xrdp/startcinnamon.sh ]; then
57+
cat >>/etc/xrdp/startcinnamon.sh <<EOF
58+
#!/bin/sh
59+
export XDG_CURRENT_DESKTOP=X-Cinnamon
60+
export XDG_SESSION_DESKTOP=cinnamon
61+
export XDG_DATA_DIRS=/usr/share/cinnamon:/usr/share/gnome:/usr/local/share:/usr/share:/usr/share
62+
export XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg
63+
exec /etc/xrdp/startwm.sh
64+
EOF
65+
chmod a+x /etc/xrdp/startcinnamon.sh
66+
fi
67+
68+
# use the script to setup the ubuntu session
69+
sed -i_orig -e 's/startwm/startcinnamon/g' /etc/xrdp/sesman.ini
70+
71+
# rename the redirected drives to 'shared-drives'
72+
sed -i -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini
73+
74+
# Changed the allowed_users
75+
sed -i_orig -e 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
76+
77+
# Blacklist the vmw module
78+
if [ ! -e /etc/modprobe.d/blacklist_vmw_vsock_vmci_transport.conf ]; then
79+
cat >>/etc/modprobe.d/blacklist_vmw_vsock_vmci_transport.conf <<EOF
80+
blacklist vmw_vsock_vmci_transport
81+
EOF
82+
fi
83+
84+
#Ensure hv_sock gets loaded
85+
if [ ! -e /etc/modules-load.d/hv_sock.conf ]; then
86+
echo "hv_sock" >/etc/modules-load.d/hv_sock.conf
87+
fi
88+
89+
# Configure the policy xrdp session
90+
cat >/etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla <<EOF
91+
[Allow Colord all Users]
92+
Identity=unix-user:*
93+
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
94+
ResultAny=no
95+
ResultInactive=no
96+
ResultActive=yes
97+
EOF
98+
99+
# reconfigure the service
100+
systemctl daemon-reload
101+
systemctl start xrdp
102+
103+
#
104+
# End XRDP
105+
###############################################################################
106+
107+
echo "Install is complete."
108+
echo "Reboot your machine to begin using XRDP."

0 commit comments

Comments
 (0)