[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Do full console initialization in the initrd, not just keymap. (#458362)





Bill Nottingham wrote:
With the advent of plymouth, this means that the virtual console may be
in graphics mode. This causes font setting to fail. Since we can't
realistically wait until plymouth finishes to do this, we need to do
the full initialization before plymouth starts. Copy in the font and
any required mappings, and run the udev console setup helper directly.

This removes the special case for loading the keymap, as it's handled
by this.
---
 mkinitrd |   49 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/mkinitrd b/mkinitrd
index cbf5978..3a9bf0b 100755
--- a/mkinitrd
+++ b/mkinitrd
@@ -1535,9 +1535,10 @@ EOF
if [ $ncryptodevs -ne 0 ]; then
     inst /sbin/cryptsetup "$MNTIMAGE"
+fi
- KEYTABLE=
-    KEYMAP=
+if [ -f /etc/sysconfig/i18n -o -f /etc/sysconfig/keyboard ]; then

Here you are testing for existence of /etc/sysconfig/keyboard

+    I18N=yes
     if [ -f /etc/sysconfig/console/default.kmap ]; then
         KEYMAP=/etc/sysconfig/console/default.kmap
     else
@@ -1548,16 +1549,8 @@ if [ $ncryptodevs -ne 0 ]; then
             KEYMAP="$KEYTABLE.map"
         fi
     fi
-
+    inst /etc/sysconfig/keyboard "$MNTIMAGE"

Yet here you are unconditionally installing it, "inst" will not handle non existing files gracefully!

     if [ -n "$KEYMAP" ]; then
-        LOADKEYS=loadkeys
-        if [ -f /etc/sysconfig/i18n ]; then
-            . /etc/sysconfig/i18n
-        fi
-        if [ "${LANG}" != "${LANG%%.UTF-8}" -o "${LANG}" != "${LANG%%.utf8}" ]; then
-            LOADKEYS="loadkeys -u"
-        fi
-
         inst /bin/loadkeys "$MNTIMAGE"
         findkeymap $KEYMAP
@@ -1573,6 +1566,34 @@ if [ $ncryptodevs -ne 0 ]; then
             esac
         done
     fi
+
+    if [ -f /etc/sysconfig/i18n ]; then
+        . /etc/sysconfig/i18n
+    fi
+    inst /etc/sysconfig/i18n "$MNTIMAGE"

Same here, you check if it exists to source it, but you inst it unconditionally.

+    [ -z "$SYSFONT" ] && SYSFONT=latarcyrheb-sun16
+    if [ -n "$SYSFONT" ]; then

No need to put this in an if, as you've just assured SYSFONT is always set to something.

+        inst /bin/setfont "$MNTIMAGE"
+
+        for FN in /lib/kbd/consolefonts/$SYSFONT.* ; do
+            inst $FN "$MNTIMAGE"
+            case "$FN" in
+                *.gz)
+                    gzip -d "$MNTIMAGE$FN"
+                    ;;
+                *.bz2)
+                    bzip2 -d "$MNTIMAGE$FN"
+                    ;;
+            esac
+        done
+        if [ -n "$SYSFONTACM" ]; then
+            inst /lib/kbd/consoletrans/$SYSFONTACM "$MNTIMAGE"
+        fi
+        if [ -n "$UNIMAP" ]; then
+            inst /lib/kbd/unimaps/$UNIMAP "$MNTIMAGE"
+        fi
+    fi
+    inst /lib/udev/console_init "$MNTIMAGE"
 fi
echo -n >| $RCFILE
@@ -1612,6 +1633,7 @@ fi
 for i in 0 1 2 3 ; do
     emit "mknod /dev/ttyS$i c 4 $(($i + 64))"
 done
+[ -n "$I18N" ] && emit "/lib/udev/console_init tty0"
emit "daemonize --ignore-missing /bin/plymouthd" @@ -1690,11 +1712,6 @@ emitcrypto()
     emit "plymouth ask-for-password --command \"cryptsetup luksOpen $1 $2\""
 }
-if [ -n "$KEYMAP" ]; then
-    emit "echo Loading keymap."
-    emit "$LOADKEYS $KEYMAP"
-fi
-
 for cryptdev in ${!cryptopart } ; do
     emitcrypto `eval echo '$'$cryptdev`
 done

Other then the remarks above it looks ok.

Regards,

Hans


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]