diff options
Diffstat (limited to 'system/nvidia-driver/nvidia-switch')
-rw-r--r-- | system/nvidia-driver/nvidia-switch | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch index c12f28e7e7..f4e0ed4948 100644 --- a/system/nvidia-driver/nvidia-switch +++ b/system/nvidia-driver/nvidia-switch @@ -1,26 +1,26 @@ #!/bin/sh -# *************************************************************************** -# * Copyright (C) 2007-2008 by Heinz Wiesinger * -# * pprkut@liwjatan.at * -# * http://www.liwjatan.at * -# * * -# * 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 3 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., * -# * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -# ***************************************************************************/ -# nvidia-switch utility 0.7.5 +# Copyright 2007-2009 Heinz Wiesinger, Amsterdam, The Netherlands +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# nvidia-switch utility 0.8.1 # # A tool to switch between nvidia-binary-driver and stock xorg-driver # if both are installed in parallel. @@ -29,9 +29,10 @@ set -e ROOT="/" CWD=$(pwd) +LIBSUFFIX="LIBDIRSUFFIX" # This will be replaced in the build script INC="${ROOT}usr/include/GL" -LIB="${ROOT}usr/lib" -XMOD="${ROOT}usr/lib/xorg/modules" +LIB="${ROOT}usr/lib${LIBSUFFIX}" +XMOD="${LIB}/xorg/modules" XLIB="$XMOD/extensions" NV_VERSION='PKGVERSION' # This will be replaced in the build script GL_VERSION="1.2" @@ -97,7 +98,7 @@ cd "$CWD" } libs(){ -for i in libGLcore.so libGLcore.la libglx.la; do +for i in libglx.la; do if [ "$1" = "nvidia" ]; then #If this library exists, move it to *-xorg move_existing "$XLIB/$i" "$XLIB/$i-xorg" @@ -305,10 +306,8 @@ check_includes(){ check_glcore(){ if [ "$1" = "nvidia" ]; then CHECK="link" - EXT="" else CHECK="exist" - EXT="-xorg" fi for i in libGLcore.so.1 libGLcore.so.$NV_VERSION libGLcore.so.$NV_VERSION-nvidia; do @@ -322,18 +321,6 @@ check_glcore(){ done echo "" - - for i in libGLcore.so libGLcore.la libGLcore.so-xorg libGLcore.la-xorg; do - if [ "$i" = "libGLcore.so$EXT" ]; then - check $XLIB $i "exist" - elif [ "$i" = "libGLcore.la$EXT" ]; then - check $XLIB $i "exist" - else - check $XLIB $i - fi - done - - echo "" } check_glx(){ @@ -447,7 +434,7 @@ cleanup_check(){ nvidia(){ echo $'Switching to nvidia-driver files!\n' - echo "You have to ENABLE the nvidia driver in /etc/X11/xorg.conf." + echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf." echo "Otherwise, this may lead to improperly working drivers." incs "xorg" "nvidia" @@ -458,7 +445,7 @@ nvidia(){ libglx_nvidia libwfb_nvidia - LD_NVIDIA="/usr/lib/libGL.so.$NV_VERSION-nvidia" + LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION-nvidia" nvidia_ldconfig $LD_NVIDIA } @@ -467,7 +454,7 @@ xorg(){ if [ "$1" = "cleanup" ]; then echo $'Cleaning up symlinks.\n' fi - echo "You have to DISABLE the nvidia driver in /etc/X11/xorg.conf." + echo "Make sure the nvidia driver is DISABLED in /etc/X11/xorg.conf." echo "Otherwise, this may lead to improperly working drivers." if [ "$1" = "cleanup" ]; then @@ -486,7 +473,7 @@ xorg(){ fi remove_link "$XMOD/libwfb.so" - LD_NVIDIA="/usr/lib/libGL.so.1.2" + LD_NVIDIA="${LIB}/libGL.so.1.2" nvidia_ldconfig $LD_NVIDIA "xorg" } @@ -509,9 +496,14 @@ if [ "$1" = '--nvidia' ]; then elif [ "$1" = '--install' ]; then ROOT="" CWD=$(pwd) + if [ -e "${ROOT}usr/lib64" ]; then + LIBSUFFIX="64" + else + LIBSUFFIX="" + fi INC="${ROOT}usr/include/GL" - LIB="${ROOT}usr/lib" - XMOD="${ROOT}usr/lib/xorg/modules" + LIB="${ROOT}usr/lib${LIBSUFFIX}" + XMOD="${LIB}/xorg/modules" XLIB="$XMOD/extensions" nvidia elif [ "$1" = '--xorg' ]; then |