wok annotate linux/stuff/list_modules.sh @ rev 8386

ocsinventory-agent: add patch for MANIFEST and Drives.pm
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Fri Feb 04 17:08:27 2011 +0100 (2011-02-04)
parents 720fade32b40
children 81e766fe2520
rev   line source
pascal@886 1 #!/bin/sh
pascal@886 2 # list_modules.sh: list Linux kernel modules for SliTaz GNU/Linux.
pascal@886 3 # 2008/06/07 <pascal.bellard@slitaz.org> - GNU General Public License.
pascal@886 4 #
pascal@886 5
pascal@4269 6 find_modules()
pascal@4269 7 {
pascal@4269 8 find $_pkg/lib/modules/*-slitaz/kernel/$1 -type f -exec basename {} \;
pascal@4269 9 }
pascal@4269 10
pascal@886 11 if [ -z "$1" ] ; then
pascal@886 12 cat 1>&2 <<EOT
pascal@886 13
pascal@886 14 \033[1musage:\033[0m `basename $0` path/to/kernel-modules-subtrees
pascal@886 15 exemple `basename $0` drivers/net/wireless >list
pascal@886 16
pascal@886 17 EOT
pascal@886 18 exit 1
pascal@886 19 fi
pascal@886 20
pascal@1032 21 if [ -z "$(ls -d $_pkg/lib/modules/*-slitaz/kernel/$1 2> /dev/null)" ] ; then
pascal@886 22 cat 1>&2 <<EOT
pascal@886 23
pascal@886 24 Error : $1 does not exist.
pascal@886 25
pascal@886 26 EOT
pascal@886 27 exit 1
pascal@886 28 fi
pascal@886 29
pascal@886 30 for tree in $@; do
pascal@4269 31 for module in $(find_modules $tree) ; do
pascal@1909 32 grep /$module: $_pkg/lib/modules/*-slitaz/modules.dep ||
pascal@1909 33 find $_pkg/lib/modules/*-slitaz/kernel/$tree -name $module
pascal@886 34 done | awk '{ for (i = 1; i <= NF; i++) print $i; }'
pascal@3540 35 done | sort | uniq | sed -e 's,.*slitaz/,,' -e 's,^kernel/,,' -e 's/:$//' | \
pascal@886 36 while read module; do
pascal@886 37 grep -qs ^$module$ $src/modules.list && continue
pascal@4270 38 if [ ! -f $_pkg/lib/modules/*-slitaz/kernel/$module ]; then
pascal@4270 39 (cd $_pkg/lib/modules/*-slitaz/kernel; find -name $(basename $module) )
pascal@4270 40 else
pascal@4270 41 echo $module
pascal@4270 42 fi
pascal@886 43 done