This removes the log level handling from the modules script assuming it is handled in the consolelog script. Also, the input loop is cleaned up some and stderr from modprobe is not suppressed.
-- Dan bootscripts/ChangeLog | 6 +++ bootscripts/lfs/init.d/modules | 92 ++++++++++++++++------------------------ 2 files changed, 42 insertions(+), 56 deletions(-) diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index 2499df5..bad085b 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -5,6 +5,12 @@ * Makefile, lfs/init.d/consolelog: New bootscript controlling the kernel log level on the console. This is controlled by the LOGLEVEL variable in /etc/sysconfig/console. + * lfs/init.d/modules: Remove the log level handling since this is + done in the consolelog script now. Also, the script is cleaned up + by removing the file descriptor duplication and instead just + redirecting /etc/sysconfig/modules to the input of the while loop. + Finally, stderr is not suppressed when executing modprobe since these + messages may be critical during boot. 2007-04-24 Dan Nicholson <[EMAIL PROTECTED]> * lfs/init.d/functions: When killproc is executed, it checks that diff --git a/bootscripts/lfs/init.d/modules b/bootscripts/lfs/init.d/modules index 6be87f4..e8fbdfa 100644 --- a/bootscripts/lfs/init.d/modules +++ b/bootscripts/lfs/init.d/modules @@ -21,67 +21,47 @@ case "${1}" in start) - # If proc is mounted, find the current kernel - # message level - if [ -f /proc/sys/kernel/printk ]; then - prev_msg=`cat /proc/sys/kernel/printk | \ - sed 'l 1' | sed -n '2~0p' | \ - sed 's/\\\//'` - else - prev_msg="6" - fi + # Exit if there's no modules file or there are no + # valid entries + [ -r /etc/sysconfig/modules ] && + egrep -qv '^($|#)' /etc/sysconfig/modules || + exit 0 - # Now set the message level to 1 so not to make too - # much noise when loading modules - dmesg -n 1 + boot_mesg -n "Loading modules:" ${INFO} # Only try to load modules if the user has actually given us # some modules to load. - if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null - then - - # Read in the configuration file. - exec 9>&0 < /etc/sysconfig/modules - - boot_mesg -n "Loading modules:" ${INFO} - - while read module args - do - # Ignore comments and blank lines. - case "${module}" in - ""|\#*) continue ;; - esac - - # Attempt to load the module, making - # sure to pass any arguments provided. - modprobe ${module} ${args} 2>&1 > /dev/null - - # Print the module name if successful, - # otherwise take note. - if [ ${?} -eq 0 ]; then - boot_mesg -n " ${module}" ${NORMAL} - else - failedmod="${failedmod} ${module}" - fi - done - - boot_mesg "" ${NORMAL} - # Print a message about successfully loaded - # modules on the correct line. - echo_ok - - # Print a failure message with a list of any - # modules that may have failed to load. - if [ "${failedmod}" ]; then - boot_mesg "Failed to load modules:${failedmod}" ${FAILURE} - echo_failure - fi - - exec 0>&9 9>&- - + while read module args; do + + # Ignore comments and blank lines. + case "$module" in + ""|"#"*) continue ;; + esac + + # Attempt to load the module, making + # sure to pass any arguments provided. + modprobe ${module} ${args} >/dev/null + + # Print the module name if successful, + # otherwise take note. + if [ $? -eq 0 ]; then + boot_mesg -n " ${module}" ${NORMAL} + else + failedmod="${failedmod} ${module}" + fi + done < /etc/sysconfig/modules + + boot_mesg "" ${NORMAL} + # Print a message about successfully loaded + # modules on the correct line. + echo_ok + + # Print a failure message with a list of any + # modules that may have failed to load. + if [ -n "${failedmod}" ]; then + boot_mesg "Failed to load modules:${failedmod}" ${FAILURE} + echo_failure fi - # Set the kernel message level back to it's previous value. - dmesg -n "${prev_msg}" ;; *) echo "Usage: ${0} {start}" -- 1.5.1.6 -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page