wok-current view linux/stuff/list_modules.sh @ rev 8571
imported patch get/pcsxr-svn
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sun Feb 13 22:57:56 2011 +0100 (2011-02-13) |
parents | 720fade32b40 |
children | 81e766fe2520 |
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