load_module()
{
	module=$1
	if [ $# -ge 2 ]
	then
		shift
		modparams="$*"
	else
		modparams=""
	fi

	ERR=0
	MODPATH=

	#/bin/chkmodule $module
	# this little block is ripped right out of /bin/chkmodule, will just
	# put it here to reduce the jumping around
	KERNEL_VER=`/bin/busybox uname -r`
	if [ -e /lib/modules/${KERNEL_VER}/extra/${module}.ko ]
	then
		MODPATH=/lib/modules/${KERNEL_VER}/extra/${module}.ko
	else
		if [ -e /lib/modules/${KERNEL_VER}/modules.dep ]
		then
			MODLINE=$(grep -e "[/^]${module}.ko:" /lib/modules/${KERNEL_VER}/modules.dep);
			MODPATH=${MODLINE/:*/}
		fi
	fi

	if [ "X${MODPATH}" != "X" ] 
	then
		# is it already loaded?
		lsmod | grep -sq ^`echo "${module}" | /bin/busybox tr '-' '_'`
		if [ $? -eq 1 ]
		then
			# note, modprobe returns 0 even if module is NOT loaded!
			/sbin/modprobe ${module} ${modparams} >& /dev/null
			lsmod | grep -sq ^`echo "${module}" | /bin/busybox tr '-' '_'`
			if [ $? -ne 0 ]
			then
				insmod /lib/modules/${KERNEL_VER}/extra/${module}.ko ${modparams} >& /dev/null
				if [ $? -ne 0 ]
				then
					echo "ERROR - failed to load module: ${module}"
					ERR=1
				fi
			fi
		fi
	else
		if [ "X${HAVE_DOT_CONFIG}" != "Xy" ]
		then
			source /etc/sysconfig/config
		fi
		if [ "X${CONFIG_KERNEL_MODULES_BUILTIN}" != "Xy" ]
		then
			echo "ERROR: loadable module ${module} not found"
			ERR=1
		fi
	fi

	return $ERR
}
