diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2014-07-29 16:18:42 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2014-07-29 16:27:06 +0200 |
commit | 80b066c83c83a5ba37181703716b7618232dda4e (patch) | |
tree | 1496586c74564fbabde4062800a36978fb346a0f /modules-load | |
parent | 355a02b5baa1287c9c1c3f35c189d22fde6e5323 (diff) | |
download | runit-void-80b066c83c83a5ba37181703716b7618232dda4e.tar.gz runit-void-80b066c83c83a5ba37181703716b7618232dda4e.tar.xz runit-void-80b066c83c83a5ba37181703716b7618232dda4e.zip |
Add modules-load.d(5) compatible kernel module loader
Diffstat (limited to 'modules-load')
-rwxr-xr-x | modules-load | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules-load b/modules-load new file mode 100755 index 0000000..00eca9f --- /dev/null +++ b/modules-load @@ -0,0 +1,17 @@ +#!/bin/sh +# modules-load [-n] [-v] - modules-load.d(5) compatible kernel module loader + +{ +# Parameters passed as modules-load= or rd.modules-load= in kernel command line. +sed -nr 's/,/\n/;s/(.* |^)(rd\.)?modules-load=([^ ]*).*/\3/p' /proc/cmdline + +# Find files /{etc,run,usr/lib}/modules-load.d/*.conf in that order. +find -L /etc/modules-load.d /run/modules-load.d /usr/lib/modules-load.d \ + -maxdepth 1 -name '*.conf' -printf '%p %P\n' 2>/dev/null | +# Load each basename only once. + sort -k2 -s | uniq -f1 | cut -d' ' -f1 | +# Read the files, output all non-empty, non-comment lines. + xargs -r -d'\n' grep -h -v -e '^[#;]' -e '^$' +} | +# Call modprobe on the list of modules +xargs -r -d'\n' modprobe -ab "$@" |