#!/bin/sh -e KREL=$1 { cat /lib/modules/$KREL/modules.dep ; cat /lib/modules/$KREL/modules.softdep | grep : | sed -e 's/^softdep //' -e 's/ \(pre\|post\):/:/' ; } \ | \ while read l ; do MOD=$(echo "$l" | sed -e 's/:.*//') MOD=$(basename $MOD .ko) DEPS="$(echo "$l" | sed -e 's/.*://')" moddeps="" for dep in $DEPS ; do dep=$(basename $dep .ko) moddeps="$moddeps $dep" done [ -n "$moddeps" ] && echo $MOD:$moddeps ||: done