File: freerdp2-session.in

package info (click to toggle)
lightdm-remote-session-freerdp2 2.0.0-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 152 kB
  • sloc: makefile: 76; sh: 25; ansic: 11
file content (62 lines) | stat: -rwxr-xr-x 2,470 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

#
# Copyright © 2018 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
# 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 <http://www.gnu.org/licenses/>.
#
# Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
# Author lightdm-remote-session-freerdp (where we forked from): Ted Gould <ted@canonical.com>
#

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"