launch: Add systemd units for launching pulseaudio user instances

This commit is contained in:
Colin Guthrie 2014-10-17 15:10:14 +02:00
parent 42156d2b5a
commit e542e81004
4 changed files with 42 additions and 1 deletions

View file

@ -1203,6 +1203,13 @@ AS_IF([test "x$HAVE_SYSTEMD" = "x1"],
HAVE_SYSTEMD_JOURNAL=1
])
AC_ARG_WITH([systemduserunitdir],
AS_HELP_STRING([--with-systemduserunitdir=DIR], [Directory for systemd user service files]),
[], [with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)])
if test "x$with_systemduserunitdir" != xno; then
AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
fi
#### systemd daemon support (optional) ####
AS_IF([test "x$enable_systemd_daemon" != "xno"],
@ -1458,6 +1465,10 @@ AC_CONFIG_FILES([src/default.pa:src/daemon/default.pa.in],
[m4 src/default.pa > src/default.pa.gen && mv src/default.pa.gen src/default.pa])
AC_CONFIG_FILES([src/system.pa:src/daemon/system.pa.in],
[m4 src/system.pa > src/system.pa.gen && mv src/system.pa.gen src/system.pa])
AS_IF([test "$HAVE_SYSTEMD_DAEMON" = "x1"],
[
AC_CONFIG_FILES([src/pulseaudio.service:src/daemon/systemd/user/pulseaudio.service.in])
])
# CMake related ProjectConfig files
PA_LIBDIR="$libdir"

View file

@ -95,6 +95,8 @@ EXTRA_DIST = \
depmod.py \
daemon/esdcompat.in \
daemon/start-pulseaudio-x11.in \
daemon/systemd/user/pulseaudio.service.in \
daemon/systemd/user/pulseaudio.socket \
utils/padsp.in \
utils/qpaeq \
modules/module-defs.h.m4 \
@ -217,6 +219,14 @@ pax11publish_CFLAGS = $(AM_CFLAGS) $(X11_CFLAGS)
pax11publish_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la $(X11_LIBS)
pax11publish_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
if HAVE_SYSTEMD_DAEMON
systemduserunit_DATA = \
pulseaudio.service \
daemon/systemd/user/pulseaudio.socket
endif
###################################
# Test programs #
###################################
@ -2152,7 +2162,7 @@ module_rygel_media_server_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
###################################
CLEANFILES += daemon/pulseaudio.desktop
DISTCLEANFILES = esdcompat client.conf default.pa system.pa daemon.conf start-pulseaudio-x11
DISTCLEANFILES = esdcompat client.conf default.pa system.pa daemon.conf start-pulseaudio-x11 pulseaudio.service
if OS_IS_WIN32
SYMLINK_PROGRAM=cd $(DESTDIR)$(bindir) && cp

View file

@ -0,0 +1,10 @@
[Unit]
Description=Sound Service
[Service]
ExecStart=@PA_BINARY@ --daemonize=no
Restart=on-failure
[Install]
Also=pulseaudio.socket
WantedBy=default.target

View file

@ -0,0 +1,10 @@
[Unit]
Description=Sound System
[Socket]
Priority=6
Backlog=5
ListenStream=%t/pulse/native
[Install]
WantedBy=sockets.target