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

ml-11.0 multilib
Last change on this file since d7f58cc was d7f58cc, checked in by Xℹ Ruoyao <xry111@…>, 3 years ago

MultiLib: Merge changes from trunk

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11674 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[1c48007]1#!/bin/sh
2########################################################################
[0cda898]3# Begin modules
[1c48007]4#
5# Description : Module auto-loading script
6#
7# Authors : Zack Winkles
[f874424]8# DJ Lucas - dj@linuxfromscratch.org
[0cda898]9# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
[1c48007]10#
[0cda898]11# Version : LFS 7.0
[1c48007]12#
13########################################################################
14
[0cda898]15### BEGIN INIT INFO
16# Provides: modules
[d7f58cc]17# Required-Start: mountvirtfs
[0cda898]18# Should-Start:
19# Required-Stop:
20# Should-Stop:
21# Default-Start: S
22# Default-Stop:
23# Short-Description: Loads required modules.
24# Description: Loads modules listed in /etc/sysconfig/modules.
25# X-LFS-Provided-By: LFS
26### END INIT INFO
27
[1c48007]28# Assure that the kernel has module support.
[0bf4dfe]29[ -e /proc/modules ] || exit 0
[1c48007]30
[f874424]31. /lib/lsb/init-functions
32
[1c48007]33case "${1}" in
[0cda898]34 start)
35 # Exit if there's no modules file or there are no
36 # valid entries
[6d8e177]37 [ -r /etc/sysconfig/modules ] || exit 0
38 egrep -qv '^($|#)' /etc/sysconfig/modules || exit 0
[1c48007]39
[f874424]40 log_info_msg "Loading modules:"
[1c48007]41
[0cda898]42 # Only try to load modules if the user has actually given us
43 # some modules to load.
[f874424]44
[0cda898]45 while read module args; do
[1c48007]46
[0cda898]47 # Ignore comments and blank lines.
48 case "$module" in
49 ""|"#"*) continue ;;
50 esac
[1c48007]51
[f874424]52 # Attempt to load the module, passing any arguments provided.
[0cda898]53 modprobe ${module} ${args} >/dev/null
[1c48007]54
[f874424]55 # Print the module name if successful, otherwise take note.
[0cda898]56 if [ $? -eq 0 ]; then
[f874424]57 log_info_msg2 " ${module}"
[0cda898]58 else
59 failedmod="${failedmod} ${module}"
60 fi
61 done < /etc/sysconfig/modules
[1c48007]62
[f874424]63 # Print a message about successfully loaded modules on the correct line.
64 log_success_msg2
[1c48007]65
[f874424]66 # Print a failure message with a list of any modules that
67 # may have failed to load.
[0cda898]68 if [ -n "${failedmod}" ]; then
[f874424]69 log_failure_msg "Failed to load modules:${failedmod}"
70 exit 1
[0cda898]71 fi
72 ;;
[1c48007]73
[0cda898]74 *)
75 echo "Usage: ${0} {start}"
76 exit 1
77 ;;
[1c48007]78esac
79
[f874424]80exit 0
81
[0cda898]82# End modules
Note: See TracBrowser for help on using the repository browser.