This method is prefered over pulseaudio's built in systems so we should try our best to ensure that it cannot be spawned outside of the mechanisms desired. We also disable the manual override of enabling the socket and force it to be enabled at install time. --- configure.ac | 3 +++ man/pulse-client.conf.5.xml.in | 2 +- src/Makefile.am | 7 +++++++ src/daemon/systemd/user/pulseaudio.socket | 3 --- src/pulse/client-conf.c | 4 ++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6c9690f..46ad3d7 100644 --- a/configure.ac +++ b/configure.ac @@ -1215,6 +1215,9 @@ AS_IF([test "x$enable_systemd_daemon" != "xno"], AS_IF([test "x$enable_systemd_daemon" = "xyes" && test "x$HAVE_SYSTEMD_DAEMON" = "x0"], [AC_MSG_ERROR([*** Needed systemd daemon support not found])]) +AS_IF([test "x$HAVE_SYSTEMD_DAEMON" = "x1"], [ PA_DEFAULT_AUTOSPAWN=no ], [ PA_DEFAULT_AUTOSPAWN=yes ]) +AC_SUBST(PA_DEFAULT_AUTOSPAWN) + AC_SUBST(HAVE_SYSTEMD_DAEMON) AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = x1]) AS_IF([test "x$HAVE_SYSTEMD_DAEMON" = "x1"], AC_DEFINE([HAVE_SYSTEMD_DAEMON], 1, [Have SYSTEMDDAEMON?])) diff --git a/man/pulse-client.conf.5.xml.in b/man/pulse-client.conf.5.xml.in index 45f02da..7025df7 100644 --- a/man/pulse-client.conf.5.xml.in +++ b/man/pulse-client.conf.5.xml.in @@ -69,7 +69,7 @@ USA. <option> <p><opt>autospawn=</opt> Autospawn a PulseAudio daemon when - needed. Takes a boolean value, defaults to <opt>yes</opt>.</p> + needed. Takes a boolean value, defaults to <opt>@PA_DEFAULT_AUTOSPAWN@</opt>.</p> </option> <option> diff --git a/src/Makefile.am b/src/Makefile.am index 717af63..76ac428 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -225,6 +225,13 @@ systemduserunit_DATA = \ pulseaudio.service \ daemon/systemd/user/pulseaudio.socket +install-data-hook: + $(MKDIR_P) -m 0755 \ + $(DESTDIR)$(systemduserunitdir)/sockets.target.wants + ( cd $(DESTDIR)$(systemduserunitdir)/sockets.target.wants && \ + rm -f pulseaudio.socket && \ + $(LN_S) ../pulseaudio.socket pulseaudio.socket ) + endif ################################### diff --git a/src/daemon/systemd/user/pulseaudio.socket b/src/daemon/systemd/user/pulseaudio.socket index 332ece8..84cc22f 100644 --- a/src/daemon/systemd/user/pulseaudio.socket +++ b/src/daemon/systemd/user/pulseaudio.socket @@ -5,6 +5,3 @@ Description=Sound System Priority=6 Backlog=5 ListenStream=%t/pulse/native - -[Install] -WantedBy=sockets.target diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c index e0acc23..80ddae0 100644 --- a/src/pulse/client-conf.c +++ b/src/pulse/client-conf.c @@ -65,7 +65,11 @@ static const pa_client_conf default_conf = { .cookie_from_x11_valid = false, .cookie_file_from_application = NULL, .cookie_file_from_client_conf = NULL, +#ifdef HAVE_SYSTEMD_DAEMON + .autospawn = false, +#else .autospawn = true, +#endif .disable_shm = false, .shm_size = 0, .auto_connect_localhost = false, -- 2.1.2