| Current Path : /usr/bin/ |
| Current File : //usr/bin/unicode_start |
#!/bin/sh
# start unicode mode
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
if /usr/bin/vt-is-UTF8 --quiet ; then
echo "unicode_start: Already in UTF8 mode" >&2
exit 0
fi
# We want kbd to be in unicode mode before we run loadkeys;
# otherwise confusion over keysyms reigns.
kbd_mode -u
dumpkeys | loadkeys --unicode > /dev/null
case $# in
2)
consolechars --font=$1 --sfm=$2
;;
1)
consolechars --font=$1
;;
0)
;;
*)
echo "usage: unicode_start [font [unicode map]]"
;;
esac
# set DEVICE_PREFIX depending on devfs/udev
if [ -d /dev/vc ]; then
DEVICE_PREFIX="/dev/vc/"
else
DEVICE_PREFIX="/dev/tty"
fi
NUM=`fgconsole --next-available`
NUM=`expr ${NUM} - 1 `
# This needs a better fix, but because unicode_{start,stop} are called
# before getty starts the other consoles, if only one console set, then
# set for the first 6 VTs, since these are normally started by inittab
[ $NUM -eq 1 ] && NUM=6
for vc in `seq 1 ${NUM}`
do
# Since 1.2.1 - for older kernels, use: echo -n -e '\033%8'
/bin/echo -n -e '\033%G' > ${DEVICE_PREFIX}${vc}
done