I have been meaning to try this out at work, which hasn't quite happened yet, but in the meantime thought I would take a second pass over the current install.sh and provide some comments.
My overruliing thoughts though are why don't you just add an xdrp-hyperV binary package to xrdp provided the debian maintainers agree with that. You would need a FFe to sync into Ubuntu 18.04 but shouldnt be a problem as a NEW binary.
if [ -f /var/run/reboot-required ]; then
echo "A reboot is required in order to proceed with the install." >&2
echo "Please reboot and re-run this script to finish the install." >&2
exit 1
fi
Why are you forcing a reboot mid-install, I don't see anything that requires it and even if it was a kernel (which isnt anymore) you would probably get away with it! Just tell them to reboot at the end, as you do.
Configure the installed XRDP ini files.
# use vsock transport.
sed -i_orig -e 's/use_vsock=false/use_vsock=true/g' /etc/xrdp/xrdp.ini
...
You really shouldn't patch files that don't belong to you. Keeping in mind that they will show as user edits and next time the maintainers make a change to the conffile, the user will be prompted if they want to keep their own changes or not (which they never made!). Probably use dpkg-divert of update-alternatives instead, and then unroll in an uninstall script
# Blacklist the vmw module
cat /etc/modprobe.d/blacklist.conf | grep vmw_vsock_vmci_transport > /dev/null
if [ "$?" == "1" ]; then
bash -c 'echo "blacklist vmw_vsock_vmci_transport" >> /etc/modprobe.d/blacklist.conf <<EOF
EOF'
fi
You could just use your own file here, rather patching someone elses!
# Ensure hv_sock gets loaded
cat /etc/modules | grep hv_sock > /dev/null
if [ "$?" == "1" ]; then
bash -c 'echo "hv_sock" >> /etc/modules <<EOF
EOF'
fi
Likewise, put your own file in /etc/modules-load.d
systemctl stop xrdp
systemctl stop xrdp-sesman
# Enable the hv_sock module
rmmod vmw_vsock_vmci_transport
rmmod vsock
modprobe hv_sock
# reconfigure the service
systemctl daemon-reload
systemctl start xrdp
Do these actually suffice to keep a running X session that works in enhanced session mode without a reboot? I would be surprised if they did, and if not probably mostly redundant and can be removed. as they will be dealt with on reboot.
# Install Gmone Tweak
apt-get install gnome-tweak-tool -y
That should be gnome-tweaks, gnome-tweak-tool is a transitional package in bionic. Although I do question why you are installing gnome-tweak-tool? how is it related to your enhanced session mode?
Lastly and somewhat off-topic, if you really want to compete with VMWare you are going to need OpenGL acceleration, it makes a huge difference for gnome-shell which is used in ubuntu since 17.10. Short of implementing full virtual gpu drivers like vmware and virtualbox do, VirtualGL seems to be the stopgap there.