summaryrefslogtreecommitdiff
path: root/init.d.Linux
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-28 22:41:19 +0000
committerRoy Marples <roy@marples.name>2007-12-28 22:41:19 +0000
commit75a8f1ff198ecd6dbf9518676d3481a5b1bf4247 (patch)
tree64bb5abd1997c698313d321d2a35aa780ededdc7 /init.d.Linux
parentc36c5d0471e3dde4b80f2d20c43408577c5a548a (diff)
downloadopenrc-75a8f1ff198ecd6dbf9518676d3481a5b1bf4247.tar.gz
openrc-75a8f1ff198ecd6dbf9518676d3481a5b1bf4247.tar.bz2
openrc-75a8f1ff198ecd6dbf9518676d3481a5b1bf4247.tar.xz
modules init script now uses it's own config file instead of random foo in /etc
Diffstat (limited to 'init.d.Linux')
-rwxr-xr-xinit.d.Linux/modules70
1 files changed, 25 insertions, 45 deletions
diff --git a/init.d.Linux/modules b/init.d.Linux/modules
index 75fa8f6..19e679b 100755
--- a/init.d.Linux/modules
+++ b/init.d.Linux/modules
@@ -30,30 +30,19 @@ depend() {
use isapnp
}
-load_modules() {
- local modules=""
- local config="$1"
-
- [ -r "${config}" ] || return 0
-
- eval set -- $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' \
- -e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g" "${config}")
- [ $# = 0 ] && return 0
-
- einfo "Using ${config} as config:"
- eindent
-
- local x= cnt=0
- for x; do
- set -- ${x}
- ebegin "Loading module $1"
- eval modprobe -q "$@"
- eend $? "Failed to load $1" && cnt=$((${cnt} + 1))
+_shell_var() {
+ local rem=$1 c= r= var=
+ while [ -n "${rem}" ]; do
+ r=${rem#?}
+ c=${rem%${r}}
+ case "${c}" in
+ [a-zA-Z0-9]);;
+ *) c=_;;
+ esac
+ var=${var}${c}
+ rem=${r}
done
-
- einfo "Autoloaded ${cnt} module(s)"
-
- return 0
+ echo ${var}
}
start() {
@@ -68,29 +57,20 @@ start() {
x=${KV#*.*.}
local KV_MICRO=${x%%-*}
- [ -z "${CDBOOT}" ] && update-modules
+ local list= x= opts= cnt=0
+ for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR}; do
+ eval list=\$modules_$(_shell_var "${x}")
+ [ -n "${list}" ] && break
+ done
+ [ -z "${list}" ] && list=${modules}
- local auto=""
- if [ -f /etc/modules.autoload -a ! -L /etc/modules.autoload ]; then
- auto=/etc/modules.autoload
- else
- local x= f="/etc/modules.autoload.d/kernel"
- for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR}; do
- if [ -f "${f}-${x}.${RC_SOFTLEVEL}" ]; then
- auto="${f}-${x}.${RC_SOFTLEVEL}"
- break
- fi
- if [ "${RC_SOFTLEVEL}" = "${RC_BOOTLEVEL}" -a -f "${f}-${x}.${RC_DEFAULTLEVEL}" ]; then
- auto="${f}-${x}.${RC_DEFAULTLEVEL}"
- break
- fi
- if [ -f "${f}-${x}" ]; then
- auto="${f}-${x}"
- break
- fi
- done
- fi
- [ -n "${auto}" ] && load_modules "${auto}"
+ for x in ${list}; do
+ ebegin "Loading module ${x}"
+ eval opts=\$module_$(_shell_var "${x}")_opts
+ eval modprobe -q "${x}" "${opts}"
+ eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1))
+ done
+ einfo "Autoloaded ${cnt} module(s)"
# Just in case a sysadmin prefers generic symbolic links in
# /lib/modules/boot for boot time modules we will load these modules