r4223 - in trunk/bootscripts: . lfs/init.d

nathan at linuxfromscratch.org nathan at linuxfromscratch.org
Sun Sep 26 23:37:00 PDT 2004


Author: nathan
Date: 2004-09-27 00:36:56 -0600 (Mon, 27 Sep 2004)
New Revision: 4223

Modified:
   trunk/bootscripts/CHANGELOG
   trunk/bootscripts/lfs/init.d/functions
Log:
new function, boot_mesg_flush

Modified: trunk/bootscripts/CHANGELOG
===================================================================
--- trunk/bootscripts/CHANGELOG	2004-09-27 06:05:17 UTC (rev 4222)
+++ trunk/bootscripts/CHANGELOG	2004-09-27 06:36:56 UTC (rev 4223)
@@ -6,6 +6,9 @@
 	* loadproc and killproc can have the -nomsg parameter to avoid
 	  calling evaluate_retval or print_service (Jim Gifford)
 	* boot_mesg no longer explicitly adds a \n onto end of lines
+	* Added a function called boot_mesg_flush, which can
+	  dump the BOOTMESG to the bootlog.  This helps avoid making
+	  everything have to end in OK/WARN/FAIL (Nathan Coulson)
 
 n/a - September 24, 2004
 	* Removed /dev/udev.tdb test

Modified: trunk/bootscripts/lfs/init.d/functions
===================================================================
--- trunk/bootscripts/lfs/init.d/functions	2004-09-27 06:05:17 UTC (rev 4222)
+++ trunk/bootscripts/lfs/init.d/functions	2004-09-27 06:36:56 UTC (rev 4223)
@@ -97,48 +97,43 @@
 	echo -e -n "${BOOTMESGCON}" | sed -n -e "s/\$/\n/g;L ${WCOL}"
 }
 
-boot_log()
+boot_mesg_flush()
 {
-	/bin/logger -p local0.info -t bootlog "$@"
-}
+	# Do not log null messages
+	if [ -z "${BOOTMESG}" ]; then
+		return 0
+	fi
 
-echo_ok()
-{
-	echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}"
 	if [ -z "${BOOTSERVICE}" ]; then
-		boot_log "${BOOTMESG}""  [  OK  ]"
+		boot_log "${BOOTMESG}""$@"
 	else
-		boot_log "${BOOTSERVICE}""  [  OK  ]"
+		boot_log "${BOOTSERVICE}""$@"
 	fi
 	# Reset BOOTMESG and BOOTMESGCON to keep from bleeding over again
 	BOOTMESG=""
 	BOOTMESGCON=""
 }
+boot_log()
+{
+	/bin/logger -p local0.info -t bootlog "$@"
+}
 
+echo_ok()
+{
+	echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}"
+	boot_mesg_flush "  [  OK  ]"
+}
+
 echo_failure()
 {
 	echo -e "${SET_COL}""${BRACKET}""[""${FAILURE}""FAILED""${BRACKET}""]""${NORMAL}"
-	if [ -z "${BOOTSERVICE}" ]; then
-		boot_log "${BOOTMESG}""  [FAILED]"
-	else
-		boot_log "${BOOTSERVICE}""  [FAILED]"
-	fi
-	# Reset BOOTMESG to keep from bleeding over again
-	BOOTMESG=""
-	BOOTMESGCON=""
+	boot_mesg_flush "  [FAILED]"
 }
 
 echo_warning()
 {
 	echo -e "${SET_WCOL}""$@""${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
-	if [ -z "${BOOTSERVICE}" ]; then
-		boot_log "${BOOTMESG}""$@""  [ WARN ]"
-	else
-		boot_log "${BOOTSERVICE}""$@""  [ WARN ]"
-	fi
-	# Reset BOOTMESG to keep from bleeding over again
-	BOOTMESG=""
-	BOOTMESGCON=""
+	boot_mesg_flush "@$  [ WARN ]"
 }
 
 print_error_msg()




More information about the lfs-book mailing list