From ac50616e57d9aeb6e33ca5c2331d8a02e30d643c Mon Sep 17 00:00:00 2001 From: Boris Bopp Date: Wed, 21 Mar 2018 10:39:50 +0100 Subject: [PATCH 1/2] Add support for Arch Linux --- arch/inc/build.sh | 31 ++++++++++++++++++ arch/inc/config-xrdp.sh | 70 +++++++++++++++++++++++++++++++++++++++++ arch/install.sh | 32 +++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100755 arch/inc/build.sh create mode 100755 arch/inc/config-xrdp.sh create mode 100755 arch/install.sh diff --git a/arch/inc/build.sh b/arch/inc/build.sh new file mode 100755 index 0000000..6cd0720 --- /dev/null +++ b/arch/inc/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Do not run this script directly, it gets executed by install.sh. +# + +if [ $(id -u) -eq 0 ] ; then + echo 'This script must be run as a non-root user, as building packages as root is unsupported.' >&2 + exit 1 +fi + +# Create a build directory in tmpfs +mkdir /tmp/build && cd "$_" + +############################################################################### +# XRDP +# +( + git clone https://aur.archlinux.org/xrdp.git + cd xrdp + makepkg -sri --noconfirm +) +############################################################################### +# XORGXRDP +# Devel version, because release version includes a bug crashing gnome-settings-daemon +( + git clone https://aur.archlinux.org/xorgxrdp-devel-git.git + cd xorgxrdp-devel-git + makepkg -sri --noconfirm +) +############################################################################### + diff --git a/arch/inc/config-xrdp.sh b/arch/inc/config-xrdp.sh new file mode 100755 index 0000000..76c0442 --- /dev/null +++ b/arch/inc/config-xrdp.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# Do not run this script directly, it gets executed by install.sh. +# +# The configuration is adapted from the Ubuntu 16.04 script. +# + +if [ $(id -u) -ne 0 ] ; then + echo 'This script must be run with root privileges' >&2 + exit 1 +fi + +############################################################################### +# XRDP +# + +systemctl enable xrdp +systemctl enable xrdp-sesman + +# 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 +# use rdp security. +sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini +# remove encryption validation. +sed -i_orig -e 's/crypt_level=high/crypt_level=none/g' /etc/xrdp/xrdp.ini +# disable bitmap compression since its local its much faster +sed -i_orig -e 's/bitmap_compression=true/bitmap_compression=false/g' /etc/xrdp/xrdp.ini +# +# sed -n -e 's/max_bpp=32/max_bpp=24/g' /etc/xrdp/xrdp.ini + +# use the default lightdm x display +# sed -i_orig -e 's/X11DisplayOffset=10/X11DisplayOffset=0/g' /etc/xrdp/sesman.ini +# rename the redirected drives to 'shared-drives' +sed -i_orig -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini + +# Change the allowed_users +echo "allowed_users=anybody" > /etc/X11/Xwrapper.config + + +#Ensure hv_sock gets loaded +if [ ! -e /etc/modules-load.d/hv_sock.conf ] ; then + echo "hv_sock" > /etc/modules-load.d/hv_sock.conf +fi + +# Configure the policy xrdp session +cat >/etc/polkit-1/rules.d/02-allow-colord.rules </etc/pam.d/xrdp-sesman <&2 + exit 1 +fi + +############################################################################### +# Prepare by installing build tools. +# +# Partial upgrades aren't supported in arch. +sudo pacman -Syu --needed --noconfirm base base-devel git + +############################################################################### +# Build & Install +bash inc/build.sh +echo "Installation is complete. Beginning configuration..." + +############################################################################### +# Configure +sudo bash inc/config-xrdp.sh +echo "Configuration is complete." + +############################################################################### +# .xinitrc has to be modified manually. +# +echo "You will have to configure .xinitrc to start your windows manager, see https://wiki.archlinux.org/index.php/Xinit" +echo "Reboot your machine to begin using XRDP." From 87201fa488d8cdde84a97c9284c759c31e8597c6 Mon Sep 17 00:00:00 2001 From: Boris Bopp Date: Thu, 29 Mar 2018 12:14:52 +0200 Subject: [PATCH 2/2] Separate makepkg from configuration --- .../{inc/config-xrdp.sh => install-config.sh} | 26 ++++++++++++--- arch/install.sh | 32 ------------------- arch/{inc/build.sh => makepkg.sh} | 8 ++++- 3 files changed, 29 insertions(+), 37 deletions(-) rename arch/{inc/config-xrdp.sh => install-config.sh} (75%) delete mode 100755 arch/install.sh rename arch/{inc/build.sh => makepkg.sh} (72%) diff --git a/arch/inc/config-xrdp.sh b/arch/install-config.sh similarity index 75% rename from arch/inc/config-xrdp.sh rename to arch/install-config.sh index 76c0442..5034a47 100755 --- a/arch/inc/config-xrdp.sh +++ b/arch/install-config.sh @@ -1,6 +1,7 @@ #!/bin/bash + # -# Do not run this script directly, it gets executed by install.sh. +# This script is for Arch Linux to configure XRDP for enhanced session mode # # The configuration is adapted from the Ubuntu 16.04 script. # @@ -10,10 +11,21 @@ if [ $(id -u) -ne 0 ] ; then exit 1 fi -############################################################################### -# XRDP -# +# Use Qi to check for exact package name +if ! pacman -Qi xrdp > /dev/null ; then + echo 'xrdp not installed. Run makepkg.sh first to install xrdp.' >&2 + exit 1 +fi +# Use Qs to allow xorgxrdp-devel-git +if ! pacman -Qs xorgxrdp > /dev/null ; then + echo 'xorgxrdp not installed. Run makepkg.sh first to install xorgxrdp.' >&2 + exit 1 +fi + +############################################################################### +# Configure XRDP +# systemctl enable xrdp systemctl enable xrdp-sesman @@ -68,3 +80,9 @@ password include system-remote-login session include system-remote-login EOF + +############################################################################### +# .xinitrc has to be modified manually. +# +echo "You will have to configure .xinitrc to start your windows manager, see https://wiki.archlinux.org/index.php/Xinit" +echo "Reboot your machine to begin using XRDP." diff --git a/arch/install.sh b/arch/install.sh deleted file mode 100755 index 196b167..0000000 --- a/arch/install.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# -# This script is for Arch Linux to download and install XRDP+XORGXRDP -# - -if [ $(id -u) -eq 0 ] ; then - echo 'This script must be run as a non-root user, as building packages as root is unsupported.' >&2 - exit 1 -fi - -############################################################################### -# Prepare by installing build tools. -# -# Partial upgrades aren't supported in arch. -sudo pacman -Syu --needed --noconfirm base base-devel git - -############################################################################### -# Build & Install -bash inc/build.sh -echo "Installation is complete. Beginning configuration..." - -############################################################################### -# Configure -sudo bash inc/config-xrdp.sh -echo "Configuration is complete." - -############################################################################### -# .xinitrc has to be modified manually. -# -echo "You will have to configure .xinitrc to start your windows manager, see https://wiki.archlinux.org/index.php/Xinit" -echo "Reboot your machine to begin using XRDP." diff --git a/arch/inc/build.sh b/arch/makepkg.sh similarity index 72% rename from arch/inc/build.sh rename to arch/makepkg.sh index 6cd0720..2afd505 100755 --- a/arch/inc/build.sh +++ b/arch/makepkg.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Do not run this script directly, it gets executed by install.sh. +# This script is for Arch Linux to download and install XRDP+XORGXRDP # if [ $(id -u) -eq 0 ] ; then @@ -8,6 +8,12 @@ if [ $(id -u) -eq 0 ] ; then exit 1 fi +############################################################################### +# Prepare by installing build tools. +# +# Partial upgrades aren't supported in arch. +sudo pacman -Syu --needed --noconfirm base base-devel git + # Create a build directory in tmpfs mkdir /tmp/build && cd "$_"