source: bootscripts-standard/bootscripts/clfs/init.d/modules@ 84f3ac2

Last change on this file since 84f3ac2 was 2167cfe, checked in by William Harrington <kb0iic@…>, 10 years ago

bootscripts are the scripts used for the sysvinit book.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#!/bin/bash
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
21case "${1}" in
22 start)
23
24 # Exit if there's no modules file or there are no
25 # valid entries
26 [ -r /etc/sysconfig/modules ] &&
27 egrep -qv '^($|#)' /etc/sysconfig/modules ||
28 exit 0
29
30 boot_mesg -n "Loading modules:" ${INFO}
31
32 # Only try to load modules if the user has actually given us
33 # some modules to load.
34 while read module args; do
35
36 # Ignore comments and blank lines.
37 case "$module" in
38 ""|"#"*) continue ;;
39 esac
40
41 # Attempt to load the module, making
42 # sure to pass any arguments provided.
43 modprobe ${module} ${args} >/dev/null
44
45 # Print the module name if successful,
46 # otherwise take note.
47 if [ $? -eq 0 ]; then
48 boot_mesg -n " ${module}" ${NORMAL}
49 else
50 failedmod="${failedmod} ${module}"
51 fi
52 done < /etc/sysconfig/modules
53
54 boot_mesg "" ${NORMAL}
55 # Print a message about successfully loaded
56 # modules on the correct line.
57 echo_ok
58
59 # Print a failure message with a list of any
60 # modules that may have failed to load.
61 if [ -n "${failedmod}" ]; then
62 boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
63 echo_failure
64 fi
65 ;;
66 *)
67 echo "Usage: ${0} {start}"
68 exit 1
69 ;;
70esac
71
72# End $rc_base/init.d/modules
Note: See TracBrowser for help on using the repository browser.