summaryrefslogtreecommitdiff
path: root/system/nvidia-driver/nvidia-switch
diff options
context:
space:
mode:
Diffstat (limited to 'system/nvidia-driver/nvidia-switch')
-rw-r--r--system/nvidia-driver/nvidia-switch72
1 files changed, 44 insertions, 28 deletions
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch
index c861d5a034..07f65f5358 100644
--- a/system/nvidia-driver/nvidia-switch
+++ b/system/nvidia-driver/nvidia-switch
@@ -20,13 +20,13 @@
# 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.2
+# nvidia-switch utility 2.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
+# need to edit a bunch of other config files.
-# TO-DO: Bounds/error checking, add more COMPAT32?
+# TO-DO: Bounds/error checking
set -e
@@ -51,30 +51,14 @@ save_GL(){
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 [ ! -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
- fi
- elif [ "$1" = "xorg" ]; then
+ ln -sf libGL.so.$NV_VERSION libGL.so
+ fi
+
+ if [ "$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
+ ln -sf libGL.so.$GL_VERSION libGL.so
rm -f libGL.so.$NV_VERSION
-# Check for multilib and reverse any "damage"
- if [ "$COMPAT32" = "yes" ]; then
- cd $LIB32
- 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
fi
cd "$CWD"
}
@@ -97,7 +81,7 @@ save_wfb(){
mv libwfb.so-xorg libwfb.so
fi
fi
- fi
+ fi
cd "$CWD"
}
@@ -119,6 +103,28 @@ save_glx(){
cd "$CWD"
}
+multilib(){
+# rejigger multilib paths/links
+ cd $LIB32
+ case "$1" in
+ "nvidia")
+ 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.$NV_VERSION libGL.so
+ ;;
+ "xorg")
+ mv libGL.so.$GL_VERSION-xorg libGL.so.$GL_VERSION
+ ln -sf libGL.so.$GL_VERSION libGL.so.1
+ ln -sf libGL.so.$GL_VERSION libGL.so
+ rm -f libGL.so.$NV_VERSION
+ ;;
+ esac
+ cd "$CWD"
+}
+
nvidia_ldconfig(){
/sbin/ldconfig
#Generate correct symink for that lib
@@ -134,10 +140,15 @@ nvidia_install(){
save_GL "nvidia"
save_wfb "nvidia"
save_glx "nvidia"
+# Check for multilib configuration
+ if [ "$COMPAT32" = "yes" ]; then
+ multilib "nvidia"
+ fi
-
- LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION-nvidia"
+ LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION"
nvidia_ldconfig $LD_NVIDIA
+ WFB-NVIDIA="${XMOD}/libnvidia_wfb.so.$NV_VERSION"
+ nvidia_ldconfig $WFB_NVIDIA
}
nvidia_remove(){
@@ -149,7 +160,10 @@ nvidia_remove(){
save_GL "xorg"
save_wfb "xorg"
save_glx "xorg"
-
+# Check for multilib configuration
+ if [ "$COMPAT32" = "yes" ]; then
+ multilib "xorg"
+ fi
if [ -e $NV_CONF ]; then
rm -f $NV_CONF
@@ -157,6 +171,8 @@ nvidia_remove(){
LD_NVIDIA="${LIB}/libGL.so.$GL_VERSION"
nvidia_ldconfig $LD_NVIDIA
+ WFB-NVIDIA="${XMOD}/libwfb.so"
+ nvidia_ldconfig $WFB_NVIDIA
}
usage(){