]>
Commit | Line | Data |
---|---|---|
72d80898 MT |
1 | #!/bin/sh |
2 | ||
ee78a5ef MT |
3 | echo "Detecting Hardware..." |
4 | for MODULE in $(kudzu -qps -t 30 | grep driver: | cut -d ' ' -f 2 | sort | uniq); do | |
72d80898 MT |
5 | if [ "${MODULE}" = "unknown" ] || \ |
6 | [ "${MODULE}" = "ignore" ]; then | |
7 | continue | |
8 | fi | |
bba7212c MT |
9 | MODULE=$(basename $(find /lib/modules -name $(echo $MODULE | sed -e 's/[_-]/*/g')* ) | cut -d. -f1 | head -1) |
10 | ||
72d80898 MT |
11 | if grep -Eqe "^${MODULE} " /proc/modules; then |
12 | continue | |
13 | fi | |
ee78a5ef MT |
14 | echo -n "Loading ${MODULE}" |
15 | modprobe ${MODULE} >/dev/null 2>&1 | |
16 | echo " --> ecode: $?" | |
72d80898 MT |
17 | done |
18 | ||
51f3b7f5 MT |
19 | sleep 10 |
20 | ||
ee78a5ef MT |
21 | if [ $# -eq 0 ]; then |
22 | exit 0 | |
23 | fi | |
24 | ||
25 | ## If the autodetection fails we will try to load every module... | |
26 | ## Do this only when we want... | |
27 | ||
28 | for i in a b c d e f g; do | |
29 | if [ ! -e /dev/sd$i ]; then | |
30 | DEVICE="/dev/sd$i" | |
31 | echo "Checking for: $DEVICE" | |
32 | break | |
33 | fi | |
34 | done | |
35 | ||
36 | for MODULE in $(ls /lib/modules/*/kernel/drivers/scsi); do | |
37 | MODULE=`basename $MODULE | awk -F. '{ print $1 }'` | |
38 | ||
39 | echo -n "Probing for $MODULE" | |
40 | modprobe $MODULE >/dev/null 2>&1 | |
41 | RETVAL=$? | |
42 | echo " --> ecode: $RETVAL" | |
43 | if [ "$RETVAL" -eq "0" ]; then | |
44 | sleep 3 | |
45 | if [ -e "$DEVICE" ]; then | |
46 | break | |
47 | fi | |
48 | fi | |
49 | ||
50 | done | |
51 | ||
52 | sleep 5 | |
53 | ||
72d80898 | 54 | exit 0 |