Index: kbd/src/unicode_stop =================================================================== --- kbd.orig/src/unicode_stop +++ kbd/src/unicode_stop @@ -1,4 +1,18 @@ #!/bin/sh + +if [ ! -e /proc/self/fd/0 ] ; then + echo "Won't set ascii mode: Can't determine console type;" >&2 + echo " Please ensure that /proc is mounted." >&2 + exit 1 +fi + +readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console +if [ $? -eq 1 ]; then + echo "Won't set ascii mode: not a VT." >&2 + exit 1 +fi + # stop unicode kbd_mode -a + echo -n -e '\033%@' Index: kbd/src/unicode_start =================================================================== --- kbd.orig/src/unicode_start +++ kbd/src/unicode_start @@ -1,6 +1,19 @@ #!/bin/sh # Enables Unicode processing in the current console. # + +if [ ! -e /proc/self/fd/0 ] ; then + echo "Won't set unicode mode: Can't determine console type;" >&2 + echo " Please ensure that /proc is mounted." >&2 + exit 1 +fi + +readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console +if [ $? -eq 1 ]; then + echo "Won't set unicode mode: not a VT." >&2 + exit 1 +fi + # 1. The input side: the keyboard driver. # Set the keyboard driver in Unicode mode. (Default is ASCII mode.)