slitaz-tools rev 940
tazhw: fix module names
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Apr 27 09:50:52 2015 +0200 (2015-04-27) |
parents | 5d80f6fdbdb7 |
children | 4475062064ee |
files | tinyutils/tazhw |
line diff
1.1 --- a/tinyutils/tazhw Fri Apr 17 07:35:02 2015 +0300 1.2 +++ b/tinyutils/tazhw Mon Apr 27 09:50:52 2015 +0200 1.3 @@ -90,6 +90,20 @@ 1.4 } 1.5 1.6 1.7 +module_name() 1.8 +{ 1.9 + local mod mod2 1.10 + while read mod; do 1.11 + if [ -d /sys/module -a ! -d /sys/module/$mod ]; then 1.12 + mod2=$(ls -d /sys/module/*/drivers/*:$mod 2>/dev/null | \ 1.13 + sed 's|/sys/module/\(.*\)/drivers/.*|\1|') 1.14 + [ "$mod2" ] && mod=$mod2 1.15 + fi 1.16 + echo ${mod//-/_} 1.17 + done 1.18 +} 1.19 + 1.20 + 1.21 # Detect PCI devices and load kernel module only at first boot, 1.22 # in LiveCD mode or with the command 'detect-pci'. 1.23 1.24 @@ -97,7 +111,7 @@ 1.25 if [ ! -s /var/lib/detected-modules ]; then 1.26 . /etc/rcS.conf 1.27 # We need module_name to match output of lsmod. 1.28 - list=$(lspci -k | grep "driver" | cut -d ":" -f 2 | sed s/-/_/g) 1.29 + list=$(lspci -k | grep "driver" | cut -d ":" -f 2 | module_name) 1.30 echo "$list" > /var/lib/detected-modules 1.31 for mod in $(cat /var/lib/detected-modules | uniq) 1.32 do