Paste #261459

   
pasted on 16.03.2022 13:20
  • Edit to this paste
  • Print
  • Raw
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
load_drv()
{
  # invoke insmod with all arguments we got
  # and use a pathname, as newer modutils don't look in . by default
  if [ -n "$KERNEL_V26" ]; then
	modparas=""
	modflag=""
  else
	modparas="Configuration_Interface=$1 baseAddress=$2 regSpacing=$3 IOMap=$4"
	modflag=""
  fi

  if [ -f /etc/redhat-release ]; then
	DISTRO=redhat
	DISTROFILE=/etc/redhat-release
  elif [ -f /etc/SuSE-release ]; then
	DISTRO=suse
	DISTROFILE=/etc/SuSE-release
  elif [ -f /etc/UnitedLinux-release ]; then
	DISTRO=UnitedLinux
	DISTROFILE=/etc/UnitedLinux-release
  elif [ -f /etc/issue ]; then
	if [ "`cat /etc/issue | grep -i "vmware esx"`" != "" ]; then
	  DISTRO=vmesx
	  DISTROFILE=/etc/issue
	fi
        fi

  if [ "$DISTRO" == "UnitedLinux" ]; then
	DISTRO=suse
  fi

  if [ "`cat /proc/modules | grep $module`" = "" ]; then
	if [ -f $MODPATH/$module.$modsuf ]; then
	  # for kernels built with 64GB RAM mode, we have to use '-f' to force install
	  # the driver.
	  if [ "`uname -r | grep 64GB`" != "" ]; then
	          if [ "$DISTRO" == "suse" ]; then
		  # /sbin/insmod  $module $modparas &> /dev/null
		    /sbin/insmod -f $module $modparas
                          else  
		    /sbin/insmod  $module $modparas &> /dev/null
		  # /sbin/insmod -f $modflag $module $modparas
                                fi 
	  else
	          if [ "$DISTRO" == "suse" ]; then
		     if [ "`uname -r | awk -F'-' '{print $1}'`" = "2.6.5" ]; then
	                    /sbin/modprobe $modflag $module $modparas
		     elif [ "`uname -r | awk -F'-' '{print $1}'`" = "2.6.13" ]; then
	                   /sbin/modprobe $modflag $module $modparas
		     elif [ "`uname -r | awk -F'-' '{print $1}'`" = "2.6.16.21" ]; then
	                   /sbin/modprobe $modflag $module $modparas
                                     else
		         /sbin/insmod -f $modflag $module $modparas 
		     fi
		else
		     if [ "`uname -r | awk -F'-' '{print $1}'`" = "2.4.21" ]; then
		         /sbin/insmod -f $modflag $module $modparas 
                                     else
	                   /sbin/modprobe $modflag $module $modparas
                                     fi
                                fi
	  fi
	elif [ -f `pwd`/$module.$modsuf ]; then
	  /sbin/insmod -f $module.$modsuf $modparas
	else
	  echo "ERROR: cannot find $module.$modsuf in $MODPATH and current dir, abort."
	  return 1
	fi
	[ $? -ne 0 ] && return 1
  else
	echo "$module.$modsuf already inserted into kernel."
	return 1
  fi

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

  rm -f $device
  mknod $device c $major 0

  chmod $mode $device

  return 0
}
Add Comment
Author