]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/modules
nut: Added status option, some installation fixed
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / modules
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/modules
4 #
5 # Description : Module auto-loading script
6 #
7 # Authors : Zack Winkles
8 #
9 # Version : 00.00
10 #
11 # Notes :
12 #
13 ########################################################################
14
15 . /etc/sysconfig/rc
16 . ${rc_functions}
17
18 # Assure that the kernel has module support.
19 [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
20
21 case "${1}" in
22 start)
23
24 # If proc is mounted, find the current kernel
25 # message level
26 if [ -f /proc/sys/kernel/printk ]; then
27 prev_msg=`cat /proc/sys/kernel/printk | \
28 sed 'l 1' | sed -n '2~0p' | \
29 sed 's/\\\//'`
30 else
31 prev_msg="6"
32 fi
33
34 # Now set the message level to 1 so not to make too
35 # much noise when loading modules
36 dmesg -n 1
37
38 # Only try to load modules if the user has actually given us
39 # some modules to load.
40 if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null
41 then
42
43 # Read in the configuration file.
44 exec 9>&0 < /etc/sysconfig/modules
45
46 boot_mesg -n "Loading modules:" ${INFO}
47
48 while read module args
49 do
50 # Ignore comments and blank lines.
51 case "${module}" in
52 ""|\#*) continue ;;
53 esac
54
55 # Attempt to load the module, making
56 # sure to pass any arguments provided.
57 modprobe ${module} ${args} 2>&1 > /dev/null
58
59 # Print the module name if successful,
60 # otherwise take note.
61 if [ ${?} -eq 0 ]; then
62 boot_mesg -n " ${module}" ${NORMAL}
63 else
64 failedmod="${failedmod} ${module}"
65 fi
66 done
67
68 boot_mesg "" ${NORMAL}
69 # Print a message about successfully loaded
70 # modules on the correct line.
71 echo_ok
72
73 # Print a failure message with a list of any
74 # modules that may have failed to load.
75 if [ "${failedmod}" ]; then
76 boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
77 echo_failure
78 fi
79
80 exec 0>&9 9>&-
81
82 fi
83 # Set the kernel message level back to it's previous value.
84 dmesg -n "${prev_msg}"
85 ;;
86 *)
87 echo "Usage: ${0} {start}"
88 exit 1
89 ;;
90 esac
91
92 # End $rc_base/init.d/modules