modules init script now uses it's own config file instead of random foo in /etc

This commit is contained in:
Roy Marples 2007-12-28 22:41:19 +00:00
parent c36c5d0471
commit 75a8f1ff19
2 changed files with 37 additions and 45 deletions

12
conf.d.Linux/modules Normal file
View File

@ -0,0 +1,12 @@
# You can define a list modules for a specific kernel version,
# a released kernel version, a main kernel version or just a list.
#modules_2_6_23_gentoo_r5="ieee1394 ohci1394"
#modules_2_6_23="tun ieee1394"
#modules_2_6="tun"
#modules="ohci1394"
# Give the modules some options if needed.
# module_ieee1394_opts="debug"
# You should consult your kernel documentation and configuration
# for a list of modules and their options.

View File

@ -30,30 +30,19 @@ depend() {
use isapnp use isapnp
} }
load_modules() { _shell_var() {
local modules="" local rem=$1 c= r= var=
local config="$1" while [ -n "${rem}" ]; do
r=${rem#?}
[ -r "${config}" ] || return 0 c=${rem%${r}}
case "${c}" in
eval set -- $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' \ [a-zA-Z0-9]);;
-e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g" "${config}") *) c=_;;
[ $# = 0 ] && return 0 esac
var=${var}${c}
einfo "Using ${config} as config:" rem=${r}
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))
done done
echo ${var}
einfo "Autoloaded ${cnt} module(s)"
return 0
} }
start() { start() {
@ -68,29 +57,20 @@ start() {
x=${KV#*.*.} x=${KV#*.*.}
local KV_MICRO=${x%%-*} local KV_MICRO=${x%%-*}
[ -z "${CDBOOT}" ] && update-modules local list= x= opts= cnt=0
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 for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR}; do
if [ -f "${f}-${x}.${RC_SOFTLEVEL}" ]; then eval list=\$modules_$(_shell_var "${x}")
auto="${f}-${x}.${RC_SOFTLEVEL}" [ -n "${list}" ] && break
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 done
fi [ -z "${list}" ] && list=${modules}
[ -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 # Just in case a sysadmin prefers generic symbolic links in
# /lib/modules/boot for boot time modules we will load these modules # /lib/modules/boot for boot time modules we will load these modules