source: bootscripts/contrib/lsb-v3/etc/init.d/modules@ dc55fb5e

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since dc55fb5e was dc55fb5e, checked in by DJ Lucas <dj@…>, 13 years ago

Changes per thread starting at http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2011-May/064677.html

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9532 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.8 KB
Line 
1#!/bin/sh
2# Begin /etc/init.d/modules
3
4### BEGIN INIT INFO
5# Provides: modules
6# Required-Start: mountvirtfs sysctl
7# Should-Start:
8# Required-Stop:
9# Should-Stop:
10# Default-Start: S
11# Default-Stop:
12# Short-Description: Loads required modules.
13# Description: Loads modules listed in /etc/default/modules.
14# X-LFS-Provided-By: LFS
15### END INIT INFO
16
17. /lib/lsb/init-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/default/modules ] &&
28 egrep -qv '^($|#)' /etc/default/modules ||
29 exit 0
30
31 # If proc is mounted, find the current kernel
32 # message level
33 if [ -f /proc/sys/kernel/printk ]; then
34 prev_msg=`cat /proc/sys/kernel/printk | \
35 sed 'l 1' | sed -n '2~0p' | \
36 sed 's/\\\//'`
37 else
38 prev_msg="6"
39 fi
40
41 # Now set the message level to 1 so not to make too
42 # much noise when loading modules
43 dmesg -n 1
44
45 # Only try to load modules if the user has actually given us
46 # some modules to load.
47 if egrep -qv '^(#|$)' /etc/default/modules 2>/dev/null
48 then
49
50 # Read in the configuration file.
51 exec 9>&0 < /etc/default/modules
52
53 message="${INFO}Loading modules:"
54
55 while read module args
56 do
57 # Ignore comments and blank lines.
58 case "${module}" in
59 ""|\#*) continue ;;
60 esac
61
62 # Attempt to load the module, making
63 # sure to pass any arguments provided.
64 modprobe ${module} ${args} > /dev/null
65
66 # Print the module name if successful,
67 # otherwise take note.
68 if [ ${?} -eq 0 ]; then
69 message="${message}${NORMAL} ${module}"
70 else
71 failedmod="${failedmod} ${module}"
72 fi
73 done
74
75 # Print a message about successfully loaded
76 # modules on the correct line.
77 log_success_msg "${message}"
78
79 # Print a failure message with a list of any
80 # modules that may have failed to load.
81 if [ "${failedmod}" ]; then
82 log_failure_msg "${FAILURE}Failed to load modules:${failedmod}"
83 fi
84
85 exec 0>&9 9>&-
86
87 fi
88 # Set the kernel message level back to it's previous value.
89 dmesg -n "${prev_msg}"
90 ;;
91 *)
92 echo "Usage: ${0} {start}"
93 exit 1
94 ;;
95esac
96
97# End /etc/init.d/modules
Note: See TracBrowser for help on using the repository browser.