aboutsummaryrefslogtreecommitdiff
path: root/system/nvidia-driver
diff options
context:
space:
mode:
authorHeinz Wiesinger <pprkut@liwjatan.at>2010-05-11 22:26:51 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-11 22:26:51 +0200
commit9fef33508ca79a2a21d98511d74def8ce28cecff (patch)
treef10782c16cfa3eefbd19342d75be800bd4978734 /system/nvidia-driver
parent721ba322e1d117a8829249c6ced9edf09f5d0788 (diff)
system/nvidia-driver: Updated for version 177.82
Diffstat (limited to 'system/nvidia-driver')
-rw-r--r--system/nvidia-driver/README21
-rw-r--r--system/nvidia-driver/doinst.sh8
-rw-r--r--system/nvidia-driver/nvidia-driver.SlackBuild15
-rw-r--r--system/nvidia-driver/nvidia-driver.info10
-rw-r--r--system/nvidia-driver/nvidia-switch685
-rw-r--r--system/nvidia-driver/slack-desc9
6 files changed, 534 insertions, 214 deletions
diff --git a/system/nvidia-driver/README b/system/nvidia-driver/README
index 416ed5aed64e..1dabafaf15e1 100644
--- a/system/nvidia-driver/README
+++ b/system/nvidia-driver/README
@@ -1,24 +1,31 @@
-This is the proprietary binary video driver from NVidia for the X.Org
-X-server. This package does not include the kernel-module - it is a
+This is the proprietary binary video driver from NVidia for the X.Org
+X-server. This package does not include the kernel-module - it is a
part of the nvidia-kernel package at SlackBuilds.org.
-Since this nvidia-driver conflicts with some files of xorg, it's a bit
+Since this nvidia-driver conflicts with some files of xorg, it's a bit
complex to install/uninstall the driver. However, installation of the
nvidia-driver package itself backs up the conflicting files and puts the
nvidia-specific files into place.
Heinz Wiesinger, the author of the build script, has written a script called
nvidia-switch, which can be used to switch between the stock xorg driver and
-the nvidia driver, but it will not edit xorg.conf for you; you have to do
+the nvidia driver, but it will not edit xorg.conf for you; you have to do
that manually. The nvidia-switch script is installed to /usr/sbin.
Usage of nvidia-switch:
nvidia-switch --xorg <--> switch to the stock xorg files
nvidia-switch --nvidia <--> switch to the proprietary nvidia files
+ nvidia-switch --cleanup <--> switch to the stock xorg file and remove all
+ symlinks created by nvidia-switch
-Before uninstalling this package, it is important that you execute
-'nvidia-switch --xorg', which will switch back to the stock xorg files.
-If you forget to do this, you'll have to do the switch manually, or xorg
+No special steps are necessary when updating nvidia-driver from a previous
+package. If you update to a newer xorg, you do not have to reinstall
+nvidia-driver either. Just run "nvidia-switch --nvidia" in that case.
+
+Before uninstalling this package, it is important that you execute
+'nvidia-switch --cleanup', which will switch back to the stock xorg files
+and remove all links created by nvidia-switch before.
+If you forget to do this, you'll have to do the switch manually, or xorg
won't work on next startup. Here are the affected files:
/usr/lib/libGL.so.1.2
/usr/include/GL/{gl.h glx.h glxext.h glext.h}
diff --git a/system/nvidia-driver/doinst.sh b/system/nvidia-driver/doinst.sh
index 11586152dd2a..fedbcb8f0ec0 100644
--- a/system/nvidia-driver/doinst.sh
+++ b/system/nvidia-driver/doinst.sh
@@ -1,6 +1,5 @@
-
-if [ -x usr/bin/update-desktop-database ]; then
- ./usr/bin/update-desktop-database ./usr/share/applications >/dev/null 2>&1
+if [ -x /usr/bin/update-desktop-database ]; then
+ ./usr/bin/update-desktop-database -q usr/share/applications
fi
if ! [ -e usr/lib/xorg/modules/libwfb.so ]; then
@@ -24,5 +23,4 @@ fi
( cd usr/lib ; rm -rf libcuda.so )
( cd usr/lib ; ln -sf libcuda.so.1 libcuda.so )
-/usr/sbin/nvidia-switch --nvidia
-
+/usr/sbin/nvidia-switch --install \ No newline at end of file
diff --git a/system/nvidia-driver/nvidia-driver.SlackBuild b/system/nvidia-driver/nvidia-driver.SlackBuild
index 99292a23c5cf..57be01303946 100644
--- a/system/nvidia-driver/nvidia-driver.SlackBuild
+++ b/system/nvidia-driver/nvidia-driver.SlackBuild
@@ -2,7 +2,7 @@
# Slackware build script for nvidia-driver
-# Copyright 2007-2008 Heinz Wiesinger <hmwiesinger@gmx.at>
+# Copyright 2007-2008 Heinz Wiesinger <pprkut@liwjatan.at>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -25,7 +25,7 @@
# Thanks to Robby Workman for suggestions to improve this script.
PRGNAM=nvidia-driver
-VERSION=169.09
+VERSION=177.82
ARCH=${ARCH:-i586}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -48,7 +48,7 @@ cd $SRCNAM
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
-mkdir -p $PKG/usr/{bin,share,lib,sbin} $PKG/usr/include/{cuda,GL} \
+mkdir -p $PKG/usr/{bin,share,lib,sbin} $PKG/usr/include/GL \
$PKG/usr/lib/xorg/modules/{drivers,extensions}
# Start with the libraries
@@ -74,13 +74,14 @@ cd -
# These are the includes
cd usr/include/GL
- for i in glext.h gl.h glxext.h glx.h; do
+ for i in glxext.h glext.h gl.h glx.h; do
cp -a $i $PKG/usr/include/GL/$i-nvidia
done
cd -
+mkdir -p $PKG/usr/include/cuda/
cd usr/include/cuda
- cp -a * $PKG/usr/include/cuda/
+ cp -a * $PKG/usr/include/cuda/
cd -
# Next come the apps
@@ -100,8 +101,8 @@ cd usr/share
cd -
# Self written bash script which I use to switch between nvidia and nv.
-# It is not necessary, but is very useful in general and for repairing
-# things or when removing the package. Feel free to remove this :)
+# It is now also used by doinst.sh to switch to the nvidia-driver right
+# after installation.
install -m 0755 $CWD/nvidia-switch $PKG/usr/sbin/
sed -i s/PKGVERSION/$VERSION/g $PKG/usr/sbin/nvidia-switch
diff --git a/system/nvidia-driver/nvidia-driver.info b/system/nvidia-driver/nvidia-driver.info
index 18f8d409758c..defe6f4ecc39 100644
--- a/system/nvidia-driver/nvidia-driver.info
+++ b/system/nvidia-driver/nvidia-driver.info
@@ -1,8 +1,8 @@
PRGNAM="nvidia-driver"
-VERSION="169.09"
+VERSION="177.82"
HOMEPAGE="http://www.nvidia.com"
-DOWNLOAD="http://us.download.nvidia.com/XFree86/Linux-x86/169.09/NVIDIA-Linux-x86-169.09-pkg1.run"
-MD5SUM="26a7f94908bbe07a1110fd78cfa81320"
+DOWNLOAD="http://us.download.nvidia.com/XFree86/Linux-x86/177.82/NVIDIA-Linux-x86-177.82-pkg1.run"
+MD5SUM="8e46c4af035bf29064140fa6255f3cf3"
MAINTAINER="ppr:kut"
-EMAIL="HMWiesinger@gmx.at"
-APPROVED="rworkman"
+EMAIL="pprkut@liwjatan.at"
+APPROVED="dsomero"
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch
index 55493a6f2640..c12f28e7e7d6 100644
--- a/system/nvidia-driver/nvidia-switch
+++ b/system/nvidia-driver/nvidia-switch
@@ -2,8 +2,8 @@
# ***************************************************************************
# * Copyright (C) 2007-2008 by Heinz Wiesinger *
-# * HMWiesinger@gmx.at *
-# * http://hw.3kisses.net *
+# * 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 *
@@ -20,205 +20,512 @@
# * Free Software Foundation, Inc., *
# * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
# ***************************************************************************/
-# nvidia-switch utility 0.5
+# nvidia-switch utility 0.7.5
#
# A tool to switch between nvidia-binary-driver and stock xorg-driver
# if both are installed in parallel.
set -e
-INC="/usr/include/GL"
-LIB="/usr/lib"
-XMOD="/usr/lib/xorg/modules"
+ROOT="/"
+CWD=$(pwd)
+INC="${ROOT}usr/include/GL"
+LIB="${ROOT}usr/lib"
+XMOD="${ROOT}usr/lib/xorg/modules"
XLIB="$XMOD/extensions"
NV_VERSION='PKGVERSION' # This will be replaced in the build script
GL_VERSION="1.2"
-if [ "$1" = '--nvidia' ]; then
- echo $'Switching to nvidia-driver files!\n'
-
- echo "You have to ENABLE the nvidia driver in /etc/X11/xorg.conf."
- echo "Otherwise, this may lead to improperly working drivers."
-
- #Change to includes path
- cd $INC
- #if gl*.h exists and is a link, then remove the old link and create the new one
- #else, if it exists and is not a link, move it to gl*.h-xorg and create a link.
- #else, it it does not exist, create a link to gl*.h-nvidia
- for i in glxext.h glext.h glx.h gl.h; do
-
- if [ -L $i ]; then
- rm -f $i
- ln -s $i-nvidia $i
- elif [ -e $i ]; then
- mv $i $i-xorg
- ln -s $i-nvidia $i
- else
- ln -s $i-nvidia $i
- fi
-
- done
-
- for i in $LIB/libGL.so $XLIB/libglx.so; do
-
- #If libGL.so.$NV_VERSION-nvidia does exists, then remove the -nvidia and make it usable that way
- if [ -e "$i.$NV_VERSION-nvidia" ]; then
- rm -f $i.$NV_VERSION
- ln -s $i.$NV_VERSION-nvidia $i.$NV_VERSION
- fi
-
- done
-
- #if libGL.so.$GL_VERSION does exist, move it to libGL.so.$GL_VERSION-xorg, as it conflicts if nvidia's libGL.so
- # then remove the libGL.so.1 symlink and create a new one pointing to nvidia's libGL.so
- if [ -e "$LIB/libGL.so.$GL_VERSION" ]; then
- cd $LIB
- mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg
- rm -f libGL.so.1
- ln -s $LIB/libGL.so.$NV_VERSION libGL.so.1
- fi
-
- #If libGLcore.so.$NV_VERSION-nvidia does exists, then remove the -nvidia and make it usable that way
- if [ -e "$LIB/libGLcore.so.$NV_VERSION-nvidia" ]; then
- rm -f $LIB/libGLcore.so.$NV_VERSION $LIB/libGLcore.so.1
- ln -s $LIB/libGLcore.so.$NV_VERSION-nvidia $LIB/libGLcore.so.$NV_VERSION
- ln -s $LIB/libGLcore.so.$NV_VERSION $LIB/libGLcore.so.1
- fi
-
-
- for i in libGLcore.so libGLcore.la libglx.la; do
-
- #If this library exists, move it to *-xorg
- if [ -e "$XLIB/$i" ]; then
- mv $XLIB/$i $XLIB/$i-xorg
- fi
-
- done
-
- # if libglx.so is not a link, back it up to *-xorg, and create a symlink to nvidia's one
- # if it's a link, then remove it and create a new one.
- if ! [ -L "$XLIB/libglx.so" ]; then
- cd $XLIB
- mv libglx.so libglx.so-xorg
- ln -s $XLIB/libglx.so.$NV_VERSION libglx.so
- else
- cd $XLIB
- rm -f libglx.so
- ln -s $XLIB/libglx.so.$NV_VERSION libglx.so
- fi
-
- #Recreate the link removed by --xorg
- if ! [ -e "$XMOD/libwfb.so" ]; then
- ln -s $XMOD/libnvidia-wfb.so.1 $XMOD/libwfb.so
- fi
-
- /sbin/ldconfig
-
- #Generate correct symink for that lib
- /sbin/ldconfig -l /usr/lib/libGL.so.169.09-nvidia
+remove_link(){
+if [ -L "$1" ]; then
+ rm -f "$1"
+fi
+}
-elif [ "$1" = '--xorg' ]; then
- echo $'Switching to stock xorg files.\n'
-
- echo "You have to DISABLE the nvidia driver in /etc/X11/xorg.conf."
- echo "Otherwise, this may lead to improperly working drivers."
-
- #Change to includes path
- cd $INC
- #if gl*.h exists and is a link, then remove the old link and create the new one
- #else, if it exists and is not a link, move it to gl*.h-xorg and create a link.
- #else, it it does not exist, create a link to gl*.h-xorg
- for i in glxext.h glext.h glx.h gl.h; do
-
- if [ -L $i ]; then
- rm -f $i
- ln -s $i-xorg $i
- elif [ -e $i ]; then
- mv $i $i-xorg
- ln -s $i-xorg $i
- else
- ln -s $i-xorg $i
- fi
-
- done
-
- for i in libGL.so libGLcore.so; do
-
- #if this link exists, remove it, if it's a file, move it to *.nvidia
- if [ -L "$LIB/$i.$NV_VERSION" ]; then
- rm -f $LIB/$i.$NV_VERSION
- elif [ -e "$LIB/$i.$NV_VERSION" ]; then
- mv $LIB/$i.$NV_VERSION $LIB/$i.$NV_VERSION-nvidia
- fi
-
- if [ -L "$LIB/$i.1" ]; then
- rm -f $LIB/$i.1
- fi
-
- done
-
- #if libGL.so.$GL_VERSION does not exist and libGL.so.$GL_VERSION-xorg does, move it to libGL.so.$GL_VERSION
- # then remove the libGL.so.1 symlink and create a new one pointing to nvidia's libGL.so
- if ! [ -e "$LIB/libGL.so.$GL_VERSION" ]; then
- if [ -e "$LIB/libGL.so.$GL_VERSION-xorg" ]; then
- cd $LIB
- mv $LIB/libGL.so.$GL_VERSION-xorg $LIB/libGL.so.$GL_VERSION
- ln -s $LIB/libGL.so.$GL_VERSION libGL.so.1
- fi
- fi
-
- for i in libGLcore.so libGLcore.la libglx.la; do
-
- #If libGLcore.so does not exist, and *-xorg does, then remove the -xorg
- if ! [ -e "$XLIB/$i" ]; then
- if [ -e "$XLIB/$i-xorg" ]; then
- mv $XLIB/$i-xorg $XLIB/$i
- fi
- fi
-
- done
-
- #if this library exists, move it to *-nvidia
- if [ -L "$XLIB/libglx.so.$NV_VERSION" ]; then
- rm $XLIB/libglx.so.$NV_VERSION
- elif [ -e "$XLIB/libglx.so.$NV_VERSION" ]; then
- mv $XLIB/libglx.so.$NV_VERSION $XLIB/libglx.so.$NV_VERSION-nvidia
- fi
-
- # if libglx.so exists and is a link, remove it and create a new one
- # If it does exists and is not a link, remove the old one, and create the new one.
- # if it does not exist, create a symlink
- if [ -L "$XLIB/libglx.so" ]; then
- cd $XLIB
- rm libglx.so
- ln -s libglx.so-xorg libglx.so
- elif [ -e "$XLIB/libglx.so" ]; then
- cd $XLIB
- mv libglx.so libglx.so-xorg
- ln -s libglx.so-xorg libglx.so
- else
- cd $XLIB
- ln -s libglx.so-xorg libglx.so
- fi
-
- # Not handled by removepkg/upgradepkg automatically.
- if [ -L "$XMOD/libwfb.so" ]; then
- rm -f $XMOD/libwfb.so
- fi
-
- /sbin/ldconfig
-
- #Generate correct symink for that lib
- /sbin/ldconfig -l /usr/lib/libGL.so.1.2
-
- #Remove so-link, recreated by ldconfig
- if [ -L $LIB/libGLcore.so.1 ]; then
- rm -f $LIB/libGLcore.so.1
- fi
+remove_existing(){
+if [ -e "$1" ]; then
+ rm -f $1
+fi
+}
+
+move_existing(){
+if [ -e "$1" ]; then
+ mv $1 $2
+fi
+}
+
+setup_link(){
+ if [ "$1" = "mv" ]; then
+ mv "$2" "$3"
+ else
+ rm -f $2
+ fi
+ ln -s "$3" "$2"
+}
+
+# Move and rename files in /usr/include
+# $1 = from
+# $2 = to
+incs(){
+cd "$INC"
+
+if [ "$2" = "cleanup" ]; then
+ CMD="mv"
+ THREE="$1"
+else
+ CMD="ln -s"
+ THREE="$2"
+fi
+for i in glxext.h glext.h glx.h gl.h; do
+ if [ -L "$i" ]; then
+ rm -f "$i"
+ $CMD "$i-$THREE" "$i"
+ elif [ -e "$i" ]; then
+ if [ "$2" = "cleanup" ]; then
+ rm -f "$i-$1"
+ else
+ mv "$i" "$i-$1"
+ ln -s "$i-$THREE" "$i"
+ fi
+ else
+ $CMD "$i-$THREE" "$i"
+ fi
+done
+
+cd "$CWD"
+}
+
+libs(){
+for i in libGLcore.so libGLcore.la libglx.la; do
+ if [ "$1" = "nvidia" ]; then
+ #If this library exists, move it to *-xorg
+ move_existing "$XLIB/$i" "$XLIB/$i-xorg"
+ else
+ #If .so does not exist, and *-xorg does, then remove the -xorg
+ if [ -e "$XLIB/$i" ]; then
+ remove_existing "$XLIB/$i-xorg"
+ else
+ move_existing "$XLIB/$i-xorg" "$XLIB/$i"
+ fi
+ fi
+done
+}
+
+libs_basic(){
+for i in libGL.so libGLcore.so; do
+ #if this link exists, remove it, if it's a file, move it to *.nvidia
+ if [ -L "$LIB/$i.$NV_VERSION" ]; then
+ rm -f "$LIB/$i.$NV_VERSION"
+ elif [ -e "$LIB/$i.$NV_VERSION" ]; then
+ mv "$LIB/$i.$NV_VERSION" "$LIB/$i.$NV_VERSION-nvidia"
+ fi
+ remove_link "$LIB/$i.1"
+done
+}
+
+libgl_nvidia(){
+#if libGL.so.$GL_VERSION does exist, move it to libGL.so.$GL_VERSION-xorg, as it conflicts if nvidia's libGL.so
+# then remove the libGL.so.1 symlink and create a new one pointing to nvidia's libGL.so
+if [ -e "$LIB/libGL.so.$GL_VERSION" ]; then
+ cd "$LIB"
+ mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg
+ setup_link "" "libGL.so.1" "libGL.so.$NV_VERSION"
+ cd "$CWD"
+fi
+}
+
+libgl_xorg(){
+#if libGL.so.$GL_VERSION does not exist and libGL.so.$GL_VERSION-xorg does, move it to libGL.so.$GL_VERSION
+# then remove the libGL.so.1 symlink and create a new one pointing to nvidia's libGL.so
+if [ -e "$LIB/libGL.so.$GL_VERSION" ]; then
+ remove_existing "$LIB/libGL.so.$GL_VERSION-xorg"
+else
+ if [ -e "$LIB/libGL.so.$GL_VERSION-xorg" ]; then
+ cd "$LIB"
+ mv libGL.so.$GL_VERSION-xorg libGL.so.$GL_VERSION
+ ln -s libGL.so.$GL_VERSION libGL.so.1
+ cd "$CWD"
+ fi
+fi
+}
+
+
+libglcore_nvidia(){
+#If libGLcore.so.$NV_VERSION-nvidia does exists, then remove the -nvidia and make it usable that way
+if [ -e "$LIB/libGLcore.so.$NV_VERSION-nvidia" ]; then
+ cd "$LIB"
+ rm -f libGLcore.so.$NV_VERSION libGLcore.so.1
+ ln -s libGLcore.so.$NV_VERSION-nvidia libGLcore.so.$NV_VERSION
+ ln -s libGLcore.so.$NV_VERSION libGLcore.so.1
+ cd "$CWD"
+fi
+}
+
+lib_nvidia(){
+for i in libGL.so libglx.so; do
+ if [ "$i" = "libGL.so" ]; then
+ cd "$LIB"
+ elif [ "$i" = "libglx.so" ]; then
+ cd "$XLIB"
+ fi
+ #If libGL.so.$NV_VERSION-nvidia does exists, then remove the -nvidia and make it usable that way
+ if [ -e "$i.$NV_VERSION-nvidia" ]; then
+ setup_link "" "$i.$NV_VERSION" "$i.$NV_VERSION-nvidia"
+ fi
+ cd "$CWD"
+done
+}
+
+libglx_base(){
+for i in $(ls libglx.so* | grep -v -); do
+ if ! [ "$i" = "libglx.so.$NV_VERSION" ]; then
+ rm -f $i
+ fi
+done
+ln -s libglx.so.$NV_VERSION libglx.so
+}
+
+libglx_nvidia(){
+# if libglx.so is not a link, back it up to *-xorg, and create a symlink to nvidia's one
+# if it's a link, then remove it and create a new one.
+if ! [ -L "$XLIB/libglx.so" ]; then
+ cd $XLIB
+ mv libglx.so libglx.so-xorg
+ libglx_base
else
- echo "Usage:"
- echo " --nvidia Switch to nvidia driver files"
- echo " --xorg Switch to stock xorg files"
+ cd $XLIB
+ libglx_base
fi
+cd $CWD
+}
+libglx_xorg(){
+if [ "$1" = "xorg" ]; then
+ CMD="ln -s"
+else
+ CMD="mv"
+fi
+
+#if this library exists, move it to *-nvidia
+if [ -L "$XLIB/libglx.so.$NV_VERSION" ]; then
+ rm $XLIB/libglx.so.$NV_VERSION
+elif [ -e "$XLIB/libglx.so.$NV_VERSION" ]; then
+ mv $XLIB/libglx.so.$NV_VERSION $XLIB/libglx.so.$NV_VERSION-nvidia
+fi
+
+# if libglx.so exists and is a link, remove it and create a new one
+# If it does exists and is not a link, remove the old one, and create the new one.
+# if it does not exist, create a symlink
+if [ -L "$XLIB/libglx.so" ]; then
+ cd $XLIB
+ rm libglx.so
+ $CMD libglx.so-xorg libglx.so
+elif [ -e "$XLIB/libglx.so" ]; then
+ if [ "$1" = "xorg" ]; then
+ cd $XLIB
+ setup_link "mv" "libglx.so" "libglx.so-xorg"
+ else
+ remove_existing "$XLIB/libglx.so-xorg"
+ fi
+else
+ cd $XLIB
+ $CMD libglx.so-xorg libglx.so
+fi
+cd $CWD
+}
+
+libwfb_nvidia(){
+#Recreate the link removed by --xorg
+if ! [ -e "$XMOD/libwfb.so" ]; then
+ cd $XMOD
+ ln -s libnvidia-wfb.so.1 libwfb.so
+ cd $CWD
+fi
+}
+
+nvidia_ldconfig(){
+/sbin/ldconfig
+#Generate correct symink for that lib
+/sbin/ldconfig -l $1
+
+if [ "$2" = "xorg" ]; then
+ #Remove so-link, recreated by ldconfig
+ cd $LIB
+ remove_link "libGLcore.so.1"
+ cd $CWD
+fi
+}
+
+check(){
+ echo -n "checking $2...."
+ if [ -e "$1/$2" ]; then
+ if [ "$3" = "exist" ]; then
+ echo "ERROR: $1/$2 does exist!!!!!"
+ else
+ echo -n "exists"
+ if [ -h "$1/$2" ]; then
+ echo "(link)"
+ echo -n " points to:"
+ ls -o "$1/$2" | cut -d ">" -f 2
+ else
+ if [ "$3" = "link" ]; then
+ echo " (!)"
+ else
+ echo ""
+ fi
+ fi
+ fi
+ else
+ if [ "$3" = "exist" ]; then
+ echo "does not exist"
+ else
+ echo "ERROR: $1/$2 does not exist!!!!!"
+ fi
+ fi
+}
+
+check_includes(){
+ if [ "$1" = "cleanup" ]; then
+ cleanup=""
+ cleanup2="exist"
+ else
+ cleanup="link"
+ cleanup2=""
+ fi
+
+ for i in glext.h glxext.h gl.h glx.h; do
+ check $INC $i $cleanup
+ check $INC $i-nvidia
+ check $INC $i-xorg $cleanup2
+ echo ""
+ done
+}
+
+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
+ if [ "$i" = "libGLcore.so.1" ]; then
+ check $LIB $i $CHECK
+ elif [ "$i" = "libGLcore.so.$NV_VERSION" ]; then
+ check $LIB $i $CHECK
+ else
+ check $LIB $i
+ fi
+ 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(){
+ if [ "$1" = "xorg" ]; then
+ xorg="exist"
+ cleanup="link"
+ cleanup2=""
+ EXT="-xorg"
+ elif [ "$1" = "cleanup" ]; then
+ xorg="exist"
+ cleanup=""
+ cleanup2="exist"
+ EXT="-xorg"
+ else
+ xorg="link"
+ cleanup="link"
+ cleanup2=""
+ EXT=""
+ fi
+
+ for i in libglx.la libglx.so libglx.so.$NV_VERSION libglx.so.$NV_VERSION-nvidia \
+ libglx.so-xorg libglx.la-xorg; do
+ if [ "$i" = "libglx.so" ]; then
+ check $XLIB $i $cleanup
+ elif [ "$i" = "libglx.so-xorg" ]; then
+ check $XLIB $i $cleanup2
+ elif [ "$i" = "libglx.so.$NV_VERSION" ]; then
+ check $XLIB $i $xorg
+ elif [ "$i" = "libglx.la$EXT" ]; then
+ check $XLIB $i "exist"
+ else
+ check $XLIB $i
+ fi
+ done
+
+ echo ""
+}
+
+check_wfb(){
+ for i in libwfb.so libwfb.la libnvidia-wfb.so.1 libnvidia-wfb.so.$NV_VERSION; do
+ if [ "$i" = "libnvidia-wfb.so.1" ]; then
+ check $XMOD $i "link"
+ else
+ check $XMOD $i
+ fi
+ done
+}
+
+check_gl(){
+ if [ "$1" = "nvidia" ]; then
+ nvidia="link"
+ EXT=""
+ else
+ nvidia="exist"
+ EXT="-xorg"
+ fi
+
+ for i in libGL.la libGL.so libGL.so.1 libGL.so.$NV_VERSION libGL.so.$NV_VERSION-nvidia \
+ libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg; do
+ if [ "$i" = "libGL.so" ]; then
+ check $LIB $i "link"
+ elif [ "$i" = "libGL.so.1" ]; then
+ check $LIB $i "link"
+ elif [ "$i" = "libGL.so.$NV_VERSION" ]; then
+ check $LIB $i $nvidia
+ elif [ "$i" = "libGL.so.${GL_VERSION}${EXT}" ]; then
+ check $LIB $i "exist"
+ else
+ check $LIB $i
+ fi
+ done
+
+ echo ""
+}
+
+nvidia_check(){
+ check_includes
+
+ check_gl "nvidia"
+
+ check_glcore "nvidia"
+
+ check_glx
+
+ check_wfb
+}
+
+xorg_check(){
+ check_includes
+
+ check_gl
+
+ check_glcore
+
+ check_glx "xorg"
+
+ check_wfb
+}
+
+cleanup_check(){
+ check_includes "cleanup"
+
+ check_gl
+
+ check_glcore
+
+ check_glx "cleanup"
+
+ check_wfb
+}
+
+nvidia(){
+ echo $'Switching to nvidia-driver files!\n'
+ echo "You have to ENABLE the nvidia driver in /etc/X11/xorg.conf."
+ echo "Otherwise, this may lead to improperly working drivers."
+
+ incs "xorg" "nvidia"
+ lib_nvidia
+ libgl_nvidia
+ libglcore_nvidia
+ libs "nvidia"
+ libglx_nvidia
+ libwfb_nvidia
+
+ LD_NVIDIA="/usr/lib/libGL.so.$NV_VERSION-nvidia"
+ nvidia_ldconfig $LD_NVIDIA
+}
+
+xorg(){
+ echo $'Switching to stock xorg files.\n'
+ if [ "$1" = "cleanup" ]; then
+ echo $'Cleaning up symlinks.\n'
+ fi
+ echo "You have to DISABLE the nvidia driver in /etc/X11/xorg.conf."
+ echo "Otherwise, this may lead to improperly working drivers."
+
+ if [ "$1" = "cleanup" ]; then
+ incs "xorg" "cleanup"
+ else
+ incs "xorg" "xorg"
+ fi
+
+ libs_basic
+ libgl_xorg
+ libs ""
+ if [ "$1" = "cleanup" ]; then
+ libglx_xorg ""
+ else
+ libglx_xorg "xorg"
+ fi
+ remove_link "$XMOD/libwfb.so"
+
+ LD_NVIDIA="/usr/lib/libGL.so.1.2"
+ nvidia_ldconfig $LD_NVIDIA "xorg"
+}
+
+usage(){
+ echo "Usage:"
+ echo " --nvidia Switch to nvidia driver files"
+ echo " --xorg Switch to stock xorg files"
+ echo " --cleanup Switch to stock xorg files and remove all created symlinks"
+ echo " --install Switch to nvidia driver files"
+ echo " This is used on installation to handle installroot correctly"
+ echo " Please use --nvidia for after-install switches instead"
+ echo " --check-nvidia Check if everything is setup correctly for nvidia's driver"
+ echo " --check-xorg Check if everything is setup correctly for xorg's driver"
+ echo " --check-cleanup Check if everything has been cleaned up correctly"
+ echo " --help Show this help message"
+}
+
+if [ "$1" = '--nvidia' ]; then
+ nvidia
+elif [ "$1" = '--install' ]; then
+ ROOT=""
+ CWD=$(pwd)
+ INC="${ROOT}usr/include/GL"
+ LIB="${ROOT}usr/lib"
+ XMOD="${ROOT}usr/lib/xorg/modules"
+ XLIB="$XMOD/extensions"
+ nvidia
+elif [ "$1" = '--xorg' ]; then
+ xorg ""
+elif [ "$1" = '--check-nvidia' ]; then
+ nvidia_check
+elif [ "$1" = '--check-xorg' ]; then
+ xorg_check
+elif [ "$1" = '--check-cleanup' ]; then
+ cleanup_check
+elif [ "$1" = '--cleanup' ]; then
+ xorg "cleanup"
+elif [ "$1" = '--help' ]; then
+ usage
+else
+ usage
+fi
diff --git a/system/nvidia-driver/slack-desc b/system/nvidia-driver/slack-desc
index 07b134301ef1..faeb28a2b486 100644
--- a/system/nvidia-driver/slack-desc
+++ b/system/nvidia-driver/slack-desc
@@ -1,4 +1,11 @@
- |-----handy-ruler----------------------------------------------|
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------|
nvidia-driver: nvidia-driver (Proprietary Binary Nvidia Video Driver)
nvidia-driver:
nvidia-driver: This is the proprietary binary video driver from nvidia for