From 1724136d9944af05893d237d4304a0a15938bdbc Mon Sep 17 00:00:00 2001 From: Fabien Poussin Date: Mon, 26 Aug 2019 12:25:52 +0200 Subject: [PATCH] Adding kernel modules script --- doc/linux/services/modules | 6 ++++++ doc/linux/services/modules.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 doc/linux/services/modules create mode 100755 doc/linux/services/modules.sh diff --git a/doc/linux/services/modules b/doc/linux/services/modules new file mode 100644 index 0000000..eeb7bc8 --- /dev/null +++ b/doc/linux/services/modules @@ -0,0 +1,6 @@ +# Load kernel modules from /etc/modules + +type = scripted +command = /etc/dinit.d/modules.sh start +restart = false +depends-on = early-filesystems diff --git a/doc/linux/services/modules.sh b/doc/linux/services/modules.sh new file mode 100755 index 0000000..425f33b --- /dev/null +++ b/doc/linux/services/modules.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +MODULES=/etc/modules + +# Check that the kernel has module support. +[ -e /proc/ksyms -o -e /proc/modules ] || exit 0 + +case "${1}" in + start) + + # Exit if there's no modules file or there are no valid entries + [ -r ${MODULES} ] && egrep -qv '^($|#)' ${MODULES} || exit 0 + + while read module args; do + + # Ignore comments and blank lines. + case "$module" in + ""|"#"*) continue ;; + esac + + # Try to load the module with its arguments + modprobe ${module} ${args} > /dev/null + done < ${MODULES} + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac -- 2.25.1