From 33d303f1844d98490bb24071e612bf5845c5eebb Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Wed, 11 Apr 2007 15:00:22 +0000
Subject: Fix the modules init script

---
 init.d.Linux/modules | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/init.d.Linux/modules b/init.d.Linux/modules
index feda2c24..090bd7c9 100755
--- a/init.d.Linux/modules
+++ b/init.d.Linux/modules
@@ -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)"
 
-- 
cgit v1.2.3