]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/install+setup/install/probehw.sh
Ein Paar Dateien fuer die GPLv3 angepasst.
[people/teissler/ipfire-2.x.git] / src / install+setup / install / probehw.sh
1 #!/bin/sh
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 ###############################################################################
21
22 echo "Detecting Hardware..."
23 for MODULE in $(kudzu -qps -t 30 | grep driver: | cut -d ' ' -f 2 | sort | uniq); do
24 if [ "${MODULE}" = "unknown" ] || \
25 [ "${MODULE}" = "ignore" ] || \
26 [ "${MODULE}" = "" ]; then
27 continue
28 fi
29 MODULE=$(basename $(find /lib/modules -name $(echo $MODULE | sed -e 's/[_-]/*/g')* ) | cut -d. -f1 | head -1 2>/dev/null)
30 [ "${MODULE}" == "" ] && continue
31
32 if grep -Eqe "^${MODULE} " /proc/modules; then
33 continue
34 fi
35 echo -n "Loading ${MODULE}"
36 modprobe ${MODULE} >/dev/null 2>&1
37 echo " --> ecode: $?"
38 done
39
40 sleep 10
41
42 if [ $# -eq 0 ]; then
43 exit 0
44 fi
45
46 ## If the autodetection fails we will try to load every module...
47 ## Do this only when we want...
48
49 for i in a b c d e f g; do
50 if [ ! -e /dev/sd$i ]; then
51 DEVICE="/dev/sd$i"
52 echo "Checking for: $DEVICE"
53 break
54 fi
55 done
56
57 for MODULE in $(ls /lib/modules/*/kernel/drivers/scsi); do
58 MODULE=`basename $MODULE | awk -F. '{ print $1 }'`
59
60 echo -n "Probing for $MODULE"
61 modprobe $MODULE >/dev/null 2>&1
62 RETVAL=$?
63 echo " --> ecode: $RETVAL"
64 if [ "$RETVAL" -eq "0" ]; then
65 sleep 3
66 if [ -e "$DEVICE" ]; then
67 break
68 fi
69 fi
70
71 done
72
73 sleep 5
74
75 exit 0