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

nathan at linuxfromscratch.org nathan at linuxfromscratch.org
Wed Sep 22 23:03:00 PDT 2004


Author: nathan
Date: 2004-09-23 00:02:57 -0600 (Thu, 23 Sep 2004)
New Revision: 4194

Modified:
   trunk/bootscripts/CHANGELOG
   trunk/bootscripts/lfs/init.d/functions
Log:
boot_mesg fix for \n and linewrapping

Modified: trunk/bootscripts/CHANGELOG
===================================================================
--- trunk/bootscripts/CHANGELOG	2004-09-23 04:30:59 UTC (rev 4193)
+++ trunk/bootscripts/CHANGELOG	2004-09-23 06:02:57 UTC (rev 4194)
@@ -3,6 +3,8 @@
 	* fixed getpids, to remove unused pids obtained from $PIDFILE
 	* removed ${NORMAL} from echo "$BOOTMESG" in functions, and removed space
 	  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
 
 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 04:30:59 UTC (rev 4193)
+++ trunk/bootscripts/lfs/init.d/functions	2004-09-23 06:02:57 UTC (rev 4194)
@@ -76,7 +76,7 @@
 	# and calling CURS_UP that many times
 	# It will also append our new text onto the BOOTMESG variable
 	else
-		local length=`echo -e "$BOOTMESG" | grep -c \$`
+		local length=`echo -e "$BOOTMESG" | sed -n -e "L ${WCOL}" |grep -c \$`
 		local count=0
 		BOOTMESG="$BOOTMESG$@"
 		while [ "${count}" -lt "${length}" ]; do
@@ -85,11 +85,8 @@
 		done
 	fi
 
-	# This will limit BOOTMESG to be no longer then what WCOL is set to,
-	# by adding \n's where appropriate.
-	BOOTMESG=`echo ${BOOTMESG} | sed -n -e "s/\\\\n/\n/g;L ${WCOL}"`
-
-	echo -e "${BOOTMESG}"
+	# This will wrap BOOTMESG to a maximum of $WCOL characters
+	echo -e "${BOOTMESG}" | sed -n -e "L ${WCOL}"
 }
 
 echo_ok()




More information about the lfs-book mailing list