wok-current view linux/stuff/list_modules.sh @ rev 16265
Up cookutils 3.3.1
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Apr 05 11:16:11 2014 +0000 (2014-04-05) |
parents | 428ce15cd9ff |
children | 31ece15b363f |
line source
1 #!/bin/sh
2 # list_modules.sh: list Linux kernel modules for SliTaz GNU/Linux.
3 # 2008/06/07 <pascal.bellard@slitaz.org> - GNU General Public License.
4 #
6 find_modules() {
7 find $install/lib/modules/*-slitaz/kernel/$1 -type f -exec basename {} \;
8 }
10 if [ -z "$1" ] ; then
11 cat 1>&2 <<EOT
13 \033[1musage:\033[0m `basename $0` path/to/kernel-modules-subtrees
14 exemple `basename $0` drivers/net/wireless >list
16 EOT
17 exit 1
18 fi
20 if [ -z "$(ls -d $install/lib/modules/*-slitaz/kernel/$1 2> /dev/null)" ] ; then
21 cat 1>&2 <<EOT
23 Error : $1 does not exist.
25 EOT
26 exit 1
27 fi
29 for tree in $@; do
30 for module in $(find_modules $tree) ; do
31 grep /$module: $install/lib/modules/*-slitaz/modules.dep ||
32 find $install/lib/modules/*-slitaz/kernel/$tree -name $module
33 done | awk '{ for (i = 1; i <= NF; i++) print $i; }'
34 done | sort | uniq | sed -e 's,.*slitaz/,,' -e 's,^kernel/,,' -e 's/:$//' | \
35 while read module; do
36 grep -qs ^$module$ $src/../tmp/modules.list && continue
37 if [ ! -f $install/lib/modules/*-slitaz/kernel/$module ]; then
38 (cd $install/lib/modules/*-slitaz/kernel; find -name $(basename $module) )
39 else
40 echo $module
41 fi
42 done