Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/pulseaudio-module-xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt335672 <30179339+matt335672@users.noreply.github.com>2021-11-09 13:48:45 +0300
committerGitHub <noreply@github.com>2021-11-09 13:48:45 +0300
commit6ac122ac48bb4c5aa367422737e99661d891de93 (patch)
tree39f01b19f4b880eee34120ebba0088c83c173475
parent63f37b079568cb3013a0db683d329c4722ee239e (diff)
parent2a326d7411cc4b4dd955b985151cd6d2c4fdaa7b (diff)
Merge pull request #64 from matt335672/instfiles
Add install files to the build
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac13
-rw-r--r--instfiles/Makefile.am29
-rwxr-xr-xinstfiles/load_pa_modules.sh54
-rw-r--r--instfiles/pulseaudio-xrdp.desktop.in9
5 files changed, 105 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 3bc4e60..e944705 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src
+SUBDIRS = src instfiles
EXTRA_DIST = bootstrap.sh
diff --git a/configure.ac b/configure.ac
index 4d30e39..f4bf72d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,9 @@ PA_LIBDIR=`$PKG_CONFIG --variable=libdir libpulse`
PA_MODDIR=`$PKG_CONFIG --variable=modlibexecdir libpulse`
PA_PREFIX=`$PKG_CONFIG --variable=prefix libpulse`
+# Default system-wide autostart directory from XDG autostart specification
+m4_define([XDG_AUTOSTART_DIR], /etc/xdg/autostart)
+
AC_SUBST([PA_MAJOR], [pa_major])
AC_SUBST([PA_MINOR], [pa_minor])
AC_SUBST([PA_MAJORMINOR], [pa_major].[pa_minor])
@@ -68,6 +71,13 @@ AC_ARG_WITH(
[modlibexecdir=$withval], [modlibexecdir="${PA_MODDIR}"])
AC_SUBST(modlibexecdir)
+AC_ARG_WITH(
+ [xdgautostart-dir],
+ [AS_HELP_STRING([--with-xdgautostart-dir],
+ Directory to install the desktop file (defaults to XDG_AUTOSTART_DIR))],
+ [xdgautostartdir=$withval], [xdgautostartdir=XDG_AUTOSTART_DIR])
+AC_SUBST(xdgautostartdir)
+
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])
@@ -80,5 +90,6 @@ AC_TYPE_UINT32_T
AC_CHECK_FUNCS([memset socket])
AC_CONFIG_FILES([Makefile
- src/Makefile])
+ src/Makefile
+ instfiles/Makefile])
AC_OUTPUT
diff --git a/instfiles/Makefile.am b/instfiles/Makefile.am
new file mode 100644
index 0000000..59a1508
--- /dev/null
+++ b/instfiles/Makefile.am
@@ -0,0 +1,29 @@
+EXTRA_DIST = \
+ load_pa_modules.sh \
+ pulseaudio-xrdp.desktop.in
+
+#
+# substitute directories in service file
+#
+CLEANFILES= \
+ pulseaudio-xrdp.desktop
+
+SUBST_VARS = sed \
+ -e 's|@pkglibexecdir[@]|$(pkglibexecdir)|g'
+
+subst_verbose = $(subst_verbose_@AM_V@)
+subst_verbose_ = $(subst_verbose_@AM_DEFAULT_V@)
+subst_verbose_0 = @echo " SUBST $@";
+
+SUFFIXES = .in
+.in:
+ $(subst_verbose)$(SUBST_VARS) $< > $@
+
+#
+# files for all platforms
+#
+xdgautostart_DATA = \
+ pulseaudio-xrdp.desktop
+
+pkglibexec_SCRIPTS = \
+ load_pa_modules.sh
diff --git a/instfiles/load_pa_modules.sh b/instfiles/load_pa_modules.sh
new file mode 100755
index 0000000..350f8e9
--- /dev/null
+++ b/instfiles/load_pa_modules.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+status=0
+
+if [ -n "$XRDP_SESSION" -a -n "$XRDP_SOCKET_PATH" ]; then
+ # These values are not present on xrdp versions before v0.9.8
+ if [ -z "$XRDP_PULSE_SINK_SOCKET" -o \
+ -z "$XRDP_PULSE_SOURCE_SOCKET" ]; then
+ displaynum=${DISPLAY##*:}
+ displaynum=${displaynum%.*}
+ XRDP_PULSE_SINK_SOCKET=xrdp_chansrv_audio_out_socket_$displaynum
+ XRDP_PULSE_SOURCE_SOCKET=xrdp_chansrv_audio_in_socket_$displaynum
+ fi
+
+ # Don't check for the presence of the sockets, as if the modules
+ # are loaded they won't be there
+
+ # Unload modules
+ pactl unload-module module-xrdp-sink >/dev/null 2>&1
+ pactl unload-module module-xrdp-source >/dev/null 2>&1
+
+ # Reload modules
+ if pactl load-module module-xrdp-sink \
+ xrdp_socket_path=$XRDP_SOCKET_PATH \
+ xrdp_pulse_sink_socket=$XRDP_PULSE_SINK_SOCKET
+ then
+ echo "- pulseaudio xrdp-sink loaded"
+ if pacmd set-default-sink xrdp-sink; then
+ echo "- pulseaudio xrdp-sink set as default"
+ else
+ echo "? Can't set pulseaudio xrdp-sink as default"
+ fi
+ else
+ echo "? Can't load pulseaudio xrdp-sink"
+ status=1
+ fi
+
+ if pactl load-module module-xrdp-source \
+ xrdp_socket_path=$XRDP_SOCKET_PATH \
+ xrdp_pulse_source_socket=$XRDP_PULSE_SOURCE_SOCKET
+ then
+ echo "- pulseaudio xrdp-source loaded"
+ if pacmd set-default-source xrdp-source; then
+ echo "- pulseaudio xrdp-source set as default"
+ else
+ echo "? Can't set pulseaudio xrdp-source as default"
+ fi
+ else
+ echo "? Can't load pulseaudio xrdp-source"
+ status=1
+ fi
+fi
+
+exit $status
diff --git a/instfiles/pulseaudio-xrdp.desktop.in b/instfiles/pulseaudio-xrdp.desktop.in
new file mode 100644
index 0000000..baac740
--- /dev/null
+++ b/instfiles/pulseaudio-xrdp.desktop.in
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=1.0
+Name=PulseAudio xrdp modules
+Comment=Load PulseAudio Modules for xrdp
+Exec=@pkglibexecdir@/load_pa_modules.sh
+Terminal=false
+Type=Application
+Categories=
+GenericName=