initscripts/etc/rc.d/init.d/loadmodules
2011-04-26 12:26:24 +02:00

31 lines
1019 B
Bash
Executable File

#!/bin/sh
# Copyright (C) 2004-2011 Silvan Calarco <silvan.calarco@mambasoft.it>
. /etc/sysconfig/rc
. $rc_functions
KERNELREL=`uname -r`
# check for modules existence or exit
[ -e /lib/modules/$KERNELREL/modules.dep ] || exit 0
KERNELMIN=`echo $KERNELREL | sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`
[ -r /etc/modprobe.conf ] && modulesfile="/etc/modprobe.conf"
[ -d /etc/modprobe.d ] && modulesfile="$modulesfile /etc/modprobe.d/*.conf"
module_alias=`egrep "^(probeall|alias)( |\t)*on-boot-*( |\t)*" $modulesfile 2>/dev/null | gawk '{ print $2 }'`
module_name=`egrep "^(probeall|alias)( |\t)*on-boot-*( |\t)*" $modulesfile 2>/dev/null | gawk '{ print $3 }'`
for module in $module_name \
`cat /etc/modules 2>/dev/null | grep -v ^#`\
`cat /etc/modules.d/*.conf 2>/dev/null | grep -v ^#`; do
echo -n "Loading $module module: "
modprobe $module 2>&1
evaluate_retval
echo
done
[ -e /proc/ide/hd[a-z] ] && \
cat /proc/ide/hd[a-z]/media | \
grep cdrom >/dev/null && modprobe ide-cd 2>/dev/null || :