#!/bin/bash # # Copyright © 2018 Mike Gabriel # Copyright © 2012 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranties of # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # Author: Mike Gabriel # Author lightdm-remote-session-freerdp (where we forked from): Ted Gould # socket="$HOME/.freerdp2-socket"; if [ -e "$socket" ]; then AUTH_INFO="$(socat unix-connect:"$socket" -)" AUTH_INFO_USER=$(echo "$AUTH_INFO" | awk '{ print $1 }') AUTH_INFO_PASSWORD=$(echo "$AUTH_INFO" | awk '{ print $2 }') AUTH_INFO_DOMAIN=$(echo "$AUTH_INFO" | awk '{ print $3 }') AUTH_INFO_HOST=$(echo "$AUTH_INFO" | awk '{ print $4 }') # FIXME: it seems, pulseaudio is not startet at this point for the guest user # However, launching it here with pulseaudio -D feels wrong in the age of systemd # give the RDP server a little bit of time to recover from libpam-freerdp2's freerdp2-auth-check test connect. sleep 1 # FIXME: get audio working... add /sound:sys:pulse to xfreerdp cmdline args... ( echo "$AUTH_INFO_PASSWORD" | /usr/bin/xfreerdp /f \ /v:"${AUTH_INFO_HOST}" \ /u:"${AUTH_INFO_USER}" \ /d:"${AUTH_INFO_DOMAIN}" \ /from-stdin \ -toggle-fullscreen \ \ | logger -t lightdm-remote-session-freerdp2 -- \ & unset AUTH_INFO_PASSWORD # wait for another second to give the xfreerdp process to settle in process list sleep 1 USERID=$(id -u) wait $(pgrep -u ${USERID} xfreerdp # FIXME: possibly stop pulseaudio here with -k again (we have seen permissioned denied warnings, when doing this. Better approaches?) else zenity --warning --text="Unable to locate FreeRDP socket" fi; rm -f "$socket"