Lines 964-969
Link Here
|
964 |
return 0 |
964 |
return 0 |
965 |
} |
965 |
} |
966 |
|
966 |
|
|
|
967 |
get_kmod_filename_with_deps_recursive() { |
968 |
local _kmod=$1 _field _value _modpath _dep _deps |
969 |
shift 1 |
970 |
modinfo "$@" $_kmod 2>&${_fderr} | ( |
971 |
while read _field _value ; do |
972 |
case $_field in |
973 |
filename:) |
974 |
_modpath=$_value |
975 |
;; |
976 |
depends:) |
977 |
_deps=${_value//,/ } |
978 |
for _dep in $_deps ; do |
979 |
get_kmod_filename_with_deps_recursive $_dep "$@" |
980 |
done |
981 |
;; |
982 |
esac |
983 |
done |
984 |
echo $_modpath |
985 |
[[ $_modpath ]] || exit 1 |
986 |
) |
987 |
} |
988 |
|
967 |
# Do something with all the dependencies of a kernel module. |
989 |
# Do something with all the dependencies of a kernel module. |
968 |
# Note that kernel modules depend on themselves using the technique we use |
990 |
# Note that kernel modules depend on themselves using the technique we use |
969 |
# $1 = function to call for each dependency we find |
991 |
# $1 = function to call for each dependency we find |
Lines 972-988
Link Here
|
972 |
# rest of args = arguments to modprobe |
994 |
# rest of args = arguments to modprobe |
973 |
# _fderr specifies FD passed from surrounding scope |
995 |
# _fderr specifies FD passed from surrounding scope |
974 |
for_each_kmod_dep() { |
996 |
for_each_kmod_dep() { |
975 |
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0 |
997 |
local _func=$1 _kmod=$2 _modpath _found=0 |
976 |
shift 2 |
998 |
shift 2 |
977 |
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | ( |
999 |
for _modpath in `get_kmod_filename_with_deps_recursive ${_kmod} "$@"` ; do |
978 |
while read _cmd _modpath _options; do |
1000 |
$_func ${_modpath} |
979 |
[[ $_cmd = insmod ]] || continue |
1001 |
_found=1 |
980 |
$_func ${_modpath} || exit $? |
1002 |
done |
981 |
_found=1 |
1003 |
[[ $_found -ne 0 ]] |
982 |
done |
|
|
983 |
[[ $_found -eq 0 ]] && exit 1 |
984 |
exit 0 |
985 |
) |
986 |
} |
1004 |
} |
987 |
|
1005 |
|
988 |
# filter kernel modules to install certain modules that meet specific |
1006 |
# filter kernel modules to install certain modules that meet specific |