OBS User unknown 2008-11-28 14:53:14 +00:00 committed by Git OBS Bridge
parent 0168d8f9d8
commit b6da101d4d
3 changed files with 33 additions and 54 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Nov 24 11:42:43 CET 2008 - rodrigo@novell.com
- Use /etc/alsa-pulse.conf for ALSA when enabling PulseAudio, as we
already do in GNOME, instead of touching /etc/alsa.conf
- Don't run the script if user is not root (bnc#445997)
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Nov 19 13:14:25 CET 2008 - rodrigo@novell.com Wed Nov 19 13:14:25 CET 2008 - rodrigo@novell.com

View File

@ -22,7 +22,7 @@ Name: pulseaudio
%define drvver 0.9 %define drvver 0.9
Summary: A Networked Sound Server Summary: A Networked Sound Server
Version: 0.9.12 Version: 0.9.12
Release: 8 Release: 9
License: GPL v2 or later; LGPL v2.1 or later License: GPL v2 or later; LGPL v2.1 or later
Group: System/Sound Daemons Group: System/Sound Daemons
Source: %{name}-%{version}.tar.bz2 Source: %{name}-%{version}.tar.bz2
@ -548,6 +548,10 @@ groupadd -r pulse-access &>/dev/null || :
%{_mandir}/man1/pax11publish.1.gz %{_mandir}/man1/pax11publish.1.gz
%changelog %changelog
* Mon Nov 24 2008 rodrigo@novell.com
- Use /etc/alsa-pulse.conf for ALSA when enabling PulseAudio, as we
already do in GNOME, instead of touching /etc/alsa.conf
- Don't run the script if user is not root (bnc#445997)
* Wed Nov 19 2008 rodrigo@novell.com * Wed Nov 19 2008 rodrigo@novell.com
- Some fixes in setup-pulseaudio script (bnc#445015) - Some fixes in setup-pulseaudio script (bnc#445015)
* Wed Nov 19 2008 rodrigo@novell.com * Wed Nov 19 2008 rodrigo@novell.com

View File

@ -9,60 +9,27 @@ show_help() {
echo " --enable Enables PulseAudio" echo " --enable Enables PulseAudio"
echo " --disable Disables PulseAudio" echo " --disable Disables PulseAudio"
echo " --status Shows activation state (disabled or enabled) for PulseAudio" echo " --status Shows activation state (disabled or enabled) for PulseAudio"
echo ""
echo "You need to be root for this command to succeed"
exit exit
} }
check_root() {
id=`id -u`
if [ "x$id" = "x0" ]; then
true
else
echo "You need to be root in order to enable/disable pulseaudio"
false
fi
}
enable_alsa() { enable_alsa() {
echo "Enabling PulseAudio for ALSA..." echo "Enabling PulseAudio for ALSA..."
# Add PCM PA device if grep "ALSA_CONFIG_PATH" /etc/environment; then
if test -f /etc/asound.conf; then echo "PulseAudio config for ALSA already in use"
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
else else
echo "" >> /etc/asound.conf echo "ALSA_CONFIG_PATH=/etc/alsa-pulse.conf" >> /etc/environment
echo "pcm.pulse {" >> /etc/asound.conf
echo " type pulse" >> /etc/asound.conf
echo "}" >> /etc/asound.conf
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 fi
} }
@ -116,7 +83,7 @@ enable_sdl() {
echo "Enabling PulseAudio for SDL..." echo "Enabling PulseAudio for SDL..."
# For SDL, we just add an environment variable, so that apps use the PA audio driver # For SDL, we just add an environment variable, so that apps use the PA audio driver
if grep SDL_AUDIODRIVER /etc/environment; then if grep SDL_AUDIODRIVER /etc/environment; then
sed s/SDL_AUDIODRIVER*/SDL_AUDIODRIVER=pulse /etc/environment echo "SDL already setup to use PulseAudio"
else else
echo "SDL_AUDIODRIVER=pulse" >> /etc/environment echo "SDL_AUDIODRIVER=pulse" >> /etc/environment
fi fi
@ -140,8 +107,7 @@ enable_xine() {
disable_alsa() { disable_alsa() {
echo "Disabling PulseAudio for ALSA..." echo "Disabling PulseAudio for ALSA..."
# FIXME: perl -pi -e ... perl -pi -e "s|ALSA_CONFIG_PATH=/etc/alsa-pulse.conf||g;" /etc/environment
echo ""
} }
disable_libao() { disable_libao() {
@ -174,7 +140,7 @@ disable_oss() {
disable_sdl() { disable_sdl() {
echo "Disabling PulseAudio for SDL..." echo "Disabling PulseAudio for SDL..."
if grep "SDL_AUDIODRIVER=pulse" /etc/environment; then if grep "SDL_AUDIODRIVER=pulse" /etc/environment; then
sed s/SDL_AUDIODRIVER=pulse// /etc/environment perl -pi -e "s|SDL_AUDIODRIVER=pulse||g;" /etc/environment
fi fi
} }
@ -191,6 +157,7 @@ disable_xine() {
case $1 in case $1 in
--enable) --enable)
check_root || exit
ENABLE=1 ENABLE=1
enable_alsa enable_alsa
enable_libao enable_libao
@ -202,6 +169,7 @@ case $1 in
enable_xine enable_xine
;; ;;
--disable) --disable)
check_root || exit
ENABLE=0 ENABLE=0
disable_alsa disable_alsa
disable_libao disable_libao