Help me collecting your drivers postinstall scripts

Questions about hardware and drivers
Forum rules
Before you post please read this

Help me collecting your drivers postinstall scripts

Postby Schoelje on Tue Aug 21, 2012 3:05 pm

For LMDE I'm trying to create a program (a sort of advanced mintwelcome) that will help users to install some missing drivers.

So, I need your help collecting (bash) scripts you use after a clean install of LMDE.
It does not have to be fancy, just for me to know what is needed and what is the logic behind it (step-by-step).
The following is important to know:
  • What hardware (check with lspci): name, chipset, anything that matters.
  • Detailed description of the steps you take to install the drivers.

Below you find two examples.
Nvidia and ATI drivers
Code: Select all
#!/bin/bash
# Install Nvidia/ATI drivers on Debian
# Script date: 21/8/2012 - Schoelje (schoelje@hotmail.nl)

# Be root to run this script
if [ $UID -ne 0 ]; then
  echo "Login as root."
  su -c "$0 $@"
  exit
fi

LINE="=================================================="

# Get the hardware
CARD=`lspci | grep VGA`
CARD=${CARD#*: }

if [[ "$CARD" =~ "NVIDIA" ]]; then
  echo $LINE
  echo "This script installs the appropriate Nvidia drivers"
  echo $LINE
  read -e -p "Continue? [y/n] (default=n): " ANSWER

  case $ANSWER in
    y|Y|yes|YES|Yes)
      echo
      echo "Found graphics controller: $CARD"
     
      # Install nvidia-detect if it is not installed yet
      NVDET=`apt search nvidia-detect | grep ^i`
      if [ -z "$NVDET" ]; then
        echo
        echo "Install nvidia-detect to detect the needed drivers"
        apt-get -y install nvidia-detect
      fi

      # Get the right drivers for the card
      NVDRV=`nvidia-detect | grep nvidia- | tr -d ' '`
      if [ -z "$NVDRV" ]; then
        echo
        echo "Error: Cannot detect the needed driver."
        exit
      fi
   
      # Install drivers
      case $NVDRV in
        nvidia-glx)
          DRVINST=`apt search ^nvidia-glx | grep ^i`
          if [ -n "$DRVINST" ]; then
            echo "Removing old Nvidia drivers..."
            echo $LINE
            apt-get remove nvidia-kernel-dkms nvidia-glx
            echo
          fi
          echo "Installing Nvidia drivers..."
          echo $LINE
          apt-get install nvidia-kernel-dkms nvidia-glx build-essential nvidia-settings nvidia-xconfig
          ;;

        nvidia-glx-legacy-96xx)
          DRVINST=`apt search ^nvidia-glx-legacy-96xx | grep ^i`
          if [ -n "$DRVINST" ]; then
            echo "Removing old Nvidia legacy-96xx drivers..."
            echo $LINE
            apt-get remove nvidia-kernel-legacy-96xx-dkms nvidia-glx-legacy-96xx
            echo
          fi
          echo "Installing Nvidia legacy-96xx drivers..."
          echo $LINE
          apt-get install nvidia-kernel-legacy-96xx-dkms nvidia-glx-legacy-96xx build-essential nvidia-settings nvidia-xconfig
          ;;

        nvidia-glx-legacy-173xx)
          DRVINST=`apt search ^nvidia-glx-legacy-173xx | grep ^i`
          if [ -n "$DRVINST" ]; then
            echo "Removing old Nvidia legacy-173xx drivers..."
            echo $LINE
            apt-get remove nvidia-kernel-legacy-173xx-dkms nvidia-glx-legacy-173xx
            echo
          fi
          echo "Installing Nvidia legacy-173xx drivers..."
          echo $LINE
          apt-get install nvidia-kernel-legacy-173xx-dkms nvidia-glx-legacy-173xx build-essential nvidia-settings nvidia-xconfig
          ;;
     
        *)
          echo "Your Nvidia card driver cannot be determined."
          echo "Press ENTER to exit"
          read
          exit
      esac

      echo
      echo $LINE
      echo "Configure Nvidia and blacklist Nouveau"
      echo $LINE
      nvidia-xconfig
      echo "blacklist nouveau" > /etc/modprobe.d/blacklist-nouveau.conf
      ;;
     
    *)
      echo "User abort"
  esac
 
