#!/bin/sh
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
# Modified:
#	Arkadiusz Miskiewicz <misiek@pld-linux.org>
#
# rc.modules: launch modules specified in /etc/modules
# $Id: rc.modules 6491 2005-10-26 16:33:29Z baggins $

. /etc/rc.d/init.d/functions

kernel=$(awk '{split($3,v,".");OFS=".";print(v[1],v[2]);}' /proc/version)
kerneleq=$(awk '{split($3,v,".");OFS=".";print(v[1],v[2],v[3]);}' /proc/version)

# Loop over every line in /etc/modules.
( \
	[ -f /etc/modules ] && egrep -v "^(#|[[:blank:]]*#)" /etc/modules 2>/dev/null; \
	[ -f "/etc/modules.${kernel}" ] && egrep -v "^(#|[[:blank:]]*#)" "/etc/modules.${kernel}" 2>/dev/null; \
	[ -f "/etc/modules.${kerneleq}" ] && egrep -v "^(#|[[:blank:]]*#)" "/etc/modules.${kerneleq}" 2>/dev/null; \
	echo \
) | # make sure there is a LF at the end
while read module args
do
	[ -z "$module" ] && continue
	_modprobe single $module
done

# This must be last line !
# vi:syntax=sh
