Fix the modules init script

This commit is contained in:
Roy Marples 2007-04-11 15:00:22 +00:00
parent aff7b02dce
commit 33d303f184

View File

@ -13,25 +13,20 @@ load_modules() {
[ -z "${config}" -o ! -r "${config}" ] && return 0
modules=$(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${config}")
[ -z "${modules}" ] && 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 OIFS=${IFS} SIFS=${IFS-y}
IFS=\n
for x in ${modules} ; do
local x= cnt=0
for x in "$@" ; do
set -- ${x}
ebegin "Loading module $1"
modprobe -q "$@" >& /dev/null
eval modprobe -q "$@"
eend $? "Failed to load $1" && cnt=$((${cnt} + 1))
done
if [ "${SIFS}" = "y" ] ; then
IFS=${save_IFS}
else
unset IFS
fi
einfo "Autoloaded ${cnt} module(s)"