CDNWiki
View Source:
KnowledgeBase/FreeBSD/srcsysmod_kmod.sh
Note:
You are viewing an old version of this page.
View the current version.
I suggest redirecting the results into a cachefile, because the extraction is pretty slow. <code brush=bash> srcsysmod_kmod() { tab="$(printf "\t")" ( cd /usr/src/sys/modules find . -type f -name 'Makefile' | sed -e 's#^\./##' | xargs dirname | sort | while read dir do # Slower but more precise #kmod="$(make -C "./${dir}" -V KMOD)" # Faster, but might be incorrect if the makefile does voodoo makefile="${dir}/Makefile" kmod="$(sed -e "/^KMOD/"\!"d; s/^KMOD[ ${tab}]*=[ ${tab}]*//" "${makefile}")" # Format and display the results [ "${kmod}" ] && echo "${dir}${tab}${kmod}" done ) } </code>