wok-next annotate linux-libre/stuff/list_modules.sh @ rev 16567

Up: slitaz-boot-scripts + slitaz-tools (urgent bug fix)
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 01 22:17:02 2014 +0200 (2014-05-01)
parents
children
rev   line source
gokhlayeh@9257 1 #!/bin/sh
gokhlayeh@9257 2 # list_modules.sh: list Linux kernel modules for SliTaz GNU/Linux.
gokhlayeh@9257 3 # 2008/06/07 <pascal.bellard@slitaz.org> - GNU General Public License.
gokhlayeh@9257 4 #
gokhlayeh@9257 5
gokhlayeh@9257 6 find_modules()
gokhlayeh@9257 7 {
gokhlayeh@9257 8 find $_pkg/lib/modules/*-slitaz/kernel/$1 -type f -exec basename {} \;
gokhlayeh@9257 9 }
gokhlayeh@9257 10
gokhlayeh@9257 11 if [ -z "$1" ] ; then
gokhlayeh@9257 12 cat 1>&2 <<EOT
gokhlayeh@9257 13
gokhlayeh@9257 14 \033[1musage:\033[0m `basename $0` path/to/kernel-modules-subtrees
gokhlayeh@9257 15 exemple `basename $0` drivers/net/wireless >list
gokhlayeh@9257 16
gokhlayeh@9257 17 EOT
gokhlayeh@9257 18 exit 1
gokhlayeh@9257 19 fi
gokhlayeh@9257 20
gokhlayeh@9257 21 if [ -z "$(ls -d $_pkg/lib/modules/*-slitaz/kernel/$1 2> /dev/null)" ] ; then
gokhlayeh@9257 22 cat 1>&2 <<EOT
gokhlayeh@9257 23
gokhlayeh@9257 24 Error : $1 does not exist.
gokhlayeh@9257 25
gokhlayeh@9257 26 EOT
gokhlayeh@9257 27 exit 1
gokhlayeh@9257 28 fi
gokhlayeh@9257 29
gokhlayeh@9257 30 for tree in $@; do
gokhlayeh@9257 31 for module in $(find_modules $tree) ; do
gokhlayeh@9257 32 grep /$module: $_pkg/lib/modules/*-slitaz/modules.dep ||
gokhlayeh@9257 33 find $_pkg/lib/modules/*-slitaz/kernel/$tree -name $module
gokhlayeh@9257 34 done | awk '{ for (i = 1; i <= NF; i++) print $i; }'
gokhlayeh@9257 35 done | sort | uniq | sed -e 's,.*slitaz/,,' -e 's,^kernel/,,' -e 's/:$//' | \
gokhlayeh@9257 36 while read module; do
gokhlayeh@9257 37 grep -qs ^$module$ $src/modules.list && continue
gokhlayeh@9257 38 if [ ! -f $_pkg/lib/modules/*-slitaz/kernel/$module ]; then
gokhlayeh@9257 39 (cd $_pkg/lib/modules/*-slitaz/kernel; find -name $(basename $module) )
gokhlayeh@9257 40 else
gokhlayeh@9257 41 echo $module
gokhlayeh@9257 42 fi
gokhlayeh@9257 43 done