Author: dnicholson
Date: 2007-02-22 15:41:03 -0700 (Thu, 22 Feb 2007)
New Revision: 7930

Modified:
   trunk/bootscripts/ChangeLog
   trunk/bootscripts/lfs/init.d/console
Log:
POSIX shells don't trap on ERR


Modified: trunk/bootscripts/ChangeLog
===================================================================
--- trunk/bootscripts/ChangeLog 2007-02-22 22:34:23 UTC (rev 7929)
+++ trunk/bootscripts/ChangeLog 2007-02-22 22:41:03 UTC (rev 7930)
@@ -1,4 +1,10 @@
 2007-02-22     Dan Nicholson   <[EMAIL PROTECTED]>
+       * lfs/init.d/console: POSIX says that shells only need to trap on
+         signals. Trapping on ERR isn't always supported. Conditionals have
+         been added to set the $failed variable in spots that seemed
+         appropriate for checking errors.
+
+2007-02-22     Dan Nicholson   <[EMAIL PROTECTED]>
        * lfs/init.d/functions: Use arithmetic expansion and string length,
          which are both mandated by POSIX, rather than spawning two processes
          every time boot_mesg() is called.

Modified: trunk/bootscripts/lfs/init.d/console
===================================================================
--- trunk/bootscripts/lfs/init.d/console        2007-02-22 22:34:23 UTC (rev 
7929)
+++ trunk/bootscripts/lfs/init.d/console        2007-02-22 22:41:03 UTC (rev 
7930)
@@ -29,7 +29,6 @@
 }
 
 failed=0
-trap failed=1 ERR
 
 case "${1}" in
        start)
@@ -63,14 +62,19 @@
                        grep -o '\btty[[:digit:]]*\b'`
                do
                        openvt -f -w -c ${TTY#tty} -- \
-                               /bin/sh -c "${MODE_COMMAND}"
+                               /bin/sh -c "${MODE_COMMAND}" || failed=1
                done
 
                # Set the font (if not already set above) and the keymap
-               is_true "${USE_FB}" ||  [ -z "${FONT}" ] || setfont $FONT
-               [ -z "${KEYMAP}" ] || loadkeys ${KEYMAP} &>/dev/null
+               is_true "${USE_FB}" || [ -z "${FONT}" ] ||
+                       setfont $FONT ||
+                       failed=1
+               [ -z "${KEYMAP}" ] ||
+                       loadkeys ${KEYMAP} &>/dev/null ||
+                       failed=1
                [ -z "${KEYMAP_CORRECTIONS}" ] ||
-                       loadkeys ${KEYMAP_CORRECTIONS} &>/dev/null
+                       loadkeys ${KEYMAP_CORRECTIONS} &>/dev/null ||
+                       failed=1
 
                # Linux kernel generates wrong bytes when composing
                # in Unicode mode. That's why we disable dead keys in Unicode
@@ -82,11 +86,14 @@
 
                [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE"
                ! is_true "$BROKEN_COMPOSE" ||
-                       echo "" | loadkeys -c &>/dev/null
+                       echo "" | loadkeys -c &>/dev/null ||
+                       failed=1
                
                # Convert the keymap from $LEGACY_CHARSET to UTF-8
                [ -z "$LEGACY_CHARSET" ] ||
-                       dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u &>/dev/null
+                       dumpkeys -c "$LEGACY_CHARSET" |
+                       loadkeys -u &>/dev/null ||
+                       failed=1
 
                # If any of the commands above failed, the trap at the
                # top would set $failed to 1

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to