aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/nvidia-driver/README42
-rw-r--r--system/nvidia-driver/nvidia-driver.SlackBuild62
-rw-r--r--system/nvidia-driver/nvidia-driver.info34
-rw-r--r--system/nvidia-driver/nvidia-switch454
4 files changed, 158 insertions, 434 deletions
diff --git a/system/nvidia-driver/README b/system/nvidia-driver/README
index 562b41572795a..fb90aabc1891c 100644
--- a/system/nvidia-driver/README
+++ b/system/nvidia-driver/README
@@ -11,32 +11,24 @@ 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 original author of the build script, has written a
-script called nvidia-switch, which is used to switch between the stock
-xorg driver and the nvidia driver, but it will not edit xorg.conf for you;
+Included is a script called nvidia-switch, which is used to switch from the
+xorg driver to 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.
+/usr/sbin. NOTE: nvidia-switch is not supported in a COMPAT32 environment.
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
-
-You do NOT have to run nvidia-switch after installing or upgrading the
-package. ONLY if you want to explicitely switch to the xorg files,
-afterwards switching back to nvidia files or before uninstalling the
-package.
-
-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:
+ nvidia-switch --install <--> install the nvidia files and save the
+ stock xorg files.
+ nvidia-switch --remove <--> remove the nvidia files and symlinks and
+ restore the stock xorg files.
+
+You do NOT have to run nvidia-switch after installing the package.
+
+Before uninstalling or upgrading this package, it is important that you execute
+'nvidia-switch --remove', which will switch back to the stock xorg files
+and remove all links created by nvidia-switch during installation. 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/lib/xorg/modules/extensions/{libglx.so libglx.la}
@@ -45,4 +37,6 @@ or, for Slackware64,
/usr/lib64/libGL.so.1.2
/usr/lib64/xorg/modules/extensions/{libglx.so libglx.la}
-This also requires the nvidia-kernel and libvdpau package from SlackBuilds.org.
+Simply remove the dead nvidia symlinks and rename the saved '-xorg' appended files.
+
+Requires: nvidia-kernel,libvdpau \ No newline at end of file
diff --git a/system/nvidia-driver/nvidia-driver.SlackBuild b/system/nvidia-driver/nvidia-driver.SlackBuild
index ebc913b722b82..0a3e1b32e1e36 100644
--- a/system/nvidia-driver/nvidia-driver.SlackBuild
+++ b/system/nvidia-driver/nvidia-driver.SlackBuild
@@ -3,6 +3,7 @@
# Slackware build script for nvidia-driver
# Copyright 2007-2011 Heinz Wiesinger, Amsterdam, The Netherlands
+# Copyright 20011-2012 Edward W. koenig, Vancouver, WA, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -35,9 +36,11 @@
# 1.6 27-AUG-2011 version bump, minor edits
# 1.7 21-OCT-2011 version bump
# 1.8 24-MAR-2012 version bump, fix to nvidia-switch thanks to Phill W.
+# 1.9 02-AUG-2012 version bmp, fixes, updates, nvidia-switch for install/uninstall only
PRGNAM=nvidia-driver
-VERSION=295.33
+VERSION=302.17
+MVERS=302
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -65,7 +68,7 @@ elif [ "$ARCH" = "i686" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
TARGET="x86_64"
- LIBDIRSUFFIX="64"
+ LIBDIRSUFFIX="64"
# Set 32-bit compatibility flag default
COMPAT32=${COMPAT32:-no}
else
@@ -94,17 +97,17 @@ chmod -R u+w,go+r-w,a-s .
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/{drivers,extensions} \
$PKG/etc/OpenCL/vendors/ $PKG/usr/lib$LIBDIRSUFFIX/{tls,vdpau} \
- $PKG/usr/{bin,man/man1,sbin} $PKG/usr/share/{applications,pixmaps}
+ $PKG/usr/{bin,man/man1,sbin} $PKG/usr/share/{applications,pixmaps} \
+ $PKG/usr/include/GL
install -m 755 nvidia_drv.so $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/drivers/
-install -m 755 libglx.so.$VERSION \
- $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/extensions/libglx.so.$VERSION-nvidia
+
+install -m 755 libglx.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/extensions/libglx.so.$VERSION-nvidia
install -m 755 libGL.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/libGL.so.$VERSION-nvidia
install -m 755 libGL.la $PKG/usr/lib$LIBDIRSUFFIX/
install -m 755 libOpenCL.so.1.0.0 $PKG/usr/lib$LIBDIRSUFFIX/
install -m 444 libXvMCNVIDIA.a $PKG/usr/lib$LIBDIRSUFFIX/
install -m 755 libXvMCNVIDIA.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/
-install -m 755 libvdpau_nvidia.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/vdpau/
install -m 755 libcuda.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/
install -m 755 libnvidia-glcore.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/
install -m 755 libnvidia-wfb.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/
@@ -115,27 +118,24 @@ install -m 755 libnvidia-compiler.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/
install -m 644 nvidia.icd $PKG/etc/OpenCL/vendors/
install -m 755 tls/libnvidia-tls.so.$VERSION $PKG/usr/lib$LIBDIRSUFFIX/tls/
-# Optional 32-bit support; NOTE! nvidia-switch does not operate here.
+install -m 644 gl.h $PKG/usr/include/GL/gl.h-nvidia
+install -m 644 glext.h $PKG/usr/include/GL/glext.h-nvidia
+install -m 644 glx.h $PKG/usr/include/GL/glx-nvidia
+install -m 644 glxext.h $PKG/usr/include/GL/glxext.h-nvidia
+
+# Optional 32-bit support
if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
mkdir -p $PKG/usr/lib/{tls,vdpau}
install -m 755 32/libGL.so.$VERSION $PKG/usr/lib/
install -m 755 32/libGL.la $PKG/usr/lib/
install -m 755 32/libnvidia-glcore.so.$VERSION $PKG/usr/lib/
- install -m 755 32/libvdpau_nvidia.so.$VERSION $PKG/usr/lib/vdpau/
install -m 755 32/libcuda.so.$VERSION $PKG/usr/lib/
install -m 755 32/tls/libnvidia-tls.so.$VERSION $PKG/usr/lib/tls/
install -m 755 32/libOpenCL.so.1.0.0 $PKG/usr/lib/
install -m 755 32/libnvidia-compiler.so.$VERSION $PKG/usr/lib/
fi
-# Next come the apps
-for i in nvidia-smi nvidia-bug-report.sh; do
- install -m 755 $i $PKG/usr/bin/
-done
-
-install -m 644 nvidia-smi.1.gz $PKG/usr/man/man1/
-
# symlinks
cd $PKG/usr/lib$LIBDIRSUFFIX
for i in libcuda libnvidia-cfg; do
@@ -152,22 +152,17 @@ cd $PKG/usr/lib$LIBDIRSUFFIX
ln -sf tls/libnvidia-tls.so.$VERSION libnvidia-tls.so.$VERSION
cd -
-cd $PKG/usr/lib$LIBDIRSUFFIX/vdpau
- ln -sf libvdpau_nvidia.so.$VERSION libvdpau_nvidia.so
- ln -sf libvdpau_nvidia.so.$VERSION libvdpau_nvidia.so.1
-cd -
-
cd $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules
- ln -sf libnvidia-wfb.so.$VERSION libnvidia-wfb.so.1
+ ln -sf libnvidia-wfb.so.$VERSION libnvidia-wfb.so
cd -
# symlinks for optional 32-bit support
if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
cd $PKG/usr/lib
- ln -sf libGL.so.$VERSION libGL.so.1
- ln -sf libGL.so.1 libGL.so
- ln -sf libcuda.so.$VERSION libcuda.so.1
- ln -sf libcuda.so.1 libcuda.so
+ ln -sf libGL.so.$VERSION libGL.so.$MVERS
+ ln -sf libGL.so.$MVERS libGL.so
+ ln -sf libcuda.so.$VERSION libcuda.so.$MVERS
+ ln -sf libcuda.so.$MVERS libcuda.so
ln -sf libOpenCL.so.1.0.0 libOpenCL.so.1.0
ln -sf libOpenCL.so.1.0 libOpenCL.so.1
ln -sf libOpenCL.so.1 libOpenCL.so
@@ -175,6 +170,13 @@ if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
cd -
fi
+# Next come the apps
+for i in nvidia-smi nvidia-bug-report.sh nvidia-debugdump; do
+ install -m 755 $i $PKG/usr/bin/
+done
+
+install -m 644 nvidia-smi.1.gz $PKG/usr/man/man1/
+
# Compiling nvidia-installer from source
cd $TMP/nvidia-installer-$VERSION
chown -R root:root .
@@ -202,8 +204,8 @@ cd $TMP/nvidia-settings-$VERSION
CFLAGS="$SLKCFLAGS" \
make
- install -m 755 _out/Linux_$TARGET/nvidia-settings $PKG/usr/bin/
- install -m 644 _out/Linux_$TARGET/nvidia-settings.1.gz $PKG/usr/man/man1/
+ install -m 755 src/_out/Linux_$TARGET/nvidia-settings $PKG/usr/bin/
+ install -m 644 doc/_out/Linux_$TARGET/nvidia-settings.1.gz $PKG/usr/man/man1/
install -m 644 doc/nvidia-settings.desktop $PKG/usr/share/applications/
install -m 644 doc/nvidia-settings.png $PKG/usr/share/pixmaps/
cd ../
@@ -220,9 +222,9 @@ cd $TMP/nvidia-xconfig-$VERSION
install -m 644 _out/Linux_$TARGET/nvidia-xconfig.1.gz $PKG/usr/man/man1/
cd -
-# Self written bash script which I (H.W.) use to switch between nvidia and nv.
-# It is now also used by doinst.sh to switch to the nvidia-driver right
-# after installation. For 32-bit and pure 64-bit only (EWK).
+# Bash script to cleanly install (in doinst.sh) and uninstall the nvidia files
+# so we don't stomp on the overlapping xorg files.
+# Note: switching "on the fly" no longer supported.
install -m 0755 $CWD/nvidia-switch $PKG/usr/sbin/
sed -i s/PKGVERSION/$VERSION/g $PKG/usr/sbin/nvidia-switch
sed -i s/LIBDIRSUFFIX/$LIBDIRSUFFIX/g $PKG/usr/sbin/nvidia-switch
diff --git a/system/nvidia-driver/nvidia-driver.info b/system/nvidia-driver/nvidia-driver.info
index ad2507a5749a6..c6f352cb7686c 100644
--- a/system/nvidia-driver/nvidia-driver.info
+++ b/system/nvidia-driver/nvidia-driver.info
@@ -1,22 +1,22 @@
PRGNAM="nvidia-driver"
-VERSION="295.33"
+VERSION="302.17"
HOMEPAGE="http://www.nvidia.com"
-DOWNLOAD="ftp://download.nvidia.com/XFree86/Linux-x86/295.33/NVIDIA-Linux-x86-295.33.run \
- ftp://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-295.33.tar.bz2 \
- ftp://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-295.33.tar.bz2 \
- ftp://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-295.33.tar.bz2"
-MD5SUM="1634fb3115526caeae5eb8227282bf17 \
- c93582703033ea0946bc61de05e53fb0 \
- 5416e9ff2d198147ec786b0f0889d14c \
- c19449c1de82a0d78e774e96e31587bd"
-DOWNLOAD_x86_64="ftp://download.nvidia.com/XFree86/Linux-x86_64/295.33/NVIDIA-Linux-x86_64-295.33.run \
- ftp://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-295.33.tar.bz2 \
- ftp://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-295.33.tar.bz2 \
- ftp://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-295.33.tar.bz2"
-MD5SUM_x86_64="9e172ac5bd8f722d5f4931b5c687942e \
- c93582703033ea0946bc61de05e53fb0 \
- 5416e9ff2d198147ec786b0f0889d14c \
- c19449c1de82a0d78e774e96e31587bd"
+DOWNLOAD="ftp://download.nvidia.com/XFree86/Linux-x86/302.17/NVIDIA-Linux-x86-302.17.run \
+ ftp://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-302.17.tar.bz2 \
+ ftp://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-302.17.tar.bz2 \
+ ftp://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-302.17.tar.bz2"
+MD5SUM="b7f908ea08218df08db06026215ec419 \
+ c244f24e9a493ce990ad878c8ccdf59c \
+ 8df901011c967cef1f69a83be639e203 \
+ 34fbb55cf22bbad6eebd7065bfc0eede"
+DOWNLOAD_x86_64="ftp://download.nvidia.com/XFree86/Linux-x86_64/302.17/NVIDIA-Linux-x86_64-302.17.run \
+ ftp://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-302.17.tar.bz2 \
+ ftp://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-302.17.tar.bz2 \
+ ftp://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-302.17.tar.bz2"
+MD5SUM_x86_64="5b09f013644b93bc6b1a290a2d514142 \
+ c244f24e9a493ce990ad878c8ccdf59c \
+ 8df901011c967cef1f69a83be639e203 \
+ 34fbb55cf22bbad6eebd7065bfc0eede"
MAINTAINER="Edward Koenig"
EMAIL="kingbeowulf@gmail.com"
APPROVED="rworkman"
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch
index 6fb27c2bd1001..6765010fc74c9 100644
--- a/system/nvidia-driver/nvidia-switch
+++ b/system/nvidia-driver/nvidia-switch
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2007-2011 Heinz Wiesinger, Amsterdam, The Netherlands
+# Copyright 2012 Edward W. Koenig, Vancouver, WA, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,15 +20,13 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-# New maintainer: version 1.x
-# Edward Koenig, Vancouver, United States of America
-# portions Copyright 2007-2011 Heinz Wiesinger (above)
-#
-# nvidia-switch utility 1.0.0
-#
-# A tool to switch between nvidia-binary-driver and stock xorg-driver
-# if both are installed in parallel.
+# nvidia-switch utility 2.0.0
#
+# A tool to install and cleanly remove the nvidia driver without stomping on the xorg files.
+# Note: this tool no longer supports switching drivers "on the fly" only installing and uninstalling
+# the nvidia driver and restoring the original xorg files.
+
+# TO-DO: Bounds/error checking, add COMPAT32
set -e
@@ -43,389 +41,127 @@ NV_VERSION='PKGVERSION' # This will be replaced in the build script
GL_VERSION="1.2"
NV_CONF="/usr/share/X11/xorg.conf.d/10-nvidia.conf"
-remove_link(){
-if [ -L "$1" ]; then
- rm -f "$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
+# Move, rename, restore files in /usr/include/GL
incs(){
cd "$INC"
-
-for i in glxext.h glext.h glx.h gl.h; do
- if [ -L "$i" ]; then
- rm -f "$i"
- mv "$i-xorg" "$i"
- elif [ -e "$i" ]; then
- if [ -e "$i-xorg" ]; then
- rm -f "$i-xorg"
- fi
- else
- if [ -e "$i-xorg" ]; then
- mv "$i-xorg" "$i"
- fi
- fi
-done
-
-cd "$CWD"
-}
-
-libs(){
-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"
- 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; 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
-}
-
-
-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
- cd $XLIB
- libglx_base
-fi
-cd $CWD
-}
-
-libglx_xorg(){
if [ "$1" = "xorg" ]; then
- CMD="ln -s"
+ for i in glxext.h glext.h glx.h gl.h; do
+ rm -f "$i"
+ mv "$i-xorg" "$i"
+ done
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
+ for i in glxext.h glext.h glx.h gl.h; do
+ if [ ! -e "$i-xorg" ]; then
+ mv "$i" "$i-xorg"
+ fi
+ ln -sf "$i-nvidia" "$i"
+ done
fi
-cd $CWD
-}
-
-nvidia_ldconfig(){
-/sbin/ldconfig
-#Generate correct symink for that lib
-/sbin/ldconfig -l $1
+cd "$CWD"
}
-# Make sure system wide 10-nvidia.conf gets swapped out.
-xorg_conf(){
- if [ "$1" = "nvidia" -a ! -e $NV_CONF ]; then
- cat <<- EOF > $NV_CONF
- Section "Device"
- Identifier "Device0"
- Driver "nvidia"
- VendorName "Nvidia Corporation"
- BoardName ""
- EndSection
- EOF
- else
- rm -f $NV_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
+ 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"
}
-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 ""
+save_wfb(){
+ cd "$XMOD"
+ if [ "$1" = "nvidia" ]; then
+ ln -sf libnvidia-wfb.so.$NV_VERSION-nvidia libnvidia-wfb.so.$NV_VERSION
+ ln -sf libnvidia-wfb.so.$NV_VERSION libnvidia-wfb.so.1
+ if [ ! -e libwfb.so ]; then
+ ln -sf libnvidia-wfb.so.$NV_VERSION libwfb.so
fi
- fi
- fi
- else
- if [ "$3" = "exist" ]; then
- echo "does not exist"
- else
- echo "ERROR: $1/$2 does not exist!!!!!"
- fi
- fi
-}
-
-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 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
+ elif [ "$1" = "xorg" ]; then
+ rm -f libnvidia-wfb.so.$NV_VERSION
+ rm -f libnvidia-wfb.so.1
+ if [ -L libwfb.so ]; then
+ rm -f libwfb.so
+ fi
+ fi
+cd "$CWD"
}
-check_gl(){
+save_glx(){
+ cd "$XLIB"
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_gl "nvidia"
-
- check_glx
-
- check_wfb
-}
-
-xorg_check(){
- check_gl
-
- check_glx "xorg"
-
- check_wfb
+ if [ ! -e libglx.so-xorg ]; then
+ mv libglx.la libglx.la-xorg
+ mv libglx.so libglx.so-xorg
+ fi
+ ln -sf libglx.so.$NV_VERSION-nvidia libglx.so.$NV_VERSION
+ ln -sf libglx.so.$NV_VERSION libglx.so
+ elif [ "$1" = "xorg" ]; then
+ rm -f libglx.so.$NV_VERSION
+ rm -f libglx.so
+ mv libglx.so-xorg libglx.so
+ mv libglx.la-xorg libglx.la
+ fi
+cd "$CWD"
}
-cleanup_check(){
- check_gl
-
- check_glx "cleanup"
-
- check_wfb
+nvidia_ldconfig(){
+ /sbin/ldconfig
+ #Generate correct symink for that lib
+ /sbin/ldconfig -l $1
}
-nvidia(){
- echo $'Switching to nvidia-driver files!\n'
+nvidia_install(){
+ echo $'Installing to nvidia-driver files!\n'
echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf."
echo "Otherwise, this may lead to improperly working drivers."
incs
- lib_nvidia
- libgl_nvidia
- libs "nvidia"
- libglx_nvidia
- xorg_conf "nvidia"
-
+ save_GL "nvidia"
+ save_wfb "nvidia"
+ save_glx "nvidia"
+
LD_NVIDIA="${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
+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 "Otherwise, this may lead to improperly working drivers."
- libs_basic
- libgl_xorg
- libs ""
- if [ "$1" = "cleanup" ]; then
- libglx_xorg ""
- else
- libglx_xorg "xorg"
+ incs "xorg"
+ save_GL "xorg"
+ save_wfb "xorg"
+ save_glx "xorg"
+
+ if [ -e $NV_CONF ]; then
+ rm -f $NV_CONF
fi
- xorg_conf "xorg"
LD_NVIDIA="${LIB}/libGL.so.1.2"
- nvidia_ldconfig $LD_NVIDIA "xorg"
+ nvidia_ldconfig $LD_NVIDIA
}
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 " --install Set up nvidia driver files"
+ echo " --remove Return to stock xorg files and remove all symlinks"
echo " --help Show this help message"
}
-if [ "$1" = '--nvidia' ]; then
- nvidia
-elif [ "$1" = '--install' ]; then
- ROOT=""
+if [ "$1" = '--install' ]; then
+ ROOT="/"
CWD=$(pwd)
if [ -e "${ROOT}usr/lib64" ]; then
LIBSUFFIX="64"
@@ -436,17 +172,9 @@ elif [ "$1" = '--install' ]; then
LIB="${ROOT}usr/lib${LIBSUFFIX}"
XMOD="${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"
+ nvidia_install
+elif [ "$1" = '--remove' ]; then
+ nvidia_remove
elif [ "$1" = '--help' ]; then
usage
else