#!/bin/csh -f

if (`id -u` != 0) then
    echo "You must have root priveleges to install the 3c90x driver module."
    echo "Installation of 3c90x driver module failed."
    exit 1
endif

set kernel_release=`uname -r`

#
# Check to see if SMP (Multi-processor)
#
set thever=`uname -r | grep "smp"`
if ($thever == "") then
   set UPorSMP=UP
else
   set UPorSMP=SMP
endif

#echo "Attempting to install the ${kernel_release} version of the 3c90x driver module."
echo "You are running the ${kernel_release} version of kernel release $kernel_release..."
set kerv=`uname -r | grep "2.4."`
if ($kerv == "") then
  set module_dir = /lib/modules/$kernel_release/net
else
  set module_dir = /lib/modules/$kernel_release/kernel/drivers/net
endif
#

echo "Found modules directory $module_dir"
echo "Copying the driver module into the modules directory."
cp 3c90x.o $module_dir
if ($status != 0) then
    echo "You may need to compile the driver yourself."
    echo "Installation of 3c90x driver module failed."
    exit 3
endif

echo "Updating module dependencies..."
/sbin/depmod -a
if ($status != 0) then
    echo "Update of module dependencies failed... perhaps you've updated your system?"
    echo "Installation of 3c90x driver module failed."
    exit 4
endif
echo "Installation of 3c90x driver module was successful."
