diff options
-rwxr-xr-x | meta/recipes-kernel/modutils-initscripts/files/modutils.sh | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/meta/recipes-kernel/modutils-initscripts/files/modutils.sh b/meta/recipes-kernel/modutils-initscripts/files/modutils.sh index 9049bbb8aa..a78adf5729 100755 --- a/meta/recipes-kernel/modutils-initscripts/files/modutils.sh +++ b/meta/recipes-kernel/modutils-initscripts/files/modutils.sh | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | LOAD_MODULE=modprobe | 14 | LOAD_MODULE=modprobe |
15 | [ -f /proc/modules ] || exit 0 | 15 | [ -f /proc/modules ] || exit 0 |
16 | [ -f /etc/modules ] || exit 0 | 16 | [ -f /etc/modules ] || [ -d /etc/modules-load.d ] || exit 0 |
17 | [ -e /sbin/modprobe ] || LOAD_MODULE=insmod | 17 | [ -e /sbin/modprobe ] || LOAD_MODULE=insmod |
18 | 18 | ||
19 | if [ ! -f /lib/modules/`uname -r`/modules.dep ]; then | 19 | if [ ! -f /lib/modules/`uname -r`/modules.dep ]; then |
@@ -21,15 +21,31 @@ if [ ! -f /lib/modules/`uname -r`/modules.dep ]; then | |||
21 | depmod -Ae | 21 | depmod -Ae |
22 | fi | 22 | fi |
23 | 23 | ||
24 | loaded_modules=" " | ||
25 | |||
26 | process_file() { | ||
27 | file=$1 | ||
28 | |||
29 | (cat $file; echo; ) | | ||
30 | while read module args | ||
31 | do | ||
32 | case "$module" in | ||
33 | \#*|"") continue ;; | ||
34 | esac | ||
35 | [ -n "$(echo $loaded_modules | grep " $module ")" ] && continue | ||
36 | [ "$VERBOSE" != no ] && echo -n "$module " | ||
37 | eval "$LOAD_MODULE $module $args >/dev/null 2>&1" | ||
38 | loaded_modules="${loaded_modules}${module} " | ||
39 | done | ||
40 | } | ||
41 | |||
24 | [ "$VERBOSE" != no ] && echo -n "Loading modules: " | 42 | [ "$VERBOSE" != no ] && echo -n "Loading modules: " |
25 | (cat /etc/modules; echo; ) | | 43 | [ -f /etc/modules ] && process_file /etc/modules |
26 | while read module args | 44 | |
27 | do | 45 | [ -d /etc/modules-load.d ] || exit 0 |
28 | case "$module" in | 46 | |
29 | \#*|"") continue ;; | 47 | for f in /etc/modules-load.d/*.conf; do |
30 | esac | 48 | process_file $f |
31 | [ "$VERBOSE" != no ] && echo -n "$module " | ||
32 | eval "$LOAD_MODULE $module $args >/dev/null 2>&1" | ||
33 | done | 49 | done |
34 | [ "$VERBOSE" != no ] && echo | 50 | [ "$VERBOSE" != no ] && echo |
35 | 51 | ||