Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for SLE-Module-Legacy:x86_64
home:rodrigomoya:pulseaudio
pulseaudio
setup-pulseaudio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File setup-pulseaudio of Package pulseaudio
#!/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" echo "" echo "You need to be root for this command to succeed" 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() { echo "Enabling PulseAudio for ALSA..." 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 "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 else echo "default_driver=pulse" >> /etc/libao.conf fi } enable_mplayer() { echo "Enabling PulseAudio for mplayer..." # Maybe it would be better to just add a alias mplayer=mplayer -ao pulse to /etc/environment? if test -f /etc/mplayer/mplayer.conf; then if grep "ao=pulse" /etc/mplayer/mplayer.conf; then echo "Default driver is pulse already in /etc/mplayer/mplayer.conf" else echo "" fi else echo "ao=pulse" >> /etc/mplayer/mplayer.conf fi # FIXME: mplayerplug-in uses $HOME/.mplayer/mplayerplug-in.conf } enable_openal() { echo "Enabling PulseAudio for openal..." # FIXME: openal uses ~/.openalrc echo "" } enable_oss() { echo "Enabling PulseAudio for 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() { echo "Enabling PulseAudio for SDL..." # For SDL, we just add an environment variable, so that apps use the PA audio driver if grep SDL_AUDIODRIVER /etc/environment; then echo "SDL already setup to use PulseAudio" else echo "SDL_AUDIODRIVER=pulse" >> /etc/environment fi } enable_timidity() { echo "Enabling PulseAudio for 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() { echo "Enabling PulseAudio for Xine..." # FIXME: xine uses $HOME/.xine/config echo "" } disable_alsa() { echo "Disabling PulseAudio for ALSA..." perl -pi -e "s|ALSA_CONFIG_PATH=/etc/alsa-pulse.conf||g;" /etc/environment } disable_libao() { echo "Disabling PulseAudio for libao..." if test -f /etc/libao.conf; then perl -pi -e "s|default_driver=pulse||g;" /etc/libao.conf fi } disable_mplayer() { echo "Disabling PulseAudio for mplayer..." if test -f /etc/mplayer/mplayer.conf; then perl -pi -e "s|ao=pulse||g;" /etc/mplayer/mplayer.conf fi } disable_openal() { echo "Disabling PulseAudio for openal..." # FIXME: openal uses ~/.openalrc echo "" } disable_oss() { echo "Disabling PulseAudio for OSS..." for app in $LIST_OF_OSS_APPS; do perl -pi -e "s|alias $app=padsp $app||g;" /etc/environment done } disable_sdl() { echo "Disabling PulseAudio for SDL..." if grep "SDL_AUDIODRIVER=pulse" /etc/environment; then perl -pi -e "s|SDL_AUDIODRIVER=pulse||g;" /etc/environment fi } disable_timidity() { echo "Disabling PulseAudio for Timidity..." perl -pi -e "s|alias timidity=timidity -Oe||g;" /etc/environment } disable_xine() { echo "Disabling PulseAudio for Xine..." # FIXME: xine uses $HOME/.xine/config echo "" } case $1 in --enable) check_root || exit ENABLE=1 enable_alsa enable_libao enable_mplayer enable_openal enable_oss enable_sdl enable_timidity enable_xine ;; --disable) check_root || exit 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 [ "x$ENABLE" = "x1" ]; then perl -pi -e "s|PULSEAUDIO_ENABLE=\"no\"|PULSEAUDIO_ENABLE=\"yes\"|g;" /etc/sysconfig/sound else perl -pi -e "s|PULSEAUDIO_ENABLE=\"yes\"|PULSEAUDIO_ENABLE=\"no\"|g;" /etc/sysconfig/sound fi else if [ "x$ENABLE" = "x1" ]; then echo "PULSEAUDIO_ENABLE=\"yes\"" >> /etc/sysconfig/sound else echo "PULSEAUDIO_ENABLE=\"no\"" >> /etc/sysconfig/sound fi fi /sbin/SuSEconfig
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor