add daemon mode support to pulseaudio
PATCH 1/1 add daemon mode support to pulseaudio
pulseaudio documentation recommands not using the daemon mode unless you are on a headless system, but since that is the common case for a buildroot installation, install the related user and groups
--- package/multimedia/pulseaudio/Config.in | 10 +++++++ package/multimedia/pulseaudio/S50pulseaudio | 39 +++++++++++++++++++++++++++ package/multimedia/pulseaudio/pulseaudio.mk | 13 +++++++++ 3 files changed, 62 insertions(+) create mode 100755 package/multimedia/pulseaudio/S50pulseaudio
package/multimedia/pulseaudio/Config.in +10 -0
@@ -19,5 +19,15 @@ config BR2_PACKAGE_PULSEAUDIO http://pulseaudio.org +config BR2_PACKAGE_PULSEAUDIO_DAEMON + bool "start pulseaudio as a system daemon" + depends on BR2_PACKAGE_PULSEAUDIO + help + PulseAudio can be started as a system daemon. This is not the + recommanded way of using PulseAudio unless you are building a + headless system + + comment "pulseaudio requires a toolchain with WCHAR, LARGEFILE and threads support" depends on !BR2_USE_WCHAR || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS +
package/multimedia/pulseaudio/S50pulseaudio new file +39 -0
@@ -0,0 +1,39 @@ +#!/bin/sh +# +# Starts pulseaudio. +# + + +start() { + echo -n "Starting pulseaudio: " + umask 077 + /usr/bin/pulseaudio --system --daemonize + echo "OK" +} +stop() { + echo -n "Stopping pulseaudio: " + pulseaudio --kill + echo "OK" +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? +
package/multimedia/pulseaudio/pulseaudio.mk +13 -0
@@ -84,4 +84,17 @@ endef PULSEAUDIO_POST_INSTALL_TARGET_HOOKS += PULSEAUDIO_REMOVE_VALA endif +ifeq($(BR2_PACKAGE_PULSEAUDIO_DAEMON);y) +define PULSEAUDIO_USERS + pulse -1 pulse -1 * /var/run/pulse - audio,pulse-access +endef + +define PULSEAUDIO_INSTALL_INIT_SYSV + [ -f $(TARGET_DIR)/etc/init.d/S50pulseaudio ] || \ + $(INSTALL) -D -m 755 package/multimedia/pulseaudio/S50pulseaudio \ + $(TARGET_DIR)/etc/init.d/S50pulseaudio +endef + +endif + $(eval $(autotools-package))
Signature · 1 line
1.7.10.4
PATCH 1/1 add daemon mode support to pulseaudio
Dear J?r?my Rosen,
The title of the patch should be:
pulseaudio: add daemon mode support
i.e, always put the name of the affected package first.
Quoted 1 line · J?r?my Rosen
pulseaudio documentation recommands not using the daemon mode unless you
recommends.
package/multimedia/pulseaudio/Config.in config BR2_PACKAGE_PULSEAUDIO · line 23
Quoted 5 lines
are on a headless system, but since that is the common case for a buildroot installation, install the related user and groups
package/multimedia/pulseaudio/Config.in +2
-0+config BR2_PACKAGE_PULSEAUDIO_DAEMON + bool "start pulseaudio as a system daemon"
bool "start as a daemon"
should be sufficient, since the option will be indented under pulseaudio.
package/multimedia/pulseaudio/Config.in config BR2_PACKAGE_PULSEAUDIO · line 27
Quoted 4 lines
package/multimedia/pulseaudio/Config.in +4
-0+ depends on BR2_PACKAGE_PULSEAUDIO + help + PulseAudio can be started as a system daemon. This is not the + recommanded way of using PulseAudio unless you are building a
recommended.
package/multimedia/pulseaudio/Config.in config BR2_PACKAGE_PULSEAUDIO · line 28
Quoted 1 line
package/multimedia/pulseaudio/Config.in +1
-0+ headless system
Missing final dot. It would be good to explain how pulseaudio is started when this option is not selected.
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 add daemon mode support to pulseaudio
In reply to Jérémy RosenQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"J?r?my" == J?r?my Rosen <[email protected]> writes:
J?r?my> pulseaudio documentation recommands not using the daemon mode unless you J?r?my> are on a headless system, but since that is the common case for a J?r?my> buildroot installation, install the related user and groups
J?r?my> Signed-off-by: J?r?my Rosen <[email protected]> J?r?my> ---
J?r?my> package/multimedia/pulseaudio/Config.in | 10 +++++++ J?r?my> package/multimedia/pulseaudio/S50pulseaudio | 39 +++++++++++++++++++++++++++ J?r?my> package/multimedia/pulseaudio/pulseaudio.mk | 13 +++++++++
J?r?my> 3 files changed, 62 insertions(+)
J?r?my> create mode 100755 package/multimedia/pulseaudio/S50pulseaudio
J?r?my> diff --git a/package/multimedia/pulseaudio/Config.in b/package/multimedia/pulseaudio/Config.in J?r?my> index 03c2613..bdc87ba 100644
J?r?my> --- a/package/multimedia/pulseaudio/Config.in
J?r?my> +++ b/package/multimedia/pulseaudio/Config.in
J?r?my> @@ -19,5 +19,15 @@ config BR2_PACKAGE_PULSEAUDIO
J?r?my> http://pulseaudio.org
J?r?my> +config BR2_PACKAGE_PULSEAUDIO_DAEMON
J?r?my> + bool "start pulseaudio as a system daemon"
J?r?my> + depends on BR2_PACKAGE_PULSEAUDIO
J?r?my> + help
J?r?my> + PulseAudio can be started as a system daemon. This is not the J?r?my> + recommanded way of using PulseAudio unless you are building a J?r?my> + headless system
J?r?my> +
J?r?my> +
J?r?my> comment "pulseaudio requires a toolchain with WCHAR, LARGEFILE and threads support"
J?r?my> depends on !BR2_USE_WCHAR || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
J?r?my> +
J?r?my> diff --git a/package/multimedia/pulseaudio/S50pulseaudio b/package/multimedia/pulseaudio/S50pulseaudio J?r?my> new file mode 100755
J?r?my> index 0000000..be71022
J?r?my> --- /dev/null
J?r?my> +++ b/package/multimedia/pulseaudio/S50pulseaudio
J?r?my> @@ -0,0 +1,39 @@
J?r?my> +#!/bin/sh
J?r?my> +#
J?r?my> +# Starts pulseaudio.
J?r?my> +#
J?r?my> +
J?r?my> +
J?r?my> +start() {
J?r?my> + echo -n "Starting pulseaudio: "
J?r?my> + umask 077
J?r?my> + /usr/bin/pulseaudio --system --daemonize
J?r?my> + echo "OK"
J?r?my> +}
J?r?my> +stop() {
J?r?my> + echo -n "Stopping pulseaudio: "
J?r?my> + pulseaudio --kill
J?r?my> + echo "OK"
J?r?my> +}
J?r?my> +restart() {
J?r?my> + stop
J?r?my> + start
J?r?my> +}
J?r?my> +
J?r?my> +case "$1" in
J?r?my> + start)
J?r?my> + start
J?r?my> + ;;
J?r?my> + stop)
J?r?my> + stop
J?r?my> + ;;
You use a mix of spaces and tabs for indentation in this script.
J?r?my> + restart|reload)
J?r?my> + restart
J?r?my> + ;;
J?r?my> + *)
J?r?my> + echo "Usage: $0 {start|stop|restart}"
J?r?my> + exit 1
J?r?my> +esac
J?r?my> +
J?r?my> +exit $?
J?r?my> +
J?r?my> diff --git a/package/multimedia/pulseaudio/pulseaudio.mk b/package/multimedia/pulseaudio/pulseaudio.mk J?r?my> index e78eb42..d326dcc 100644
J?r?my> --- a/package/multimedia/pulseaudio/pulseaudio.mk
J?r?my> +++ b/package/multimedia/pulseaudio/pulseaudio.mk
J?r?my> @@ -84,4 +84,17 @@ endef
J?r?my> PULSEAUDIO_POST_INSTALL_TARGET_HOOKS += PULSEAUDIO_REMOVE_VALA
J?r?my> endif
J?r?my> +ifeq($(BR2_PACKAGE_PULSEAUDIO_DAEMON);y)
That seems wrong. It should be:
ifeq ($(BR2_PACKAGE_PULSEAUDIO_DAEMON),y)
J?r?my> +define PULSEAUDIO_USERS
J?r?my> + pulse -1 pulse -1 * /var/run/pulse - audio,pulse-access
J?r?my> +endef
J?r?my> +
J?r?my> +define PULSEAUDIO_INSTALL_INIT_SYSV
J?r?my> + [ -f $(TARGET_DIR)/etc/init.d/S50pulseaudio ] || \
J?r?my> + $(INSTALL) -D -m 755 package/multimedia/pulseaudio/S50pulseaudio \
J?r?my> + $(TARGET_DIR)/etc/init.d/S50pulseaudio
J?r?my> +endef
As we now have support for post-build scripts, we no longer need the hack about checking if the script is already present in the skeleton, so that can be removed.
Committed with these fixes (and the typos Thomas pointed out), thanks.
Are you actively using pulseaudio? 3.0 got released some months ago, care to test and send a patch to upgrade to it?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 add daemon mode support to pulseaudio
Quoted 6 lines
As we now have support for post-build scripts, we no longer need the hack about checking if the script is already present in the skeleton, so
that can be removed.
Quoted 6 lines
Committed with these fixes (and the typos Thomas pointed out), thanks.
Are you actively using pulseaudio? 3.0 got released some months ago, care to test and send a patch to upgrade to it?
yes, I have a project using pulseaudio to build a headless remote audio system. i'll give it a try and report my findings