elif [[ "$CARD" =~ "ATI" ]]; then
  # The series 2000, 3000 and 4000 are not supported anymore
  # Users affected by this should switch to the free radeon driver: xserver-xorg-video-radeon
 
  STARTSERIE=5000

  # Split the card string into separate words and check for the Radeon series
  IFS=" "
  set $CARD
  i=0
  for ITEM
  do
    # Is it a number?
    if [[ "$ITEM" == ?(+|-)+([0-9]) ]]; then
      # Is the number between 1000 and STARTSERIE?
      if [ $ITEM -gt 1000 ] && [ $ITEM -lt $STARTSERIE ]; then
        echo $LINE
        echo "Your card with chip set $ITEM is not supported anymore"
        echo $LINE
       
        # Install xserver-xorg-video-radeon if it is not installed yet (it should be)
        RAD=`apt search xserver-xorg-video-radeon | grep ^i`
        if [ -z "$RAD" ]; then
          echo
          echo "Installing default Radeon driver xserver-xorg-video-radeon"
          echo $LINE
          apt-get -y install xserver-xorg-video-radeon
        fi
        exit
      fi
    fi
    ((i++))
  done
 
  echo $LINE
  echo "This script installs the appropriate ATI drivers"
  echo $LINE
  read -e -p "Continue? [y/n] (default=n): " ANSWER

  case $ANSWER in
    y|Y|yes|YES|Yes)
      echo
      echo $LINE
      echo "Get fglrx from sid repositories (not available in wheezy)"
      echo $LINE
      echo "deb http://ftp.us.debian.org/debian sid main contrib non-free" > /etc/apt/sources.list.d/debsid.list
      apt-get update
      apt-get install build-essential module-assistant fglrx-control fglrx-driver --reinstall
      rm /etc/apt/sources.list.d/debsid.list
      apt-get update

      echo
      echo $LINE
      echo "Create xorg.conf"
      echo $LINE
      aticonfig --initial
      ;;
     
    *)
      echo "User abort"
  esac
fi


Broadcom
Code: Select all
#!/bin/bash
# Install Broadcom STA drivers
# Script date: 21/8/2012 - Schoelje (schoelje@hotmail.nl)

# Be root to run this script
if [ $UID -ne 0 ]; then
  echo "Login as root."
  su -c "$0 $@"
  exit
fi

# Fill an array with chip sets to check
CHIPS=( 4311 4312 4313 4321 4322 43224 43225 )
LINE="=================================================="

# Get the hardware
CARD=`lspci | grep Wireless`
CARD=${CARD#*: }

# Check if it's Braodcom
if [[ "$CARD" =~ "Broadcom" ]]; then
  # Check for all chip sets in the array
  FOUND=0
  for CHIP in "${CHIPS[@]}"
  do
    if [[ "$CARD" =~ "$CHIP" ]]; then
      # Install drivers
      echo $LINE
      echo "This script installs the Broadcom STA drivers for chipset $CHIP"
      echo $LINE
      read -e -p "Continue? [y/n] (default=n): " ANSWER
      case $ANSWER in
        y|Y|yes|YES|Yes)
          apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms
          modprobe -r b44 b43 b43legacy ssb brcmsmac
          modprobe wl
          iwconfig
          FOUND=1
          ;;
        *)
          echo "User abort"
          ;;
      esac
    fi
  done

  if [ ! $FOUND ]; then
    echo "Your Broadcom chipset is not supported by this script"
  fi
fi
Last edited by Schoelje on Wed Aug 22, 2012 1:36 am, edited 4 times in total.
User avatar
Schoelje
Level 5
Level 5
 
