Author: dnicholson
Date: 2007-07-18 07:26:37 -0600 (Wed, 18 Jul 2007)
New Revision: 8223
Modified:
trunk/bootscripts/ChangeLog
trunk/bootscripts/lfs/init.d/modules
Log:
Simplify modules input loop
Modified: trunk/bootscripts/ChangeLog
===================================================================
--- trunk/bootscripts/ChangeLog 2007-07-18 13:26:34 UTC (rev 8222)
+++ trunk/bootscripts/ChangeLog 2007-07-18 13:26:37 UTC (rev 8223)
@@ -4,6 +4,9 @@
variable in /etc/sysconfig/console.
* lfs/init.d/modules: Remove the log level handling since this is
done in the consolelog script now.
+ * lfs/init.d/modules: Clean up the script by removing the file
+ descriptor duplication and instead just redirecting
+ /etc/sysconfig/modules to the input of the while loop.
2007-06-16 Dan Nicholson <[EMAIL PROTECTED]>
* lfs/init.d/mountfs, lfs/init.d/mountkernfs, lfs/init.d/setclock,
Modified: trunk/bootscripts/lfs/init.d/modules
===================================================================
--- trunk/bootscripts/lfs/init.d/modules 2007-07-18 13:26:34 UTC (rev
8222)
+++ trunk/bootscripts/lfs/init.d/modules 2007-07-18 13:26:37 UTC (rev
8223)
@@ -21,50 +21,46 @@
case "${1}" in
start)
+ # Exit if there's no modules file or there are no
+ # valid entries
+ [ -r /etc/sysconfig/modules ] &&
+ egrep -qv '^($|#)' /etc/sysconfig/modules ||
+ exit 0
+
+ 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
+ while read module args; do
- # Read in the configuration file.
- exec 9>&0 < /etc/sysconfig/modules
+ # Ignore comments and blank lines.
+ case "$module" in
+ ""|"#"*) continue ;;
+ esac
- boot_mesg -n "Loading modules:" ${INFO}
+ # Attempt to load the module, making
+ # sure to pass any arguments provided.
+ modprobe ${module} ${args} >/dev/null
- while read module args
- do
- # Ignore comments and blank lines.
- case "${module}" in
- ""|\#*) continue ;;
- esac
+ # 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
- # Attempt to load the module, making
- # sure to pass any arguments provided.
- modprobe ${module} ${args} > /dev/null
+ boot_mesg "" ${NORMAL}
+ # Print a message about successfully loaded
+ # modules on the correct line.
+ echo_ok
- # 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>&-
-
+ # 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
;;
*)
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page