r4203 - in trunk/bootscripts: . contrib/init.d lfs/init.d

nathan at linuxfromscratch.org nathan at linuxfromscratch.org
Thu Sep 23 16:36:22 PDT 2004


Author: nathan
Date: 2004-09-23 17:36:20 -0600 (Thu, 23 Sep 2004)
New Revision: 4203

Modified:
   trunk/bootscripts/CHANGELOG
   trunk/bootscripts/contrib/init.d/hotplug
   trunk/bootscripts/lfs/init.d/functions
   trunk/bootscripts/lfs/init.d/udev
Log:
Took out the check for coresponding binary from udev and hotplug.  boot_mesg can now print color messages

Modified: trunk/bootscripts/CHANGELOG
===================================================================
--- trunk/bootscripts/CHANGELOG	2004-09-23 20:29:09 UTC (rev 4202)
+++ trunk/bootscripts/CHANGELOG	2004-09-23 23:36:20 UTC (rev 4203)
@@ -1,5 +1,8 @@
 n/a - September 23, 2004
 	* Fixed boot_log so it output's $@'s contents, not @$
+	* Added support for colors in boot_mesg
+	* Modified udev's error checking
+	* Modified hotplug's error checking
 
 n/a - September 22, 2004
 	* Removed the dependency on wl by replacing it with grep (Bryan Kadzban)

Modified: trunk/bootscripts/contrib/init.d/hotplug
===================================================================
--- trunk/bootscripts/contrib/init.d/hotplug	2004-09-23 20:29:09 UTC (rev 4202)
+++ trunk/bootscripts/contrib/init.d/hotplug	2004-09-23 23:36:20 UTC (rev 4203)
@@ -6,9 +6,6 @@
 . /etc/sysconfig/rc
 . $rc_functions
 
-# Exit quietly if you do not have hotplug installed
-[ -x /sbin/hotplug ] || exit 0
-
 case "$1" in
 	start|restart)
 		# Set hotplug as the default manager of hotplug events

Modified: trunk/bootscripts/lfs/init.d/functions
===================================================================
--- trunk/bootscripts/lfs/init.d/functions	2004-09-23 20:29:09 UTC (rev 4202)
+++ trunk/bootscripts/lfs/init.d/functions	2004-09-23 23:36:20 UTC (rev 4203)
@@ -43,7 +43,8 @@
 BRACKET="\\033[1;34m"        # Brackets are blue
 
 # Set screen and bootlog message values to ero
-BOOTMESG=""
+BOOTMESG=""    #buffer for text meant for the logfile
+BOOTMESGCON="" #buffer for text meant for the console
 BOOTSERVICE=""
 
 #*******************************************************************************
@@ -51,7 +52,8 @@
 #
 # Purpose:      Sending information from bootup scripts to the console
 #
-# Inputs:       $@ is the message
+# Inputs:       $1 is the message
+#               $2 is the colorcode for the console
 #
 # Outputs:      Standard Output
 #
@@ -70,7 +72,8 @@
 {
 	# First call to boot_mesg, set BOOTMESG normally
 	if [ -z "$BOOTMESG" ]; then
-		BOOTMESG="$@"
+		BOOTMESG="${1}"
+		BOOTMESGCON="${2}${1}"
 	# Subsequent calls will overwrite the text already on the screen
 	# with replacement text by counting the lines in the last BOOTMESG
 	# and calling CURS_UP that many times
@@ -78,7 +81,8 @@
 	else
 		local length=`echo -e "$BOOTMESG" | sed -n -e "L ${WCOL}" |grep -c \$`
 		local count=0
-		BOOTMESG="$BOOTMESG$@"
+		BOOTMESG="${BOOTMESG}${1}"
+		BOOTMESGCON="${BOOTMESGCON}${2}${1}"
 		while [ "${count}" -lt "${length}" ]; do
 			echo -e -n "$CURS_UP"
 			count=$((${count}+1))
@@ -86,7 +90,7 @@
 	fi
 
 	# This will wrap BOOTMESG to a maximum of $WCOL characters
-	echo -e "${BOOTMESG}" | sed -n -e "L ${WCOL}"
+	echo -e "${BOOTMESGCON}" | sed -n -e "L ${WCOL}"
 }
 
 boot_log()
@@ -102,8 +106,9 @@
 	else
 		boot_log "${BOOTSERVICE}""  [  OK  ]"
 	fi
-	# Reset BOOTMESG to keep from bleeding over again
+	# Reset BOOTMESG and BOOTMESGCON to keep from bleeding over again
 	BOOTMESG=""
+  BOOTMESGCON=""
 }
 
 echo_failure()
@@ -116,6 +121,7 @@
 	fi
 	# Reset BOOTMESG to keep from bleeding over again
 	BOOTMESG=""
+  BOOTMESGCON=""
 }
 
 echo_warning()
@@ -128,6 +134,7 @@
 	fi
 	# Reset BOOTMESG to keep from bleeding over again
 	BOOTMESG=""
+  BOOTMESGCON=""
 }
 
 print_error_msg()

Modified: trunk/bootscripts/lfs/init.d/udev
===================================================================
--- trunk/bootscripts/lfs/init.d/udev	2004-09-23 20:29:09 UTC (rev 4202)
+++ trunk/bootscripts/lfs/init.d/udev	2004-09-23 23:36:20 UTC (rev 4203)
@@ -6,9 +6,6 @@
 . /etc/sysconfig/rc
 . $rc_functions
 
-# Assure that sysfs is mounted and that udev is present.
-[ -d /sys/block -a -x /sbin/udev ] || exit 0
-
 # Create some things that sysfs does not, and should not export for us.  Feel
 # free to add devices to this list.
 make_extra_nodes() {
@@ -28,6 +25,15 @@
 		[ -f /dev/.udev.tdb ] && exit 0
 
 		boot_mesg "Populating /dev with device nodes..."
+		if ! grep -q '[[:space:]]sysfs' /proc/mounts ; then
+			boot_log " sysfs filesystem not found.  Unable to continue"
+			evaluate_retval
+			boot_mesg "\nUnable to create devices without a sysfs filesystem" $FAILURE
+			boot_mesg "\nWhen you press Enter, this system will be halted."
+			boot_mesg "\n\nPress Enter to continue..." $NORMAL
+			read ENTER
+			halt -f
+		fi
 
 		# Mount a temporary file system over /dev, so that any devices
 		# made or removed during this boot don't affect the next one.
@@ -36,16 +42,11 @@
 		mount -n -t ramfs ramfs /dev
 		if [ $? != 0 ]
 		then
+			boot_log "Unable to mount a ramfs onto /dev"
 			print_status failure
-			boot_log "Unable to mount a ramfs onto /dev"
-			echo -n -e $FAILURE
-			echo
-			echo "Cannot mount a ramfs onto /dev, this system will be halted."
-			echo
-			echo -n "When you press Enter, this system will be halted."
-			echo -n -e $NORMAL
-			echo
-			echo "Press Enter to continue..."
+			boot_mesg "\nCannot mount a ramfs onto /dev, this system will be halted." $FAILURE
+			boot_mesg "\n\nWhen you press Enter, this system will be halted."
+			boot_mesg "\n\nPress Enter to continue..." $NORMAL
 			read ENTER
 
 			halt -f




More information about the lfs-book mailing list