View Single Post
Old 03-12-07, 08:42 PM   #4
macemoneta
Registered User
 
macemoneta's Avatar
 
Join Date: Oct 2002
Location: NJ
Posts: 159
Default Re: Request for the Linux Dev Driver folks: module auto-comp

It's easy to do this yourself. Just something like this to your /etc/rc.d/rc.local:

Code:
# Get the current kernel release
CURRENT=`/bin/uname -r`

# Get the previous kernel release
if [ -f /var/log/newkernel.last ]
then
   PREVIOUS=`/bin/cat /var/log/newkernel.last`
else
   PREVIOUS=""
fi

# Has the kernel release changed?
if [ "$CURRENT" != "$PREVIOUS" ]
then

   #--------------------------------
   # Are we running an older kernel?
   #--------------------------------
   if [[ "$CURRENT" < "$PREVIOUS" ]]
   then
      echo
      echo "--------------------------------"
      echo "Kernel version has changed:"
      echo "   Current:  $CURRENT"
      echo "   Previous: $PREVIOUS"
      echo
      echo "Ignoring return to older kernel"
      echo "--------------------------------"
      exit
   fi

   #-----------------------------------------------------
   # At this point, we know we are running a newer kernel
   #-----------------------------------------------------
   echo
   echo "--------------------------------"
   echo "Kernel version has changed:"
   echo "   Current:  $CURRENT"
   echo "   Previous: $PREVIOUS"
   echo
   echo "Rebuilding kernel drivers"
   echo "--------------------------------"

   #------------------------
   # Build the nVidia driver
   #------------------------
   echo
   echo "-----------------------------------"
   echo "Rebuilding the nVidia kernel driver"
   echo "-----------------------------------"
   echo
   /bin/sh /usr/local/src/NVIDIA-Linux-x86_64-1.0-9631-pkg2.run -s

   #--------------------------------
   # Remember the new kernel version
   #--------------------------------
   echo "$CURRENT" > /var/log/newkernel.last

else

   echo
   echo "---------------------------"
   echo "No change in kernel version"
   echo "---------------------------"
   echo

fi
Obviously, you'll need to change where you keep the driver.
macemoneta is offline   Reply With Quote