From f5e96d257471c93c3a528f101958bdaa42a80bf3 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 29 Jul 2009 01:12:23 -0300 Subject: [PATCH 1/2] Make dynamic initilization code for consoles. This changes the currect code for console initialization to make it dynamic. For example when boot on UML the number of consoles is 15 and not 63. Signed-off-by: Gerardo Exequiel Pozzi --- rc.sysinit | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 777ffe9..298f446 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -358,9 +358,9 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then # UTF-8 consoles are default since 2.6.24 kernel # this code is needed not only for older kernels, # but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8. - for i in $(/usr/bin/seq 0 63); do - /usr/bin/kbd_mode -u < /dev/tty${i} - printf "\e%%G" > /dev/tty${i} + for i in /dev/tty[0-9]*; do + /usr/bin/kbd_mode -u < ${i} + printf "\e%%G" > ${i} done # the $CONSOLE check helps us avoid this when running scripts from cron echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e%%G"; fi' >>/etc/profile.d/locale.sh @@ -369,9 +369,9 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then else stat_busy "Setting Consoles to legacy mode" # make non-UTF-8 consoles work on 2.6.24 and newer kernels - for i in $(/usr/bin/seq 0 63); do - /usr/bin/kbd_mode -a < /dev/tty${i} - printf "\e%%@" > /dev/tty${i} + for i in /dev/tty[0-9]*; do + /usr/bin/kbd_mode -a < ${i} + printf "\e%%@" > ${i} done # the $CONSOLE check helps us avoid this when running scripts from cron echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e%%@"; fi' >>/etc/profile.d/locale.sh @@ -385,18 +385,18 @@ if [ -n "$CONSOLEFONT" ]; then if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | /bin/grep -qi utf ; then CONSOLEMAP="" fi - for i in $(/usr/bin/seq 0 63); do + for i in /dev/tty[0-9]*; do if [ -n "$CONSOLEMAP" ]; then - /usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C /dev/tty${i} >/dev/null 2>&1 + /usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C ${i} >/dev/null 2>&1 else - /usr/bin/setfont $CONSOLEFONT -C /dev/tty${i} >/dev/null 2>&1 + /usr/bin/setfont $CONSOLEFONT -C ${i} >/dev/null 2>&1 fi done if [ $? -ne 0 ]; then stat_fail else - for i in $(/usr/bin/seq 0 63); do - printf "\e(K" > /dev/tty${i} + for i in /dev/tty[0-9]*; do + printf "\e(K" > ${i} done # the $CONSOLE check helps us avoid this when running scripts from cron echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e(K"; fi' >>/etc/profile.d/locale.sh -- 1.6.3.3