Fix the modules init script
This commit is contained in:
parent
aff7b02dce
commit
33d303f184
@ -13,25 +13,20 @@ load_modules() {
|
|||||||
|
|
||||||
[ -z "${config}" -o ! -r "${config}" ] && return 0
|
[ -z "${config}" -o ! -r "${config}" ] && return 0
|
||||||
|
|
||||||
modules=$(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${config}")
|
eval set -- $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' \
|
||||||
[ -z "${modules}" ] && return 0
|
-e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g" "${config}")
|
||||||
|
[ $# = 0 ] && return 0
|
||||||
|
|
||||||
einfo "Using ${config} as config:"
|
einfo "Using ${config} as config:"
|
||||||
eindent
|
eindent
|
||||||
|
|
||||||
local x= cnt=0 OIFS=${IFS} SIFS=${IFS-y}
|
local x= cnt=0
|
||||||
IFS=\n
|
for x in "$@" ; do
|
||||||
for x in ${modules} ; do
|
|
||||||
set -- ${x}
|
set -- ${x}
|
||||||
ebegin "Loading module $1"
|
ebegin "Loading module $1"
|
||||||
modprobe -q "$@" >& /dev/null
|
eval modprobe -q "$@"
|
||||||
eend $? "Failed to load $1" && cnt=$((${cnt} + 1))
|
eend $? "Failed to load $1" && cnt=$((${cnt} + 1))
|
||||||
done
|
done
|
||||||
if [ "${SIFS}" = "y" ] ; then
|
|
||||||
IFS=${save_IFS}
|
|
||||||
else
|
|
||||||
unset IFS
|
|
||||||
fi
|
|
||||||
|
|
||||||
einfo "Autoloaded ${cnt} module(s)"
|
einfo "Autoloaded ${cnt} module(s)"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user