From: Michael Tremer Date: Sun, 6 Aug 2017 12:33:08 +0000 (+0000) Subject: Improve loading of kernel modules X-Git-Tag: 009~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd891ec481f9278b4831d542db3ca1fef2556d51;p=network.git Improve loading of kernel modules This does not need to call grep any more Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.util b/src/functions/functions.util index 018276cc..687d008f 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -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() {