diff options
Diffstat (limited to 'system/nvidia-driver/nvidia-switch')
-rw-r--r-- | system/nvidia-driver/nvidia-switch | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch index b33e532cec..43ab255b57 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.1 +# nvidia-switch utility 2.2 # # 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 +# TO-DO: needs cleanup; too "wordy" and brittle. set -e @@ -44,23 +44,44 @@ GL_VERSION="1.2.0" NV_CONF="/usr/share/X11/xorg.conf.d/10-nvidia.conf" save_GL(){ - cd "$LIB" + cd $2 if [ "$1" = "nvidia" ]; then if [ ! -e libGL.so.$GL_VERSION-xorg ]; then mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg + mv libGL.la libGL.la-xorg fi mv 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 + if [ ! -e libEGL.so.1.0.0-xorg ]; then + mv libEGL.so.1.0.0 libEGL.so.1.0.0-xorg + fi + mv libGL.la-nvidia libGL.la + mv libEGL.so.$NV_VERSION-nvidia libEGL.so.$NV_VERSION + ln -sf libEGL.so.$NV_VERSION libGEL.so.1.0.0 + ln -sf libEGL.so.$NV_VERSION libEGL.so.1 + ln -sf libEGL.so.$NV_VERSION libEGL.so fi - + if [ "$1" = "xorg" ]; then - if [ -e libGL.so.$GL_VERSION-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.$GL_VERSION libGL.so - fi - mv libGL.so.$NV_VERSION libGL.so.$NV_VERSION-nvidia + mv libGL.so.$NV_VERSION libGL.so.$NV_VERSION-nvidia + mv libGL.la libGL.la-nvidia + if [ -e libGL.so.$GL_VERSION-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.$GL_VERSION libGL.so + mv libGL.la-xorg libGL.la + else + echo WARNING: libGL.so is missing. + fi + mv libEGL.so.$NV_VERSION libEGL.so.$NV_VERSION-nvidia + if [ -e libEGL.so.1.0.0-xorg ]; then + mv libEGL.so.1.0.0-xorg libEGL.so.1.0.0 + ln -sf libEGL.so.1.0.0 libEGL.so.1 + ln -sf libEGL.so.1.0.0 libEGL.so + mv libEGL.la-xorg libEGL.la + fi + fi cd "$CWD" } @@ -105,29 +126,6 @@ save_glx(){ cd "$CWD" } -multilib(){ -# rejigger multilib paths/links - cd $LIB32 - if [ "$1" = "nvidia" ]; then - if [ ! -e libGL.so.$GL_VERSION-xorg ]; then - mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg - fi - mv 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 - fi - - if [ "$1" = "xorg" ]; then - if [ -e libGL.so.$GL_VERSION-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.$GL_VERSION libGL.so - fi - mv libGL.so.$NV_VERSION libGL.so.$NV_VERSION-nvidia - fi - cd "$CWD" -} - nvidia_ldconfig(){ /sbin/ldconfig #Generate correct symink for that lib @@ -140,16 +138,16 @@ nvidia_install(){ echo "and in /etc/X11/xorg.conf.d." echo "Otherwise, this may lead to improperly working drivers." - save_GL "nvidia" + save_GL "nvidia" $LIB save_wfb "nvidia" save_glx "nvidia" # Check for multilib configuration if [ "$COMPAT32" = "yes" ]; then - multilib "nvidia" + save_GL "nvidia" $LIB32 fi - LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION" - nvidia_ldconfig $LD_NVIDIA +# LD_NVIDIA="${LIB}/libGL.so.$NV_VERSION" +# nvidia_ldconfig $LD_NVIDIA } nvidia_remove(){ @@ -158,20 +156,20 @@ nvidia_remove(){ echo "and in /etc/X11/xorg.conf.d." echo "Otherwise, this may lead to improperly working drivers." - save_GL "xorg" + save_GL "xorg" $LIB save_wfb "xorg" save_glx "xorg" # Check for multilib configuration if [ "$COMPAT32" = "yes" ]; then - multilib "xorg" + save_GL "xorg" $LIB32 fi if [ -e $NV_CONF ]; then rm -f $NV_CONF fi - LD_NVIDIA="${LIB}/libGL.so.$GL_VERSION" - nvidia_ldconfig $LD_NVIDIA +# LD_NVIDIA="${LIB}/libGL.so.$GL_VERSION" +# nvidia_ldconfig $LD_NVIDIA # screws up multilub /usr/lib links? } usage(){ |