Fixes from bz#327211: Use alternatives to switch totem's backends

This commit is contained in:
Stewart Adam 2008-03-19 18:10:31 +00:00
parent f116a5cd0f
commit 9b2e71d628
2 changed files with 36 additions and 16 deletions

View File

@ -28,9 +28,19 @@ set_backend() {
echo "*** Invalid backend name ***"
usage
fi
# FIXME if someone can explain update-alternatives to me
_LIBDIR="$(rpm --eval '%{_libdir}')"
if [ -f $_LIBDIR/libbaconvideowidget-gstreamer.so.0.0.0 ];then
if [ -f $_LIBDIR/libbaconvideowidget-xine.so.0.0.0 ];then
# only if both files exist
/usr/sbin/alternatives --set totem-backend $_LIBDIR/libbaconvideowidget-$TOTEM_BACKEND.so.0.0.0
else
echo -e 'Error: The xine backend was not found! Please check your totem installation.'
exit 1
fi
else
echo -e 'Error: The gstreamer backend was not found! Please check your totem installation.'
exit 1
fi
exit 0
}
# end functions
@ -64,4 +74,3 @@ else
shift 3
LD_PRELOAD=libgdk-x11-2.0.so.0:libbaconvideowidget-$TOTEM_BACKEND.so.0.0.0 exec $BIN "$@"
fi

View File

@ -10,11 +10,11 @@
Summary: Movie player for GNOME
Name: totem
Version: 2.23.0
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv2 with exception
Group: Applications/Multimedia
URL: http://www.gnome.org/projects/totem/
Source0: http://ftp.gnome.org/pub/GNOME/sources/totem/2.21/totem-%{version}.tar.bz2
Source0: http://ftp.gnome.org/pub/GNOME/sources/totem/2.23/totem-%{version}.tar.bz2
Source1: totem-bin-backend-ondemand.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -256,9 +256,6 @@ mv $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget.so.0.0.0 $RPM_BUILD_ROOT/%{_li
popd
%endif
# Restore the default backend
ln -sf %{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0 $RPM_BUILD_ROOT/%{_libdir}/libbaconvideowidget.so.0.0.0
rm -f $RPM_BUILD_ROOT%{_libdir}/totem/plugins/*/*.{a,la} \
$RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/*.{a,la} \
$RPM_BUILD_ROOT%{_libdir}/nautilus/extensions-2.0/*.{a,la} \
@ -285,9 +282,13 @@ if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
%post gstreamer -p /sbin/ldconfig
%post gstreamer
/usr/sbin/alternatives --install %{_libdir}/libbaconvideowidget.so.0.0.0 totem-backend %{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0 2
/sbin/ldconfig
%post xine -p /sbin/ldconfig
%post xine
/usr/sbin/alternatives --install %{_libdir}/libbaconvideowidget.so.0.0.0 totem-backend %{_libdir}/libbaconvideowidget-xine.so.0.0.0 1
/sbin/ldconfig
%pre
if [ "$1" -gt 1 ]; then
@ -310,7 +311,6 @@ if [ "$1" -eq 0 ]; then
fi
%postun
/sbin/ldconfig
scrollkeeper-update -q
update-desktop-database -q
touch %{_datadir}/icons/hicolor
@ -318,9 +318,14 @@ if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
%postun gstreamer -p /sbin/ldconfig
%postun gstreamer
/usr/sbin/alternatives --remove totem-backend %{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0
/sbin/ldconfig
%postun xine
/usr/sbin/alternatives --remove totem-backend %{_libdir}/libbaconvideowidget-xine.so.0.0.0
/sbin/ldconfig
%postun xine -p /sbin/ldconfig
%post mythtv
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
@ -414,7 +419,6 @@ fi
%{_libdir}/totem/plugins/publish
%files gstreamer
%{_libdir}/libbaconvideowidget.so.0.0.0
%{_libdir}/libbaconvideowidget-gstreamer.so.0.0.0
%if %{with_xine}
@ -423,7 +427,14 @@ fi
%endif
%changelog
* Mon Mar 17 2008 Jesse Keating <jkeating@redhat.com> - 2.23.0-5
* Wed Mar 19 2008 Stewart Adam <s.adam@diffingo.com> - 2.23.0-6
- Use alternatives to switch the backend
- Update totem-backend script accordingly
- Remove ldconfig from %%postun, do that in individual the backends instead
- Do not restore a default backend, ldconfig in backends does this
- Fix Source0 URL
* Mon Mar 17 2008 Jesse Keating <jkeating@redhat.com> - 2.23.0-5
- Fix some Provides to prevent cross arch obsoletions.
* Mon Mar 10 2008 - Bastien Nocera <bnocera@redhat.com> - 2.23.0-4