Posts: 791
Joined: Wed Jan 18, 2012 6:25 am
Location: Netherlands

Linux Mint is funded by ads and donations.
 

Re: Help me collecting your drivers postinstall scripts

Postby gychang on Tue Aug 21, 2012 9:10 pm

this is great, since I need to install ATI driver on my xfce version, will be waiting...

gychang
--
cruising the desert
--
User avatar
gychang
Level 3
Level 3
 
Posts: 143
Joined: Tue Dec 09, 2008 12:24 pm

Re: Help me collecting your drivers postinstall scripts

Postby Schoelje on Wed Aug 22, 2012 12:04 am

You could test the above mentioned "Nvidia and ATI drivers" script (but not before you made an image of your system).
Just copy and paste it into a text file, make it executable and run it.
Don't forget to post back the results: it's a work in progress.
User avatar
Schoelje
Level 5
Level 5
 
Posts: 791
Joined: Wed Jan 18, 2012 6:25 am
Location: Netherlands

Re: Help me collecting your drivers postinstall scripts

Postby Schoelje on Fri Aug 24, 2012 1:17 pm

It seems there is not much interest here, so I'll leave it with the two scripts I now have and include them in the unofficial LMDE KDE.
User avatar
Schoelje
Level 5
Level 5
 
Posts: 791
Joined: Wed Jan 18, 2012 6:25 am
Location: Netherlands

Re: Help me collecting your drivers postinstall scripts

Postby zerozero on Fri Aug 24, 2012 8:02 pm

this is not a bash script and is not even mine :lol: but i thought that it deserved to be mentioned here viewtopic.php?f=29&t=109647&start=0
this is important specially if you are in i486 and go to pae: sometimes the headers are not installed and i already saw here some "accidents" because of that.
zerozero
Level 16
Level 16
 
Posts: 6467
Joined: Tue Jul 07, 2009 2:29 pm

Re: Help me collecting your drivers postinstall scripts

Postby Schoelje on Sat Aug 25, 2012 4:49 am

That is really something to consider.
I can't test it here, but I think the following script would do the trick:

Code: Select all
#!/bin/bash
# Install PAE headers
# Script date: 25/8/2012 - Schoelje (schoelje@hotmail.nl)

# Be root to run this script
if [ $UID -ne 0 ]; then
  echo "Login as root."
  su -c "$0 $@"
  exit
fi

LINE="=================================================="
NRCPUS=`cat /proc/cpuinfo | grep processor | wc -l`
LH=`uname -r`

if [ $NRCPUS -gt 1 ] && [[ "$LH" = *486* ]]; then
  echo $LINE
  echo "You have a multi-core system but are running a single core kernel."
  echo $LINE
  read -e -p "Do you want to upgrade your system? [y/n] (default=n): " ANSWER
  case $ANSWER in
    y|Y|yes|YES|Yes)
      apt-get install -y --force-yes linux-headers-686-pae linux-image-686-pae
      #apt-get purge linux-headers-486 linux-image-486
      ;;
    *)
      echo "User abort"
      ;;
  esac
fi


I could purge the 486 headers, but I'd rather not.
What do you think?
User avatar
Schoelje
Level 5
Level 5
 
Posts: 791
Joined: Wed Jan 18, 2012 6:25 am
Location: Netherlands

Re: Help me collecting your drivers postinstall scripts

Postby zerozero on Sat Aug 25, 2012 6:26 am

Schoelje wrote:I could purge the 486 headers, but I'd rather not.
What do you think?

tbh i don't know what's the best approach specially after reading this viewtopic.php?f=187&t=109005&start=80#p620313
zerozero
Level 16
Level 16
 
Posts: 6467
Joined: Tue Jul 07, 2009 2:29 pm

Linux Mint is funded by ads and donations.
 

Return to Hardware Support

Who is online

Users browsing this forum: No registered users and 1 guest