Help me collecting your drivers postinstall scripts

Archived topics about LMDE 1 and LMDE 2
Locked
Schoelje

Help me collecting your drivers postinstall scripts

Post by Schoelje »

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 LockBot on Wed Dec 28, 2022 7:16 am, edited 5 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gychang

Re: Help me collecting your drivers postinstall scripts

Post by gychang »

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

gychang
Schoelje

Re: Help me collecting your drivers postinstall scripts

Post by Schoelje »

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.
Schoelje

Re: Help me collecting your drivers postinstall scripts

Post by Schoelje »

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.
zerozero

Re: Help me collecting your drivers postinstall scripts

Post by zerozero »

this is not a bash script and is not even mine :lol: but i thought that it deserved to be mentioned here http://forums.linuxmint.com/viewtopic.p ... 47&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.
Schoelje

Re: Help me collecting your drivers postinstall scripts

Post by Schoelje »

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?
zerozero

Re: Help me collecting your drivers postinstall scripts

Post by zerozero »

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 http://forums.linuxmint.com/viewtopic.p ... 80#p620313
Locked

Return to “LMDE Archive”