Accepting request 76799 from home:vuntz:branches:multimedia:libs
bnc#707703: call setup-pulseaudio in %post OBS-URL: https://build.opensuse.org/request/show/76799 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pulseaudio?expand=0&rev=68
This commit is contained in:
parent
d847de43d0
commit
9b92918303
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 22 17:23:07 CEST 2011 - vuntz@opensuse.org
|
||||
|
||||
- Automatically configure the system for pulseaudio in %post:
|
||||
+ Note that this change will forcefully enable PulseAudio on
|
||||
systems where it had manually been disabled with
|
||||
"setup-pulseaudio --disable" but without adding
|
||||
PULSEAUDIO_ENABLE="no" to /etc/sysconfig/sound.
|
||||
+ Install sysconfig.sound-pulseaudio template, and use fillup in
|
||||
%post to merge it in /etc/sysconfig/sound. Add %fillup_prereq
|
||||
PreReq for this.
|
||||
+ This defines the PULSEAUDIO_ENABLE variable that can be set to
|
||||
"yes", "no", "custom" (which means that the user has manually
|
||||
changed the configuration). Set to "yes" by default.
|
||||
+ Add --auto option setup-pulseaudio: this automatically
|
||||
enables (resp. disables) pulseaudio if PULSEAUDIO_ENABLE is set
|
||||
to "yes" (resp. "no"). It does nothing if PULSEAUDIO_ENABLE is
|
||||
set to "custom".
|
||||
+ Call "setup-pulseaudio --auto" in %post.
|
||||
+ This fixes bnc#707703.
|
||||
- Remove call to /sbin/SuSEconfig in setup-pulseaudio: it should
|
||||
not be needed.
|
||||
- Use sed instead of perl in setup-pulseaudio: this avoids leaving
|
||||
empty lines when removing a line from the configuration.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 21 14:51:21 CET 2011 - tiwai@suse.de
|
||||
|
||||
|
@ -28,6 +28,7 @@ Group: System/Sound Daemons
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
Source1: default.pa-for-gdm
|
||||
Source2: setup-pulseaudio
|
||||
Source3: sysconfig.sound-pulseaudio
|
||||
Source99: baselibs.conf
|
||||
Patch0: disabled-start.diff
|
||||
# PATCH-FIX-UPSTREAM bnc666350-fix-incorrect-check-of-return-value.patch sreeves@novell.com -- fix to correctly report realtime status
|
||||
@ -58,6 +59,7 @@ BuildRequires: tcpd-devel
|
||||
BuildRequires: translation-update-upstream
|
||||
BuildRequires: update-desktop-files
|
||||
BuildRequires: xorg-x11-devel
|
||||
PreReq: %fillup_prereq
|
||||
PreReq: pwdutils
|
||||
Recommends: alsa-plugins-pulse
|
||||
Recommends: %{name}-lang
|
||||
@ -273,6 +275,8 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/*.a
|
||||
%find_lang %{name}
|
||||
install %SOURCE2 $RPM_BUILD_ROOT%{_bindir}
|
||||
chmod 755 $RPM_BUILD_ROOT%{_bindir}/setup-pulseaudio
|
||||
install -d $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates
|
||||
install -m 0644 %SOURCE3 %{buildroot}%{_localstatedir}/adm/fillup-templates
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
|
||||
touch $RPM_BUILD_ROOT/etc/profile.d/pulseaudio.sh
|
||||
touch $RPM_BUILD_ROOT/etc/profile.d/pulseaudio.csh
|
||||
@ -301,7 +305,11 @@ groupadd -r pulse-access &>/dev/null || :
|
||||
|
||||
%postun -n libpulse-browse0 -p /sbin/ldconfig
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
%{fillup_only -an sound}
|
||||
# Update the /etc/profile.d/pulseaudio.* files
|
||||
setup-pulseaudio --auto > /dev/null
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
@ -318,6 +326,7 @@ groupadd -r pulse-access &>/dev/null || :
|
||||
# created by setup-pulseaudio script
|
||||
%ghost /etc/profile.d/pulseaudio.sh
|
||||
%ghost /etc/profile.d/pulseaudio.csh
|
||||
%{_localstatedir}/adm/fillup-templates/sysconfig.sound-pulseaudio
|
||||
%dir %{_libdir}/pulse-%{drvver}/
|
||||
%dir %{_libdir}/pulse-%{drvver}/modules/
|
||||
%{_libdir}/libpulsecore-%{drvver}.so
|
||||
|
@ -3,11 +3,12 @@
|
||||
LIST_OF_OSS_APPS="aumix sox"
|
||||
|
||||
show_help() {
|
||||
echo "setup-pulseaudio [ --enable | --disable | --status ]"
|
||||
echo "setup-pulseaudio [ --enable | --disable | --auto | --status ]"
|
||||
echo ""
|
||||
echo "Modifies configuration files of some applications for PulseAudio"
|
||||
echo " --enable Enables PulseAudio"
|
||||
echo " --disable Disables PulseAudio"
|
||||
echo " --auto Automatically enables/disables PulseAudio based on configuration"
|
||||
echo " --status Shows activation state (disabled or enabled) for PulseAudio"
|
||||
echo ""
|
||||
echo "You need to be root for this command to succeed"
|
||||
@ -98,7 +99,7 @@ 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
|
||||
sed -i -e "s|^.*AudioOutputMethod .*|AudioOutputMethod \"pulse\"|g" /etc/speech-dispatcher/speechd.conf
|
||||
else
|
||||
echo "AudioOutputMethod \"pulse\"" >> /etc/speech-dispatcher/speechd.conf
|
||||
fi
|
||||
@ -158,7 +159,7 @@ EOF
|
||||
enable_autospawn() {
|
||||
echo "Enabling PulseAudio autospawn..."
|
||||
if grep -q ^autospawn /etc/pulse/client.conf; then
|
||||
perl -pi -e "s|^autospawn.*|autospawn = yes|g;" /etc/pulse/client.conf
|
||||
sed -i -e "s|^autospawn.*|autospawn = yes|g" /etc/pulse/client.conf
|
||||
else
|
||||
echo "autospawn = yes" >> /etc/pulse/client.conf
|
||||
fi
|
||||
@ -177,7 +178,7 @@ disable_phonon() {
|
||||
disable_libao() {
|
||||
if test -f /etc/libao.conf; then
|
||||
echo "Disabling PulseAudio for libao..."
|
||||
perl -pi -e "s|default_driver=pulse||g;" /etc/libao.conf
|
||||
sed -i -e "/default_driver=pulse/d" /etc/libao.conf
|
||||
fi
|
||||
}
|
||||
|
||||
@ -193,7 +194,7 @@ 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
|
||||
sed -i -e "s|^.*AudioOutputMethod .*|#AudioOutputMethod \"pulse\"|g" /etc/speech-dispatcher/speechd.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -206,7 +207,7 @@ disable_openal() {
|
||||
|
||||
disable_oss() {
|
||||
for app in $LIST_OF_OSS_APPS; do
|
||||
perl -pi -e "s|alias $app='padsp $app'||g;" $PROFNAME
|
||||
sed -i -e "/alias $app='padsp $app'/d" $PROFNAME
|
||||
done
|
||||
}
|
||||
|
||||
@ -217,7 +218,7 @@ disable_sdl() {
|
||||
|
||||
disable_timidity() {
|
||||
echo "Disabling PulseAudio for Timidity..."
|
||||
perl -pi -e "s|alias timidity='timidity -Oe'||g;" $PROFNAME
|
||||
sed -i -e "/alias timidity='timidity -Oe'/d" $PROFNAME
|
||||
}
|
||||
|
||||
disable_xine() {
|
||||
@ -238,44 +239,66 @@ disable_festival() {
|
||||
disable_autospawn() {
|
||||
echo "Disabling PulseAudio autospawn..."
|
||||
if grep -q ^autospawn /etc/pulse/client.conf; then
|
||||
perl -pi -e "s|^autospawn.*|autospawn = no|g;" /etc/pulse/client.conf
|
||||
sed -i -e "s|^autospawn.*|autospawn = no|g" /etc/pulse/client.conf
|
||||
else
|
||||
echo "autospawn = no" >> /etc/pulse/client.conf
|
||||
fi
|
||||
}
|
||||
|
||||
enable_all() {
|
||||
enable_alsa
|
||||
enable_libao
|
||||
enable_mplayer
|
||||
enable_openal
|
||||
enable_oss
|
||||
enable_sdl
|
||||
enable_timidity
|
||||
enable_xine
|
||||
enable_festival
|
||||
enable_autospawn
|
||||
enable_phonon
|
||||
enable_speechd
|
||||
}
|
||||
|
||||
disable_all() {
|
||||
disable_alsa
|
||||
disable_libao
|
||||
disable_mplayer
|
||||
disable_openal
|
||||
disable_oss
|
||||
disable_sdl
|
||||
disable_timidity
|
||||
disable_xine
|
||||
disable_festival
|
||||
disable_autospawn
|
||||
disable_phonon
|
||||
disable_speechd
|
||||
}
|
||||
|
||||
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
|
||||
enable_festival
|
||||
enable_autospawn
|
||||
enable_phonon
|
||||
enable_speechd
|
||||
enable_all
|
||||
;;
|
||||
--disable)
|
||||
check_root || exit
|
||||
ENABLE=0
|
||||
disable_alsa
|
||||
disable_libao
|
||||
disable_mplayer
|
||||
disable_openal
|
||||
disable_oss
|
||||
disable_sdl
|
||||
disable_timidity
|
||||
disable_xine
|
||||
disable_festival
|
||||
disable_autospawn
|
||||
disable_phonon
|
||||
disable_speechd
|
||||
disable_all
|
||||
;;
|
||||
--auto)
|
||||
check_root || exit
|
||||
if [ -f /etc/sysconfig/sound ]; then
|
||||
. /etc/sysconfig/sound
|
||||
fi
|
||||
if [ "x$PULSEAUDIO_ENABLE" = "xyes" ]; then
|
||||
enable_all
|
||||
elif [ "x$PULSEAUDIO_ENABLE" = "xcustom" ]; then
|
||||
echo "Custom configuration detected, doing nothing."
|
||||
else
|
||||
disable_all
|
||||
fi
|
||||
exit
|
||||
;;
|
||||
--status)
|
||||
if [ -f /etc/sysconfig/sound ]; then
|
||||
@ -283,6 +306,8 @@ case $1 in
|
||||
fi
|
||||
if [ "x$PULSEAUDIO_ENABLE" = "xyes" ]; then
|
||||
echo "enabled"
|
||||
elif [ "x$PULSEAUDIO_ENABLE" = "xcustom" ]; then
|
||||
echo "custom configured"
|
||||
else
|
||||
echo "disabled"
|
||||
fi
|
||||
@ -296,9 +321,9 @@ esac
|
||||
# Now, update /etc/sysconfig/sound with the PA status
|
||||
if grep -q 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
|
||||
sed -i -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
|
||||
sed -i -e "s|PULSEAUDIO_ENABLE=\"yes\"|PULSEAUDIO_ENABLE=\"no\"|g" /etc/sysconfig/sound
|
||||
fi
|
||||
else
|
||||
if [ "x$ENABLE" = "x1" ]; then
|
||||
@ -307,5 +332,3 @@ else
|
||||
echo "PULSEAUDIO_ENABLE=\"no\"" >> /etc/sysconfig/sound
|
||||
fi
|
||||
fi
|
||||
|
||||
/sbin/SuSEconfig
|
||||
|
9
sysconfig.sound-pulseaudio
Normal file
9
sysconfig.sound-pulseaudio
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
## Path: Hardware/Soundcard/PulseAudio
|
||||
## Description: PulseAudio configuration
|
||||
## Type: list(yes,no,custom)
|
||||
#
|
||||
# Enable or disable PulseAudio system. Can be set to "custom" to not have
|
||||
# scripts automatically change sound-related configuration for PulseAudio.
|
||||
#
|
||||
PULSEAUDIO_ENABLE="yes"
|
Loading…
Reference in New Issue
Block a user