]> git.ipfire.org Git - people/ms/network.git/commitdiff
Improve loading of kernel modules
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Aug 2017 12:33:08 +0000 (12:33 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Aug 2017 12:33:08 +0000 (12:33 +0000)
This does not need to call grep any more

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.util

index 018276cc73075bcce24ab2288808fd271bf00f17..687d008f8f423f4e4d346325e6fc090f6f62869d 100644 (file)
@@ -607,10 +607,13 @@ beautify_bytes() {
 module_load() {
        local module=${1}
 
-       if ! grep -q "^${module}" /proc/modules; then
-               log DEBUG "Loading module '${module}'."
-               modprobe ${module}
+       # Do nothing if the module is already loaded
+       if [ -d "/sys/module/${module//-/_}" ]; then
+               return ${EXIT_OK}
        fi
+
+       log DEBUG "Loading kernel module ${module}"
+       modprobe "${module}"
 }
 
 binary_exists() {