From c8d8514104c7c6088fbf9ac18803278b018441d7 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sep 24 2007 20:25:12 +0000 Subject: - Put DRI checking functionality in a checkDriOK bash function in opengl-game-functions.sh, for usage from existing wrapper scripts --- diff --git a/opengl-game-functions.sh b/opengl-game-functions.sh new file mode 100644 index 0000000..9a20af5 --- /dev/null +++ b/opengl-game-functions.sh @@ -0,0 +1,13 @@ +# check if DRI is available, show an error and exit if it isn't +function checkDriOK () +{ + if [ `glxinfo | grep "direct rendering: " | cut -d " " -f 3` != Yes ]; then + zenity --error --text="Your system currently is not capable of hardware \ +accelerated 3D. Therefor $1 cannot run. + +Usually the cause of this error is that there are no Free Software drivers \ +for your graphics card, please contact your graphics card manufacturer and \ +kindly ask them to provide Free Software support for your card." + exit 1; + fi +} diff --git a/opengl-game-wrapper.sh b/opengl-game-wrapper.sh index 324aefd..52c6803 100644 --- a/opengl-game-wrapper.sh +++ b/opengl-game-wrapper.sh @@ -1,15 +1,9 @@ #!/bin/bash -GAME=`basename $0 | sed 's/-wrapper.*//'` +. /usr/share/opengl-games-utils/opengl-game-functions.sh -if [ `glxinfo | grep "direct rendering: " | cut -d " " -f 3` != Yes ]; then - zenity --error --text="Your system currently is not capable of hardware \ -accelerated 3D. Therefor $GAME cannot run. +GAME=`basename $0 | sed 's/-wrapper.*//'` -Usually the cause of this error is that there are no Free Software drivers \ -for your graphics card, please contact your graphics card manufacturer and \ -kindly ask them to provide Free Software support for your card." - exit 1; -fi +checkDriOK $GAME exec $GAME "$@" diff --git a/opengl-games-utils.spec b/opengl-games-utils.spec index b44f921..607e335 100644 --- a/opengl-games-utils.spec +++ b/opengl-games-utils.spec @@ -1,12 +1,13 @@ Name: opengl-games-utils Version: 0.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Utilities to check proper 3d support before launching 3d games Group: Amusements/Games License: Public Domain URL: http://fedoraproject.org/wiki/SIGs/Games Source0: opengl-game-wrapper.sh -Source1: README +Source1: opengl-game-functions.sh +Source2: README BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch Requires: zenity glx-utils @@ -20,7 +21,7 @@ by other packages and is not intended for direct end user use! %prep %setup -c -T -cp %{SOURCE1} . +cp %{SOURCE2} . %build @@ -30,7 +31,9 @@ cp %{SOURCE1} . %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_bindir} +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name} install -p -m 755 %{SOURCE0} $RPM_BUILD_ROOT%{_bindir} +install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name} %clean @@ -41,9 +44,14 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root,-) %doc README %{_bindir}/opengl-game-wrapper.sh +%{_datadir}/%{name} %changelog +* Mon Sep 24 2007 Hans de Goede 0.1-3 +- Put DRI checking functionality in a checkDriOK bash function in + opengl-game-functions.sh, for usage from existing wrapper scripts + * Sun Sep 16 2007 Hans de Goede 0.1-2 - Various spelling fixes thanks to Rahul Sundaram