Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Paste Description for zeroflag

Script to install NVIDIA drivers into Ubuntu feisty (7.04).

zeroflag
Thursday, April 12th, 2007 at 10:29:08am UTC 

  1. #!/bin/bash
  2. #################################################################
  3. #
  4. # Simple script to install NVIDIA's driver packages into ubuntu (Tested with feisty x64).
  5. # Copyright (C) 2007  Thomas "zeroflag" Kraemer
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. #
  17. #################################################################
  18.  
  19. # I KNOW this script looks like crap but this is the first bash script I've done, ever.
  20. # plus, I only used linux for a couple of days so if anything goes wrong, feel free to complain, but it's still on you. ;)
  21.  
  22. wm="gdm"
  23. if [[ "$1" = "-k" || "$1" = "-kde" || "$1" = "--kde" ]]; then
  24.         wm="kde"
  25.         shift;
  26. fi
  27.  
  28. platform=`uname -m`
  29. lib="lib"
  30. if [ "$platform" = "x86_64" ]; then
  31.         lib="lib64"
  32.         echo "Working with x86_64 Platform and Window Manager $wm."
  33. else
  34.         echo "Working with x86 Platform and Window Manager $wm."
  35. fi
  36.  
  37. if [ "$1" = "" ]; then
  38.         echo "Usage:"
  39.         echo "nvidia_install [-k] <nvidia_driver_package.run> [autoconfig]"
  40.         echo "nvidia_install download"
  41.         echo ""
  42.         echo "  -k:       Works with KDE instead of Gnome."
  43.         echo "  <nvidia_driver_package.run>:"
  44.         echo "    A nvidia driver package for linux."
  45.         echo "    e.g. NVIDIA-Linux-x86_64-1.0-9755-pkg2.run"
  46.         echo "  autoconfig:       "
  47.         echo "    Will run nvidia-xconfig after installation."
  48.         echo "    Otherwise you'll have to edit /etc/X11/xorg.conf yourself."
  49.         echo ""
  50.         echo "  download:"
  51.         echo "    Will run w3m on http://www.nvidia.com/object/unix.html so you can download a kernel."
  52.         echo ""
  53.         echo "WARNING:   This will remove all restricted modules!"
  54.         echo "IMPORTANT: DO NOT RUN THIS SCRIPT FROM A GNOME/KDE TERMINAL!!!"
  55.         exit 0
  56. fi
  57.  
  58. exit 0
  59.  
  60. #set -x
  61. set -e
  62.  
  63. if [ "$1" = "download" ]; then
  64.         sudo apt-get -y install w3m
  65.         w3m http://www.nvidia.com/object/unix.html
  66. else
  67.  
  68.         file=$1
  69.         folder=${file%.run}
  70.  
  71.         echo "Will extract $file to $folder"
  72.  
  73.         echo "Stopping $wm..."
  74.         sudo /etc/init.d/$wm stop
  75.  
  76.         echo "Retrieving required packages..."
  77.         sudo apt-get -y install linux-headers-`uname -r` build-essential gcc gcc-3.4 xserver-xorg-dev
  78.  
  79.         echo "Puring restricted modules and old nvidia packages..."
  80.         sudo apt-get -y --purge remove linux-restricted-modules-`uname -r` linux-restricted-modules-common nvidia-glx nvidia-settings nvidia-kernel-common
  81.         sudo rm -f /etc/init.d/nvidia-*
  82.  
  83.         echo "Removing old driver folder..."
  84.         sudo rm -f -r $folder
  85.  
  86.         echo "Extracting nvidia driver package..."
  87.         bash $file --extract-only
  88.  
  89.         echo "Entering extracted folder..."
  90.         cd $folder
  91.  
  92.         echo "Running the installer..."
  93.         sudo ./nvidia-installer -n -s -a --no-questions --x-prefix=/usr/$lib/xorg/ --kernel-source-path=/usr/src/linux-headers-`uname -r`
  94.         echo "Installation finished."
  95.  
  96.         if [ $2 = autoconfig ]; then
  97.                 echo "Automated configuration..."
  98.                
  99.                 echo "Preparing configuration..."
  100.                 sudo apt-get -y install nvidia-xconfig
  101.                
  102.                 echo "Running configuration..."
  103.                 sudo nvidia-xconfig
  104.         fi
  105.  
  106.         echo "Restarting $wm..."
  107.         sudo /etc/init.d/$wm restart
  108.         echo "Done."
  109.  
  110. fi

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right