diff --git a/pulseaudio.changes b/pulseaudio.changes index 1ee5b10..e1a6578 100644 --- a/pulseaudio.changes +++ b/pulseaudio.changes @@ -1,15 +1,3 @@ -------------------------------------------------------------------- -Tue Jul 20 18:41:58 CEST 2010 - tiwai@suse.de - -- set up sh/csh profiles instead of /etc/environment in - setup-pulseaudio script (bnc#623837) - -------------------------------------------------------------------- -Tue Jul 20 18:20:35 CEST 2010 - tiwai@suse.de - -- Add speechd setup to setup-pulseaudio (bnc#619859) -- Use grep -q for testing in setup-pulseaudio - ------------------------------------------------------------------- Sat May 15 11:07:54 UTC 2010 - coolo@novell.com diff --git a/setup-pulseaudio b/setup-pulseaudio index ff5c908..d9db659 100644 --- a/setup-pulseaudio +++ b/setup-pulseaudio @@ -25,49 +25,24 @@ check_root() { fi } -PROFNAME=/etc/profile.d/pulseaudio.sh -CPROFNAME=/etc/profile.d/pulseaudio.csh - -set_variable () { - if test -f $PROFNAME && - grep -q "export $1"= $PROFNAME; then - sed -ie "s|export $1=.*|export $1=$2|g" $PROFNAME - else - echo "export $1=$2" >> $PROFNAME - fi - if test -f $CPROFNAME && - grep -q "setenv $1 " $CPROFNAME; then - sed -ie "s|setenv $1 .*|setenv $1 $2|g" $CPROFNAME - else - echo "setenv $1 $2" >> $CPROFNAME - fi -} - -delete_variable () { - if test -f $PROFNAME && - grep -q "export $1"= $PROFNAME; then - sed -ie "/export $1=.*/d" $PROFNAME - fi - if test -f $CPROFNAME && - grep -q "setenv $1 " $CPROFNAME; then - sed -ie "/setenv $1 .*/d" $CPROFNAME - fi -} - enable_phonon() { echo "Enabling PulseAudio for Phonon..." - delete_variable PHONON_PULSEAUDIO_DISABLE + perl -pi -e "s|PHONON_PULSEAUDIO_DISABLE=1||g;" /etc/environment } enable_alsa() { echo "Enabling PulseAudio for ALSA..." - set_variable ALSA_CONFIG_PATH /etc/alsa-pulse.conf + if grep "ALSA_CONFIG_PATH" /etc/environment; then + echo "PulseAudio config for ALSA already in use" + else + echo "ALSA_CONFIG_PATH=/etc/alsa-pulse.conf" >> /etc/environment + fi } enable_libao() { echo "Enabling PulseAudio for libao..." if test -f /etc/libao.conf; then - if grep -q "default_driver=pulse" /etc/libao.conf; then + 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 @@ -90,17 +65,6 @@ enable_mplayer() { # FIXME: mplayerplug-in uses $HOME/.mplayer/mplayerplug-in.conf } -enable_speechd() { - echo "Enabling PulseAudio for speech dispatcher..." - if test -f /etc/speech-dispatcher/speechd.conf; then - if grep -q 'AudioOutputMethod' /etc/speech-dispatcher/speechd.conf; then - perl -pi -e "s|^.*AudioOutputMethod .*|AudioOutputMethod \"pulse\"|g;" /etc/speech-dispatcher/speechd.conf - else - echo "AudioOutputMethod \"pulse\"" >> /etc/speech-dispatcher/speechd.conf - fi - fi -} - enable_openal() { # nothing to do here. openal-soft is patched to prefer pulse but # it won't autostart the daemon. @@ -108,12 +72,16 @@ enable_openal() { } enable_oss() { + # this is broken. /etc/environment must only contain environment + # variables. It's not a shell script + return 0 + echo "Enabling PulseAudio for OSS..." for app in $LIST_OF_OSS_APPS; do - if grep -q "alias $app='padsp $app'" $PROFNAME; then + if grep "alias $app=padsp $app" /etc/environment; then echo "Application $app already setup for PulseAudio" else - echo "alias $app='padsp $app'" >> $PROFNAME + echo "alias $app=padsp $app" >> /etc/environment fi done } @@ -121,16 +89,24 @@ enable_oss() { enable_sdl() { echo "Enabling PulseAudio for SDL..." # For SDL, we just add an environment variable, so that apps use the PA audio driver - set_variable SDL_AUDIODRIVER pulse + if grep SDL_AUDIODRIVER /etc/environment; then + echo "SDL already setup to use PulseAudio" + else + echo "SDL_AUDIODRIVER=pulse" >> /etc/environment + fi } enable_timidity() { + # this is broken. /etc/environment must only contain environment + # variables. It's not a shell script + return 0 + echo "Enabling PulseAudio for Timidity..." # Use esound output for timidity - if grep -q "alias timidity='timidity -Oe'" $PROFNAME; then + if grep "alias timidity=timidity -Oe" /etc/environment; then echo "Timidity already setup for using PulseAudio" else - echo "alias timidity='timidity -Oe'" >> $PROFNAME + echo "alias timidity=timidity -Oe" >> /etc/environment fi } @@ -151,12 +127,16 @@ enable_autospawn() { disable_alsa() { echo "Disabling PulseAudio for ALSA..." - delete_variable ALSA_CONFIG_PATH + perl -pi -e "s|ALSA_CONFIG_PATH=/etc/alsa-pulse.conf||g;" /etc/environment } disable_phonon() { echo "Disabling PulseAudio for Phonon..." - set_variable PHONON_PULSEAUDIO_DISABLE 1 + if grep "PHONON_PULSEAUDIO_DISABLE" /etc/environment; then + echo "PulseAudio config for Phonon already in use" + else + echo "PHONON_PULSEAUDIO_DISABLE=1" >> /etc/environment + fi } disable_libao() { @@ -173,15 +153,6 @@ disable_mplayer() { fi } -disable_speechd() { - echo "Disabling PulseAudio for speech dispatcher..." - if test -f /etc/speech-dispatcher/speechd.conf; then - if grep -q 'AudioOutputMethod' /etc/speech-dispatcher/speechd.conf; then - perl -pi -e "s|^.*AudioOutputMethod .*|#AudioOutputMethod \"pulse\"|g;" /etc/speech-dispatcher/speechd.conf - fi - fi -} - disable_openal() { # nothing to do here. openal-soft is patched to prefer pulse but # it won't autostart the daemon. @@ -189,19 +160,29 @@ disable_openal() { } disable_oss() { + # this is broken. /etc/environment must only contain environment + # variables. It's not a shell script + return 0 + for app in $LIST_OF_OSS_APPS; do - perl -pi -e "s|alias $app='padsp $app'||g;" $PROFNAME + perl -pi -e "s|alias $app=padsp $app||g;" /etc/environment done } disable_sdl() { echo "Disabling PulseAudio for SDL..." - delete_variable SDL_AUDIODRIVER + if grep "SDL_AUDIODRIVER=pulse" /etc/environment; then + perl -pi -e "s|SDL_AUDIODRIVER=pulse||g;" /etc/environment + fi } disable_timidity() { + # this is broken. /etc/environment must only contain environment + # variables. It's not a shell script + return 0 + echo "Disabling PulseAudio for Timidity..." - perl -pi -e "s|alias timidity='timidity -Oe'||g;" $PROFNAME + perl -pi -e "s|alias timidity=timidity -Oe||g;" /etc/environment } disable_xine() { @@ -233,7 +214,6 @@ case $1 in enable_xine enable_autospawn enable_phonon - enable_speechd ;; --disable) check_root || exit @@ -248,7 +228,6 @@ case $1 in disable_xine disable_autospawn disable_phonon - disable_speechd ;; --status) STATUS=`grep PULSEAUDIO_ENABLE /etc/sysconfig/sound | cut -f2 -d= | cut -f2 -d\"`