3 # geninitrd mod: depmod for 2.4 kernel
5 # Finds module dependencies
8 # @param $mode [silent]
10 # Outputs each dependant module full path.
15 typeset mods module f level depfile first
17 depfile=/lib/modules/$kernel/modules.dep
19 if [ ! -f $depfile ]; then
20 die "No $depfile! Run depmod and rerun $PROGRAM."
23 # prepend / if no path given, append $modext.gz if not given,
26 module=$(echo "$2" | \
27 awk '/\// {print;next} {print "/" $0}' | \
28 awk '/\./ {print;next} {print $0 "'$modext'.gz"}' |
29 awk '{gsub("/","\\/");print}')
32 /'"$module"':(.*)/ { gsub(/:/," "); gsub(/\\/," "); print; here = 1; next }
34 /(.*)/ { gsub(/\\/," "); if (here) print }
38 if [ "$mods" = "" ]; then
39 module=$(echo "$module" | awk '{gsub("\'$modext'\.gz$","\'$modext'",$0);print}')
45 /'"$module"':(.*)/ { gsub(/:/," "); gsub(/\\/," "); print; here = 1; next }
47 /(.*)/ { gsub(/\\/," "); if (here) print }
50 if [ "$mods" = "" ]; then
51 if [ "$1" != silent ]; then
52 warn "$origmodule: module not found in $depfile"
54 if ! is_no "$EXIT_IF_MISSING"; then
57 warn "If $origmodule isn't compiled in kernel then this initrd may not start your system."
62 if [ "$level" = "" ]; then
66 if [ $level -gt 20 ]; then
67 die "$origmodule: cycle in $depfile"
72 if [ "$first" = "" ]; then
75 find_depmod $1 $f $level