From: Fabien Poussin Date: Mon, 26 Aug 2019 10:25:52 +0000 (+0200) Subject: Adding kernel modules script X-Git-Tag: v0.8.0~49^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1724136d9944af05893d237d4304a0a15938bdbc;p=oweals%2Fdinit.git Adding kernel modules script --- 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