]>
Commit | Line | Data |
---|---|---|
72d80898 | 1 | #!/bin/sh |
70df8302 MT |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
72d80898 | 21 | |
ee78a5ef MT |
22 | echo "Detecting Hardware..." |
23 | for MODULE in $(kudzu -qps -t 30 | grep driver: | cut -d ' ' -f 2 | sort | uniq); do | |
d0f2cc42 MT |
24 | if [ "${MODULE}" = "unknown" ] || \ |
25 | [ "${MODULE}" = "ignore" ] || \ | |
26 | [ "${MODULE}" = "" ]; then | |
72d80898 | 27 | continue |
d0f2cc42 | 28 | fi |
f4e27420 | 29 | MODULE=$(find /lib/modules -name $(echo $MODULE | sed -e 's/[_-]/*/g')* 2>/dev/null) |
0db33b56 | 30 | [ "${MODULE}" == "" ] && continue |
f4e27420 | 31 | MODULE=$(basename $MODULE | cut -d. -f1 | head -1) |
bba7212c | 32 | |
d0f2cc42 MT |
33 | if grep -Eqe "^${MODULE} " /proc/modules; then |
34 | continue | |
35 | fi | |
36 | echo -n "Loading ${MODULE}" | |
37 | modprobe ${MODULE} >/dev/null 2>&1 | |
ee78a5ef | 38 | echo " --> ecode: $?" |
72d80898 MT |
39 | done |
40 | ||
51f3b7f5 MT |
41 | sleep 10 |
42 | ||
ee78a5ef MT |
43 | if [ $# -eq 0 ]; then |
44 | exit 0 | |
45 | fi | |
46 | ||
47 | ## If the autodetection fails we will try to load every module... | |
48 | ## Do this only when we want... | |
49 | ||
50 | for i in a b c d e f g; do | |
51 | if [ ! -e /dev/sd$i ]; then | |
52 | DEVICE="/dev/sd$i" | |
53 | echo "Checking for: $DEVICE" | |
54 | break | |
55 | fi | |
56 | done | |
57 | ||
3d28f4f5 | 58 | for MODULE in $(ls /lib/modules/*/kernel/drivers/ata && ls /lib/modules/*/kernel/drivers/scsi); do |
ee78a5ef MT |
59 | MODULE=`basename $MODULE | awk -F. '{ print $1 }'` |
60 | ||
61 | echo -n "Probing for $MODULE" | |
62 | modprobe $MODULE >/dev/null 2>&1 | |
63 | RETVAL=$? | |
64 | echo " --> ecode: $RETVAL" | |
65 | if [ "$RETVAL" -eq "0" ]; then | |
66 | sleep 3 | |
67 | if [ -e "$DEVICE" ]; then | |
68 | break | |
69 | fi | |
70 | fi | |
71 | ||
72 | done | |
73 | ||
74 | sleep 5 | |
75 | ||
72d80898 | 76 | exit 0 |