wok-next view linux-libre/stuff/list_modules.sh @ rev 13635
Up: evas (1.7.1)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Nov 16 00:00:19 2012 +0100 (2012-11-16) |
parents | |
children |
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 {
8 find $_pkg/lib/modules/*-slitaz/kernel/$1 -type f -exec basename {} \;
9 }
11 if [ -z "$1" ] ; then
12 cat 1>&2 <<EOT
14 \033[1musage:\033[0m `basename $0` path/to/kernel-modules-subtrees
15 exemple `basename $0` drivers/net/wireless >list
17 EOT
18 exit 1
19 fi
21 if [ -z "$(ls -d $_pkg/lib/modules/*-slitaz/kernel/$1 2> /dev/null)" ] ; then
22 cat 1>&2 <<EOT
24 Error : $1 does not exist.
26 EOT
27 exit 1
28 fi
30 for tree in $@; do
31 for module in $(find_modules $tree) ; do
32 grep /$module: $_pkg/lib/modules/*-slitaz/modules.dep ||
33 find $_pkg/lib/modules/*-slitaz/kernel/$tree -name $module
34 done | awk '{ for (i = 1; i <= NF; i++) print $i; }'
35 done | sort | uniq | sed -e 's,.*slitaz/,,' -e 's,^kernel/,,' -e 's/:$//' | \
36 while read module; do
37 grep -qs ^$module$ $src/modules.list && continue
38 if [ ! -f $_pkg/lib/modules/*-slitaz/kernel/$module ]; then
39 (cd $_pkg/lib/modules/*-slitaz/kernel; find -name $(basename $module) )
40 else
41 echo $module
42 fi
43 done