source: bootscripts/lfs/init.d/modules@ f3e9c8a

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since f3e9c8a was 163a6701, checked in by Jim Gifford <clfs@…>, 19 years ago

r720@server (orig r718): jim | 2005-11-18 08:06:26 -0800
Added bootscripts to cross-lfs svn

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[163a6701]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
21case "${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 ;;
90esac
91
92# End $rc_base/init.d/modules
Note: See TracBrowser for help on using the repository browser.