diff --git a/switch2nv b/switch2nv new file mode 100644 index 0000000..4fe33e1 --- /dev/null +++ b/switch2nv @@ -0,0 +1,51 @@ +#!/bin/sh +# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved. +# +# Author: Stefan Dirsch, 2001 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 675 Mass Ave, Cambridge MA 02139, USA. + +echo "------------------------------------------------------------------------" +echo "Switching the use of \"nvidia\" driver of NVIDIA to \"nv\" driver of X.Org" +echo "------------------------------------------------------------------------" +echo + +if [ "`id -u`" != "0" ]; then + echo "error: You must be root to use this program!" + exit 1 +fi + +libdir="lib" +test "$(arch)" == "x86_64" && libdir="lib64" +for file in /usr/X11R6/$libdir/modules/drivers/nvidia_drv.so \ + /usr/$libdir/xorg/modules/drivers/nvidia_drv.so; do + if [ -r $file ]; then + if strings $file | grep -q "NVIDIA dlloader X Driver"; then + echo "warning: NVIDIA driver installed. Uninstalling NVIDIA driver first." + echo -n "warning: Running \"/usr/bin/nvidia-installer --uninstall -s\" ... " + /usr/bin/tiny-nvidia-installer --uninstall -s + echo "done" + echo + depmod -a &> /dev/null + fi + fi +done + +echo -n "Patching /etc/X11/xorg.conf ... " +sed -e '/[ \t]*Driver[ \t]*"nvidia"/s/nvidia/nv/g' \ + -e 's/[ \t]*Option[ \t]*"HWCursor"[ \t]*"on"/ Option "HWCursor" "off"/g' \ + -e 's/[ \t]*Option[ \t]*"Composite"[ \t]*"on"/ Option "Composite" "off"/g' \ + -i /etc/X11/xorg.conf +echo "done" diff --git a/switch2nvidia b/switch2nvidia new file mode 100644 index 0000000..79d66dd --- /dev/null +++ b/switch2nvidia @@ -0,0 +1,40 @@ +#!/bin/sh +# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved. +# +# Author: Stefan Dirsch, 2001 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 675 Mass Ave, Cambridge MA 02139, USA. + +echo "------------------------------------------------------------------------" +echo "Switching the use of \"nv\" driver of X.Org to \"nvidia\" driver of NVIDIA" +echo "------------------------------------------------------------------------" +echo + +if [ "`id -u`" != "0" ]; then + echo "error: You must be root to use this program!" + exit 1 +fi + +head -n 2 /etc/X11/xorg.conf | tail -n 1 | grep "^# SaX" +if [ $? -eq 0 ]; then + echo -n "Patching /etc/X11/xorg.conf ... " + sed -e '/[ \t]*Driver[ \t]*"nv"/s/nv/nvidia/g' \ + -e 's/[ \t]*Option[ \t]*"HWCursor"[ \t]*"off"/ Option "HWCursor" "on"/g' \ + -e 's/[ \t]*Option[ \t]*"Composite"[ \t]*"off"/ Option "Composite" "on"/g' \ + -i /etc/X11/xorg.conf + echo "done" +else + echo "SaX2 generated xorg.conf not available!" +fi diff --git a/x11-tools.changes b/x11-tools.changes index d459dcc..dea1b25 100644 --- a/x11-tools.changes +++ b/x11-tools.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Feb 24 15:39:41 CET 2009 - sndirsch@suse.de + +- added switch2nv/switch2nvidia from 3ddiag; provides/obsoletes + 3ddiag + ------------------------------------------------------------------- Fri Nov 14 16:05:59 CET 2008 - mfabian@suse.de diff --git a/x11-tools.spec b/x11-tools.spec index 2dd72b1..0f76645 100644 --- a/x11-tools.spec +++ b/x11-tools.spec @@ -1,7 +1,7 @@ # # spec file for package x11-tools (Version 0.1) # -# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,13 +22,15 @@ Name: x11-tools License: GPL v2 or later; X11/MIT Group: System/X11/Utilities PreReq: %fillup_prereq -Provides: xf86tools -Obsoletes: xf86tools +Provides: xf86tools 3ddiag +Obsoletes: xf86tools 3ddiag AutoReqProv: on Version: 0.1 -Release: 167 +Release: 168 Summary: Tools for the X Window System Source2: xf86debug +Source3: switch2nv +Source4: switch2nvidia Source6: wmlist Source8: kroot Source31: xim @@ -64,6 +66,8 @@ mkdir -p $RPM_BUILD_ROOT/etc/skel install -m 644 $RPM_SOURCE_DIR/xim.template $RPM_BUILD_ROOT/etc/skel/.xim.template mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates/ install -c -m0644 $RPM_SOURCE_DIR/sysconfig.language-%{name} $RPM_BUILD_ROOT/var/adm/fillup-templates/ +install -m 755 $RPM_SOURCE_DIR/switch2nv $RPM_BUILD_ROOT/usr/bin +install -m 755 $RPM_SOURCE_DIR/switch2nvidia $RPM_BUILD_ROOT/usr/bin %post %{fillup_only -an language} @@ -74,12 +78,17 @@ install -c -m0644 $RPM_SOURCE_DIR/sysconfig.language-%{name} $RPM_BUILD_ROOT/var /usr/bin/xf86debug /usr/bin/wmlist /usr/bin/kroot +/usr/bin/switch2nv +/usr/bin/switch2nvidia /etc/X11/xim /etc/X11/xim.d/* /etc/skel/.xim.template /var/adm/fillup-templates/sysconfig.language-%{name} %changelog +* Tue Feb 24 2009 sndirsch@suse.de +- added switch2nv/switch2nvidia from 3ddiag; provides/obsoletes + 3ddiag * Fri Nov 14 2008 mfabian@suse.de - bnc#413879: use GTK_IM_MODULE=cedilla instead of GTK_IM_MODULE=xim in the case when no fancy input method is