aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorRoman Kyrylych <roman@archlinux.org>2008-02-28 13:55:41 +0200
committerRoman Kyrylych <roman@archlinux.org>2008-02-29 23:17:30 +0200
commit4d0920ede7ce9c3d67e03c67b9ee584cf1a3fe9d (patch)
tree4cff0720cafd0b9466a10801c3e563c8aff279ac /rc.sysinit
parentef86e38e9fd750db35e23aa949aa60e4c9f60f0c (diff)
downloadinitscripts-4d0920ede7ce9c3d67e03c67b9ee584cf1a3fe9d.tar.xz
Make non-UTF-8 consoles work correctly in .24+ kernels
* Since 2.6.24 the virtual terminal is in UTF-8 mode and the keyboard is in Unicode mode by default, and configurable only at run-time. * To make non-UTF-8 consoles work correctly: - the non-UTF-8 mode is set for the virtual terminal, - the XLATE mode is set for the keyboard. * UTF-8 mode is still set explicitly (not relying on default), so console works correctly even in a case when user set vt.default_utf8=0 in kernel commandline, but LOCALE in rc.conf is *.UTF-8. * % is a special symbol for printf, so it should be written twice. Signed-off-by: Roman Kyrylych <roman@archlinux.org>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit22
1 files changed, 17 insertions, 5 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 0e83c8b..1dae885 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -370,17 +370,29 @@ echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
stat_done
if echo "$LOCALE" | /bin/grep -qi utf ; then
- stat_busy "Setting Consoles to UTF-8"
+ stat_busy "Setting Consoles to UTF-8 mode"
+ # 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.
/usr/bin/kbd_mode -u
for i in $(seq 1 63); do
- printf "\e%G" > /dev/vc/${i}
+ printf "\e%%G" > /dev/vc/${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
+ echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e%%G"; fi' >>/etc/profile.d/locale.sh
stat_done
- status "Loading Keyboard Map: $KEYMAP in utf-8 mode" /bin/loadkeys -q -u $KEYMAP
+ status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
else
- status "Loading Keyboard Map: $KEYMAP in legacy mode" /bin/loadkeys -q $KEYMAP
+ stat_busy "Setting Consoles to legacy mode"
+ # make non-UTF-8 consoles work on 2.6.24 and newer kernels
+ /usr/bin/kbd_mode -a
+ for i in $(seq 1 63); do
+ printf "\e%%@" > /dev/vc/${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
+ stat_done
+ status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
fi
if [ -n "$CONSOLEFONT" ]; then