From 41c6a34bc6bce1deb634e1934bbea7d04e4f3cab0231d72ed5c0cc78208c9168 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Mon, 22 Sep 2008 16:12:49 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/pulseaudio?expand=0&rev=34 --- pulseaudio-dot-pulse.patch | 45 ++++++++ pulseaudio.changes | 7 ++ pulseaudio.spec | 13 ++- setup-pulseaudio | 204 +++++++++++++++++++++++++++++++++++++ 4 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 pulseaudio-dot-pulse.patch create mode 100644 setup-pulseaudio diff --git a/pulseaudio-dot-pulse.patch b/pulseaudio-dot-pulse.patch new file mode 100644 index 0000000..5b71701 --- /dev/null +++ b/pulseaudio-dot-pulse.patch @@ -0,0 +1,45 @@ +From: Lennart Poettering +Date: Fri, 12 Sep 2008 14:39:08 +0000 (+0300) +Subject: make sure ~/.pulse exists before we create the runtime dir link beneath it +X-Git-Url: http://git.0pointer.de/?p=pulseaudio.git;a=commitdiff_plain;h=61887370219ea124ca9cbda3706c4d4704694a15 + +make sure ~/.pulse exists before we create the runtime dir link beneath it +--- + +diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c +index 3e5ea49..a9e2a70 100644 +--- a/src/pulsecore/core-util.c ++++ b/src/pulsecore/core-util.c +@@ -1370,6 +1370,7 @@ static int make_random_dir_and_link(mode_t m, const char *k) { + char *pa_get_runtime_dir(void) { + char *d, *k = NULL, *p = NULL, *t = NULL, *mid; + struct stat st; ++ mode_t m; + + /* The runtime directory shall contain dynamic data that needs NOT + * to be kept accross reboots and is usuallly private to the user, +@@ -1378,10 +1379,9 @@ char *pa_get_runtime_dir(void) { + * this directory, we link it to a random subdir in /tmp, if it + * was not explicitly configured. */ + +- if ((d = getenv("PULSE_RUNTIME_PATH"))) { +- mode_t m; ++ m = pa_in_system_mode() ? 0755U : 0700U; + +- m = pa_in_system_mode() ? 0755U : 0700U; ++ if ((d = getenv("PULSE_RUNTIME_PATH"))) { + + if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1) < 0) { + pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno)); +@@ -1394,6 +1394,11 @@ char *pa_get_runtime_dir(void) { + if (!(d = get_pulse_home())) + goto fail; + ++ if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1) < 0) { ++ pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno)); ++ goto fail; ++ } ++ + if (!(mid = pa_machine_id())) { + pa_xfree(d); + goto fail; diff --git a/pulseaudio.changes b/pulseaudio.changes index 1c4e30a..76290d0 100644 --- a/pulseaudio.changes +++ b/pulseaudio.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Sep 20 12:14:18 CEST 2008 - rodrigo@suse.de + +- Added pulseaudio-dot-pulse.patch from upstream to fix broken + ~/.pulse directory creation (bnc#427859) +- Added setup-pulseaudio script (bnc#425475) + ------------------------------------------------------------------- Tue Sep 16 17:20:15 CEST 2008 - kukuk@suse.de diff --git a/pulseaudio.spec b/pulseaudio.spec index 707c558..a54ccdf 100644 --- a/pulseaudio.spec +++ b/pulseaudio.spec @@ -22,11 +22,12 @@ Name: pulseaudio %define drvver 0.9 Summary: A Networked Sound Server Version: 0.9.12 -Release: 3 +Release: 4 License: GPL v2 or later; LGPL v2.1 or later Group: System/Sound Daemons Source: %{name}-%{version}.tar.bz2 Source1: default.pa +Source2: setup-pulseaudio Url: http://pulseaudio.org BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: PolicyKit-devel alsa-devel avahi-devel bluez-devel doxygen gconf2-devel gdbm-devel glib2-devel hal-devel intltool jack-devel libatomic-ops-devel liboil-devel libsamplerate-devel libsndfile-devel lirc-devel perl-XML-Parser speex-devel tcpd-devel update-desktop-files xorg-x11-devel @@ -35,6 +36,8 @@ Recommends: alsa-plugins-pulse PreReq: pwdutils # PATCH FIX-UPSTREAM pulseaudio-defaults-daemon-conf.patch Patch3: pulseaudio-defaults-daemon-conf.patch +# PATCH-FIX-UPSTREAM pulseaudio-dot-pulse.patch +Patch4: pulseaudio-dot-pulse.patch %description pulseaudio is a networked sound server for Linux and other Unix like @@ -312,6 +315,7 @@ Authors: %prep %setup -q -T -b0 %patch3 -p1 +%patch4 -p1 %build export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" @@ -326,6 +330,8 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/pulse-%{drvver}/ # configure --disable-static had no effect; delete manually. rm -rf $RPM_BUILD_ROOT%{_libdir}/*.a chmod 755 $RPM_BUILD_ROOT%{_bindir}/pulseaudio +install %SOURCE2 $RPM_BUILD_ROOT%{_bindir} +chmod 755 $RPM_BUILD_ROOT%{_bindir}/setup-pulseaudio ln -s esdcompat $RPM_BUILD_ROOT%{_bindir}/esd rm $RPM_BUILD_ROOT/%{_libdir}/libpulsecore.so @@ -365,6 +371,7 @@ groupadd -r pulse-access &>/dev/null || : %{_sysconfdir}/xdg/autostart/pulseaudio.desktop #%attr(4755,root,root) %{_bindir}/pulseaudio %{_bindir}/pulseaudio +%{_bindir}/setup-pulseaudio %{_bindir}/start-pulseaudio-x11 %dir %{_libdir}/pulse-%{drvver}/ %dir %{_libdir}/pulse-%{drvver}/modules/ @@ -534,6 +541,10 @@ groupadd -r pulse-access &>/dev/null || : %{_mandir}/man1/pax11publish.1.gz %changelog +* Sat Sep 20 2008 rodrigo@suse.de +- Added pulseaudio-dot-pulse.patch from upstream to fix broken + ~/.pulse directory creation (bnc#427859) +- Added setup-pulseaudio script (bnc#425475) * Tue Sep 16 2008 kukuk@suse.de - Only include locales, no directories * Mon Sep 15 2008 dmueller@suse.de diff --git a/setup-pulseaudio b/setup-pulseaudio new file mode 100644 index 0000000..f47546e --- /dev/null +++ b/setup-pulseaudio @@ -0,0 +1,204 @@ +#!/bin/sh + +LIST_OF_OSS_APPS="aumix sox" + +show_help() { + echo "setup-pulseaudio [ --enable | --disable | --status ]" + echo "" + echo "Sets up PulseAudio configuration for all sound-based applications" + echo " --enable Enables PulseAudio" + echo " --disable Disables PulseAudio" + echo " --status Shows activation state (disabled or enabled) for PulseAudio" + exit +} + +enable_alsa() { + # Add PCM PA device + if grep pcm.pulse /etc/asound.conf; then + echo "pcm.pulse device already in /etc/asound.conf" + else + echo "" >> /etc/asound.conf + echo "pcm.pulse {" >> /etc/asound.conf + echo " type pulse" >> /etc/asound.conf + echo "}" >> /etc/asound.conf + fi + + # Add CTL PA device + if grep ctl.pulse /etc/asound.conf; then + echo "ctl.pulse device already in /etc/asound.conf" + else + echo "" >> /etc/asound.conf + echo "ctl.pulse {" >> /etc/asound.conf + echo " type pulse" >> /etc/asound.conf + echo "}" >> /etc/asound.conf + fi + + # Now set the default devices + if grep "pcm.!default" /etc/asound.conf; then + echo "" + else + echo "" >> /etc/asound.conf + echo "pcm.!default {" >> /etc/asound.conf + echo " type pulse" >> /etc/asound.conf + echo "}" >> /etc/asound.conf + fi + + if grep "ctl.!default" /etc/asound.conf; then + echo "" + else + echo "" >> /etc/asound.conf + echo "ctl.!default {" >> /etc/asound.conf + echo " type pulse" >> /etc/asound.conf + echo "}" >> /etc/asound.conf + fi +} + +enable_libao() { + if grep "default_driver=pulse" /etc/libao.conf; then + echo "Default driver is pulse already in /etc/libao.conf" + else + echo "default_driver=pulse" >> /etc/libao.conf + fi +} + +enable_mplayer() { + # Maybe it would be better to just add a alias mplayer=mplayer -ao pulse to /etc/environment? + if grep "ao=pulse" /etc/mplayer/mplayer.conf; then + echo "Default driver is pulse already in /etc/mplayer/mplayer.conf" + else + if grep "ao=" /etc/mplayer/mplayer.conf; then + echo "" + else + echo "ao=pulse" >> /etc/mplayer/mplayer.conf + fi + fi + + # FIXME: mplayerplug-in uses $HOME/.mplayer/mplayerplug-in.conf +} + +enable_openal() { + # FIXME: openal uses ~/.openalrc + echo "" +} + +enable_oss() { + for app in $LIST_OF_OSS_APPS; do + if grep "alias $app=padsp $app" /etc/environment; then + echo "Application $app already setup for PulseAudio" + else + echo "alias $app=padsp $app" >> /etc/environment + fi + done +} + +enable_sdl() { + # For SDL, we just add an environment variable, so that apps use the PA audio driver + if grep SDL_AUDIODRIVER /etc/environment; then + sed s/SDL_AUDIODRIVER*/SDL_AUDIODRIVER=pulse /etc/environment + else + echo "SDL_AUDIODRIVER=pulse" >> /etc/environment + fi +} + +enable_timidity() { + # Use esound output for timidity + if grep "alias timidity=timidity -Oe" /etc/environment; then + echo "Timidity already setup for using PulseAudio" + else + echo "alias timidity=timidity -Oe" >> /etc/environment + fi +} + +enable_xine() { + # FIXME: xine uses $HOME/.xine/config + echo "" +} + +disable_alsa() { + # FIXME: perl -pi -e ... + echo "" +} + +disable_libao() { + perl -pi -e "s|default_driver=pulse||g;" /etc/libao.conf +} + +disable_mplayer() { + perl -pi -e "s|ao=pulse||g;" /etc/mplayer/mplayer.conf +} + +disable_openal() { + # FIXME: openal uses ~/.openalrc + echo "" +} + +disable_oss() { + for app in $LIST_OF_OSS_APPS; do + perl -pi -e "s|alias $app=padsp $app||g;" /etc/environment + done +} + +disable_sdl() { + if grep "SDL_AUDIODRIVER=pulse" /etc/environment; then + sed s/SDL_AUDIODRIVER=pulse// /etc/environment + fi +} + +disable_timidity() { + perl -pi -e "s|alias timidity=timidity -Oe||g:" /etc/environment +} + +disable_xine() { + # FIXME: xine uses $HOME/.xine/config + echo "" +} + +case $1 in + --enable) + ENABLE=1 + enable_alsa + enable_libao + enable_mplayer + enable_openal + enable_oss + enable_sdl + enable_timidity + enable_xine + ;; + --disable) + ENABLE=0 + disable_alsa + disable_libao + disable_mplayer + disable_openal + disable_oss + disable_sdl + disable_timidity + disable_xine + ;; + --status) + STATUS=`grep PULSEAUDIO_ENABLE /etc/sysconfig/sound | cut -f2 -d= | cut -f2 -d\"` + if [ "x$STATUS" = "xyes" ]; then + echo "enabled" + else + echo "disabled" + fi + exit + ;; + *) + show_help + ;; +esac + +# Now, update /etc/sysconfig/sound with the PA status +if grep PULSEAUDIO_ENABLE /etc/sysconfig/sound; then + if grep "PULSEAUDIO_ENABLE=\"yes\"" /etc/sysconfig/sound; then + echo "" + fi +else + if [ "x$ENABLE" = "x1" ]; then + echo "PULSEAUDIO_ENABLE=\"yes\"" >> /etc/sysconfig/sound + fi +fi + +/sbin/SuSEconfig \ No newline at end of file