initscripts/etc/rc.d/init.d/loadmodules

30 lines
953 B
Plaintext
Raw Normal View History

2011-04-26 12:26:24 +02:00
#!/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
[ -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 || :