#!/bin/bash
# Last Update: -Eagle Hou 2003-6-3 9:39-
#

module="wsmbdrv"
device="wsmbdrv"
group="wheel"
mode="664"

#if uname -a | grep "SMP"; then
#	RH72smp_opt="-P smp"
#	RH71smp_opt="-P smp"
#	RH70smp_opt="-P smp"
#	RH62smp_opt="-P smp"
#	RH60smp_opt="-P smp_"
#fi

# invoke insmod with all arguments we got
if grep $module /proc/devices; then
	echo $module" already installed"
	exit
else
  if uname -r | grep "2.4"; then
  	# RH7.x
	/sbin/insmod -f $module.o $* || exit 1
  else
    #if uname -r | grep "2.4.2"; then
  	# RH71
	#/sbin/insmod -f $RH71smp_opt $module.o $* || exit 1
    if (uname -r | grep "2.2.16") || (uname -r |grep "2.2.17"); then
	# RH70
	/sbin/insmod -f $RH70smp_opt $module.o $* || exit 1
    else
      if uname -r | grep "2.2.14"; then
	# RH62
	/sbin/insmod -f $RH62smp_opt $module.o $* || exit 1
      else
	# RH60
	/usr/local/share/asm/insmod -f $RH60smp_opt $module.o $* || exit 1
      fi	# RH62
    fi		# RH70
  fi		# RH71
fi		# installed

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`
#echo "major = "$major

# remove stale nodes and replace them, then give gid and perms
rm -f /dev/$device
mknod /dev/$device c $major 0
chgrp $group /dev/$device
chmod $mode  /dev/$device
