#!/bin/bash # modules # Module auto-loading script # Source functions library source /etc/rc.d/init.d/functions log_script_name "$0 $*" # Assure that the kernel has module support. if [ ! -e /proc/ksyms -a ! -e /proc/modules ]; then exit 0 fi modules_start() { # Exit if there's no modules file if [ ! -r /etc/sysconfig/modules ]; then return 0 fi echo "Loading modules:" # Only try to load modules if the user has actually given us # some modules to load. while read module args; do # Ignore comments and blank lines. case "$module" in ""|"#"*) continue ;; esac # Attempt to load the module, making # sure to pass any arguments provided. modprobe ${module} ${args} >/dev/null # Print the module name if successful, # otherwise take note. if [ $? -eq 0 ]; then echo " ${module}" else failedmod="${failedmod} ${module}" fi done < /etc/sysconfig/modules # Print a failure message with a list of any # modules that may have failed to load. if [ -n "${failedmod}" ]; then ${FAILURE} echo "Failed to load modules:${failedmod}" fi } # See how we were called case "$1" in start) cmd_run_log_box_warn "Loading modules" modules_start ;; *) echo "Usage: $0 {start}" exit ${EXIT_CODE_FAILURE} ;; esac exit $?