aboutsummaryrefslogtreecommitdiff
path: root/hwdetect
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2005-11-15 02:51:52 +0000
committerJudd Vinet <judd@archlinux.org>2005-11-15 02:51:52 +0000
commit2dc0038155b978eb70be482313cc8535dadc436d (patch)
tree211ff698f3b20d73013d70d3f2aad9a87556bf67 /hwdetect
parentabdeaf8051aaadb9f5270a14e45481a8d61e0b95 (diff)
downloadinitscripts-2dc0038155b978eb70be482313cc8535dadc436d.tar.xz
added variables for autoloading modules, cleaned up rc.conf a bit
Diffstat (limited to 'hwdetect')
-rwxr-xr-xhwdetect39
1 files changed, 25 insertions, 14 deletions
diff --git a/hwdetect b/hwdetect
index cb3bf1a..450e438 100755
--- a/hwdetect
+++ b/hwdetect
@@ -33,11 +33,18 @@ usage () {
[ "$1" == "" ] && usage
+: >/tmp/modules-plain
+: >/tmp/modules-sorted
+: >/tmp/moduleslist
+: >/tmp/modprobe
+: >/tmp/modules
+
# find pci aliases
find /sys/devices/ -name "modalias" | grep pci > /tmp/modules
# delete pci devices that are blacklisted
-for i in "${BLACKLIST[@]}"; do
+for i in $PCI_BLACKLIST; do
+ [ "$i" ] || continue
sed -i -e "/$i/d" /tmp/modules
done
@@ -66,21 +73,25 @@ done
sort -u /tmp/modules-plain >> /tmp/modules-sorted
sed -ne "s#^insmod.*/\(.*\)\.ko.*#\1#p" /tmp/modules-sorted >> /tmp/moduleslist
-listex() {
- ln=$1 ; shift
- if [ $# -gt 0 ]; then
- ex=$1 ; shift
- if [ "`echo $ln | grep -v $ex`" ]; then
- listex "$ln" $*
- fi
- else
- echo $ln | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
- fi
-}
+# delete modules that are blacklisted
+for i in $BLACKLIST; do
+ [ "$i" ] || continue
+ sed -i -e "/^$i$/d" /tmp/moduleslist
+done
+
listmods() {
key=$1 ; shift
- for ln in `grep "$key" /tmp/modules-sorted | sed 's|^insmod ||g' | sort -u`; do
- listex "$ln" $*
+ ex=
+ while [ "$1" ]; do
+ [ "$ex" ] && ex="$ex|$1" || ex="$1"
+ shift
+ done
+ for ln in `grep "$key" /tmp/modules-sorted | sed 's|^insmod ||g'`; do
+ if [ "$ex" ]; then
+ echo $ln | egrep -v "$ex" | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
+ else
+ echo $ln | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p"
+ fi
done
}
showlist() {