summaryrefslogtreecommitdiff
path: root/system/nvidia-driver/nvidia-switch
diff options
context:
space:
mode:
authorEdward Koenig <kingbeowulf@gmail.com>2013-06-02 01:55:14 -0500
committerRobby Workman <rworkman@slackbuilds.org>2013-06-04 00:11:23 -0500
commitaa006fb2dcf97bab35bad9b1234f616c696dc71a (patch)
tree98f298808967311455c69a47240527a473012598 /system/nvidia-driver/nvidia-switch
parent76741d75a7076c93ba41dcaaf26e0bd87834324f (diff)
downloadslackbuilds-aa006fb2dcf97bab35bad9b1234f616c696dc71a.tar.gz
system/nvidia-driver: Updated for version 319.17.
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/nvidia-driver/nvidia-switch')
-rw-r--r--system/nvidia-driver/nvidia-switch75
1 files changed, 44 insertions, 31 deletions
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch
index 5b7bd132ca..3495777a48 100644
--- a/system/nvidia-driver/nvidia-switch
+++ b/system/nvidia-driver/nvidia-switch
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2012 Edward W. Koenig, Vancouver, WA, USA
+# Copyright 2012-2013 Edward W. Koenig, Vancouver, WA, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,21 +20,23 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-# nvidia-switch utility 2.0.0
+# nvidia-switch utility 2.0.1
#
# A tool to install and cleanly remove the nvidia driver without stomping on the xorg files.
# Note: this tool "should" allow switching on the fly, but why? Pick a driver! You will still
# need to edit a bunch of other config files
-# TO-DO: Bounds/error checking, add COMPAT32
+# TO-DO: Bounds/error checking, add more COMPAT32?
set -e
ROOT="/"
CWD=$(pwd)
LIBSUFFIX="LIBDIRSUFFIX" # This will be replaced in the build script
+COMPAT32="LIB32FLAG" # This will be replaced in the build script (yes | no)
INC="${ROOT}usr/include/GL"
LIB="${ROOT}usr/lib${LIBSUFFIX}"
+LIB32="${ROOT}usr/lib"
XMOD="${LIB}/xorg/modules"
XLIB="$XMOD/extensions"
NV_VERSION='PKGVERSION' # This will be replaced in the build script
@@ -44,19 +46,41 @@ NV_CONF="/usr/share/X11/xorg.conf.d/10-nvidia.conf"
save_GL(){
cd "$LIB"
if [ "$1" = "nvidia" ]; then
- if [ ! -e libGL.so.$GL_VERSION-xorg ]; then
- mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg
- fi
- ln -sf libGL.so.$NV_VERSION-nvidia libGL.so.$NV_VERSION
- ln -sf libGL.so.$NV_VERSION libGL.so.1
- ln -sf libGL.so.1 libGL.so
+ if [ ! -e libGL.so.$GL_VERSION-xorg ]; then
+ mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg
+ fi
+ ln -sf libGL.so.$NV_VERSION-nvidia libGL.so.$NV_VERSION
+ ln -sf libGL.so.$NV_VERSION libGL.so.1
+ ln -sf libGL.so.1 libGL.so
+# Check for multilib configuration
+ if [ "$COMPAT32" = "yes" ]; then
+ cd $LIB32
+ if [ -f libGL.so.$GL_VERSION ]; then
+ mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg
+ fi
+ ln -sf libGL.so.$NV_VERSION-nvidia libGL.so.$NV_VERSION
+ ln -sf libGL.so.$NV_VERSION libGL.so.1
+ ln -sf libGL.so.1 libGL.so
+ fi
elif [ "$1" = "xorg" ]; then
- mv libGL.so.$GL_VERSION-xorg libGL.so.$GL_VERSION
- ln -sf libGL.so.$GL_VERSION libGL.so.1
- ln -sf libGL.so.1 libGL.so
- rm -f libGL.so.$NV_VERSION
- fi
-cd "$CWD"
+ mv libGL.so.$GL_VERSION-xorg libGL.so.$GL_VERSION
+ ln -sf libGL.so.$GL_VERSION libGL.so.1
+ ln -sf libGL.so.1 libGL.so
+ rm -f libGL.so.$NV_VERSION
+# Check for multilib and reverse any "damage"
+ if [ "$COMPAT32" = "yes" ]; then
+ cd $LIB32
+ rm -f libGL.so
+ rm -f libGL.so.1
+ rm -f libGL.so.$NV_VERSION
+ if [ -f libGL.so.$GL_VERSION-xorg ]; then
+ mv libGL.so.$GL_VERSION-xorg libGL.so.$GL_VERSION
+ fi
+ ln -sf libGL.so.$GL_VERSION libGL.so.1
+ ln -sf libGL.so.1 libGL.so
+ fi
+ fi
+ cd "$CWD"
}
save_wfb(){
@@ -77,9 +101,8 @@ save_wfb(){
mv libwfb.so-xorg libwfb.so
fi
fi
-
fi
-cd "$CWD"
+ cd "$CWD"
}
save_glx(){
@@ -108,12 +131,14 @@ nvidia_ldconfig(){
nvidia_install(){
echo $'Installing to nvidia-driver files!\n'
- echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf."
+ echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf"
+ echo "and in /etc/X11/xorg.conf.d."
echo "Otherwise, this may lead to improperly working drivers."
save_GL "nvidia"
save_wfb "nvidia"
save_glx "nvidia"
+
LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION-nvidia"
nvidia_ldconfig $LD_NVIDIA
@@ -123,7 +148,6 @@ nvidia_remove(){
echo $'Returning to stock xorg files!\n'
echo "Make sure the nvidia driver is DISABLED in /etc/X11/xorg.conf"
echo "and in /etc/X11/xorg.conf.d."
- echo "Don't forget /usr/share/X11/xorg.conf.d/10-nvidia.conf if you use it!"
echo "Otherwise, this may lead to improperly working drivers."
save_GL "xorg"
@@ -135,7 +159,7 @@ nvidia_remove(){
rm -f $NV_CONF
fi
- LD_NVIDIA="${LIB}/libGL.so.1.2"
+ LD_NVIDIA="${LIB}/libGL.so.$GL_VERSION"
nvidia_ldconfig $LD_NVIDIA
}
@@ -147,17 +171,6 @@ usage(){
}
if [ "$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${LIBSUFFIX}"
- XMOD="${LIB}/xorg/modules"
- XLIB="$XMOD/extensions"
nvidia_install
elif [ "$1" = '--remove' ]; then
nvidia_remove