Ticket #2026: new-modules.sh

File new-modules.sh, 1.6 KB (added by dnicholson@…, 17 years ago)

The modules script I use on my system

Line 
1#!/bin/sh
2# Begin $rc_base/init.d/modules
3
4########################################################################
5#
6# Description : Module auto-loading script
7#
8# Authors : Zack Winkles
9#
10# Version : 00.00
11#
12# Notes :
13#
14########################################################################
15
16. /etc/sysconfig/rc
17. ${rc_functions}
18
19# Assure that the kernel has module support.
20[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
21
22case "${1}" in
23 start)
24
25 # Exit if there's no modules file or there are no
26 # valid entries
27 [ -r /etc/sysconfig/modules ] &&
28 egrep -qv '^($|#)' /etc/sysconfig/modules ||
29 exit 0
30
31 boot_mesg -n "Loading modules:" ${INFO}
32
33 # Only try to load modules if the user has actually given us
34 # some modules to load.
35 while read module args; do
36
37 # Ignore comments and blank lines.
38 case "$module" in
39 ""|"#"*) continue ;;
40 esac
41
42 # Attempt to load the module, making
43 # sure to pass any arguments provided.
44 modprobe ${module} ${args} >/dev/null
45
46 # Print the module name if successful,
47 # otherwise take note.
48 if [ $? -eq 0 ]; then
49 boot_mesg -n " ${module}" ${NORMAL}
50 else
51 failedmod="${failedmod} ${module}"
52 fi
53 done < /etc/sysconfig/modules
54
55 boot_mesg "" ${NORMAL}
56 # Print a message about successfully loaded
57 # modules on the correct line.
58 echo_ok
59
60 # Print a failure message with a list of any
61 # modules that may have failed to load.
62 if [ -n "${failedmod}" ]; then
63 boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
64 echo_failure
65 fi
66 ;;
67 *)
68 echo "Usage: ${0} {start}"
69 exit 1
70 ;;
71esac
72
73# End $rc_base/init.d/modules