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 | |
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
-rwxr-xr-x | 1 | 6 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | modules-load | 17 |
3 files changed, 20 insertions, 4 deletions
diff --git a/1 b/1 index 4b895fd..30b7980 100755 --- a/1 +++ b/1 @@ -138,10 +138,8 @@ cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true install -m0664 -o root -g utmp /dev/null /run/utmp rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot -if [ -n "$MODULES" ]; then - msg "Loading kernel modules: ${MODULES} ...\n" - modprobe -ab ${MODULES} -fi +msg "Loading kernel modules: ${MODULES} ...\n" +modules-load ${MODULES} dmesg >/var/log/dmesg.log diff --git a/Makefile b/Makefile index 5af25a0..315b4b4 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ install: install -m755 halt ${DESTDIR}/${PREFIX}/bin install -m755 pause ${DESTDIR}/${PREFIX}/bin install -m755 shutdown.sh ${DESTDIR}/${PREFIX}/bin/shutdown + install -m755 modules-load ${DESTDIR}/${PREFIX}/bin/modules-load install -m755 zzz ${DESTDIR}/${PREFIX}/bin ln -s zzz ${DESTDIR}/${PREFIX}/bin/ZZZ ln -s halt ${DESTDIR}/${PREFIX}/bin/poweroff 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 "$@" |