aboutsummaryrefslogtreecommitdiff
path: root/net/linux-remotedesktopmanager/files/linux-remotedesktopmanager.in
blob: b5d2b1ee15a1bed89924efd81fd2af51a83ab9f9 (plain) (blame)
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
#!/bin/sh

find_pulse_socket()
{
	PA_SOCK_PATH=$(sockstat -uw | awk -v me="$(whoami)" -F'[ \t]+' '
		$1 == me && $2 ~ /^(pulseaudio|pipewire)/ && $6 ~ /native/ {
			print $6
			exit 0
		}'
	)
}

# dbus-run-session exports DBUS_SESSION_BUS_ADDRESS to the child, so the
# re-exec cannot loop.
if [ ! "${DBUS_SESSION_BUS_ADDRESS-}" ]; then
	exec %%LOCALBASE%%/bin/dbus-run-session -- "$0" "$@"
fi

if [ ! "${PULSE_SERVER-}" ]; then
	find_pulse_socket
	if [ -S "${PA_SOCK_PATH-}" ]; then
		export PULSE_SERVER=unix:$PA_SOCK_PATH
		[ -r "$HOME/.config/pulse/cookie" ] &&
			export PULSE_COOKIE="$HOME/.config/pulse/cookie"
	fi
fi

# Both are set by the vendor's own launcher.
: ${GDK_BACKEND:=x11}
: ${DOTNET_EnableWriteXorExecute:=0}
export GDK_BACKEND DOTNET_EnableWriteXorExecute

# WebKit's sandbox needs unprivileged user namespaces and seccomp, which
# the Linuxulator does not provide.
: ${WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS:=1}
export WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS

# A FreeBSD side .so in LD_PRELOAD breaks the Linux run-time linker.
unset LD_PRELOAD

exec %%DATADIR%%/RemoteDesktopManager "$@"