- Fix error when only a single backend has been installed (#439634)

This commit is contained in:
Stewart Adam 2008-04-08 20:40:37 +00:00
parent 8e805752ee
commit 6e35cdecf2
2 changed files with 37 additions and 31 deletions

View File

@ -16,35 +16,42 @@ usage() {
exit 1
}
set_backend() {
check_exists() {
# We've already run checks, this value is valid.
TOTEM_BACKEND=$1
# Default to GStreamer if there's no config
if [ -z $TOTEM_BACKEND ] ; then
echo "*** No backend name passed ***"
usage
fi
# Default to GStreamer if the backend is invalid
if [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then
echo "*** Invalid backend name ***"
usage
fi
_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.'
# Are we missing the requested backend?
if [ ! -f $_LIBDIR/libbaconvideowidget-$TOTEM_BACKEND.so.0.0.0 ];then
echo -e "Error: Cannot use backend $TOTEM_BACKEND, it is not installed."
echo -e "Please verify your installation";
exit 1
fi
exit 0
}
set_backend() {
# We've already run checks, this value is valid and it exists
TOTEM_BACKEND=$1
/usr/sbin/alternatives --set totem-backend $_LIBDIR/libbaconvideowidget-$TOTEM_BACKEND.so.0.0.0
}
# end functions
_LIBDIR="$(rpm --eval '%{_libdir}')"
TOTEM_BACKEND=$2
BIN=$3
# Check for valid backend
# Default to GStreamer if there's no config
if [ -z $TOTEM_BACKEND ] ; then
echo "Error: No backend name passed."
usage
fi
# Default to GStreamer if the backend is invalid
if [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then
echo "Error: Invalid backend name."
usage
fi
# Does the requested backend exist?
check_exists $2
# If root, just try to set the default backend
if [ "$UID" -eq "0" ] ; then
if [ "$1" != "-b" -o -z "$2" ] ; then
@ -55,20 +62,16 @@ else
if [ "$1" != "-b" -o -z "$2" ] ; then
usage;
fi
TOTEM_BACKEND=$2
if [ $TOTEM_BACKEND != "xine" -a $TOTEM_BACKEND != "gstreamer" ] ; then
echo "*** Invalid backend name passed ***"
echo "Error: Invalid backend name."
usage
fi
BIN=$3
if [ -z "$BIN" ] ; then
echo "*** No program name passed ***"
echo "Error: No program name passed."
usage
fi
if [ $BIN != "totem" -a $BIN != "totem-audio-preview" -a $BIN != "totem-video-indexer" -a $BIN != "totem-video-thumbnailer" ] ; then
echo "*** Wrong program name ***"
echo "Error: Wrong program name."
usage
fi
shift 3

View File

@ -10,7 +10,7 @@
Summary: Movie player for GNOME
Name: totem
Version: 2.23.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2 with exception
Group: Applications/Multimedia
URL: http://www.gnome.org/projects/totem/
@ -427,6 +427,9 @@ fi
%endif
%changelog
* Tue Apr 08 2008 Stewart Adam <s.adam@diffingo.com> - 2.23.1-2
- Fix error when only a single backend has been installed (#439634)
* Tue Apr 08 2008 - Bastien Nocera <bnocera@redhat.com> - 2.23.1-1
- Update to 2.23.1