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

nathan at linuxfromscratch.org nathan at linuxfromscratch.org
Wed Sep 22 23:18:27 PDT 2004


Author: nathan
Date: 2004-09-23 00:18:26 -0600 (Thu, 23 Sep 2004)
New Revision: 4195

Modified:
   trunk/bootscripts/CHANGELOG
   trunk/bootscripts/lfs/init.d/functions
Log:
Added logging capabilities

Modified: trunk/bootscripts/CHANGELOG
===================================================================
--- trunk/bootscripts/CHANGELOG	2004-09-23 06:02:57 UTC (rev 4194)
+++ trunk/bootscripts/CHANGELOG	2004-09-23 06:18:26 UTC (rev 4195)
@@ -5,6 +5,8 @@
 	  added to each additional sentence tacked onto BOOTMESG
 	* boot_mesg now handles \n's properly, and does not dimish the size of the
 	  next line
+	* boot_log has been added.  the echo_ functions commit the log,
+	  and then clear the BOOTMSG variable
 
 n/a - September 21, 2004
 	* boot_mesg has been enhanced.  Subsequent calls will overwrite previous text,

Modified: trunk/bootscripts/lfs/init.d/functions
===================================================================
--- trunk/bootscripts/lfs/init.d/functions	2004-09-23 06:02:57 UTC (rev 4194)
+++ trunk/bootscripts/lfs/init.d/functions	2004-09-23 06:18:26 UTC (rev 4195)
@@ -89,24 +89,51 @@
 	echo -e "${BOOTMESG}" | sed -n -e "L ${WCOL}"
 }
 
+boot_log()
+{
+	/bin/logger -p local0.info -t bootlog "@$"
+}
+
 echo_ok()
 {
 	echo -e "${CURS_UP}""${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}"
+	if [ -z "${BOOTSERVICE}" ]; then
+		boot_log "${BOOTMESG}""  [  OK  ]"
+	else
+		boot_log "${BOOTSERVICE}""  [  OK  ]"
+	fi
+	# Reset BOOTMESG to keep from bleeding over again
+	BOOTMESG=""
 }
 
 echo_failure()
 {
 	echo -e "${CURS_UP}""${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=""
 }
 
 echo_warning()
 {
 	echo -e "${CURS_UP}""${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=""
 }
 
 print_error_msg()
 {
 	# $i is inherited by the rc script
+	boot_log "$i failed and exited with a return value of $error_value"
 	echo -e -n $FAILURE
 	echo
 	echo "You should not be reading this error message. It means"
@@ -189,8 +216,6 @@
 
 	esac
 
-	# Reset BOOTMESG to keep from bleeding over again
-	BOOTMESG=""
 }
 
 # Returns all of the pid #'s for $1 process




More information about the lfs-book mailing list