From 6e35cdecf27464b760cb2e3dd678ba70044dee2f Mon Sep 17 00:00:00 2001 From: Stewart Adam Date: Tue, 8 Apr 2008 20:40:37 +0000 Subject: [PATCH] - Fix error when only a single backend has been installed (#439634) --- totem-bin-backend-ondemand.sh | 63 ++++++++++++++++++----------------- totem.spec | 5 ++- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/totem-bin-backend-ondemand.sh b/totem-bin-backend-ondemand.sh index 6dc4da0..698f6cc 100644 --- a/totem-bin-backend-ondemand.sh +++ b/totem-bin-backend-ondemand.sh @@ -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 diff --git a/totem.spec b/totem.spec index 792cae9..de4fe28 100644 --- a/totem.spec +++ b/totem.spec @@ -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 - 2.23.1-2 +- Fix error when only a single backend has been installed (#439634) + * Tue Apr 08 2008 - Bastien Nocera - 2.23.1-1 - Update to 2.23.1