3 # console Loads console font and keyboard table
7 # description: Loads the console font, the application-charset map \
8 # and the keyboard table.
10 # This must be executed *after* /usr is mounted.
11 # This means, if /usr is NFS-mounted it needs to
12 # be run after networking and NFS mounts are up.
14 [ -f /etc/sysconfig/console ] || exit 0
16 [ -f /bin/loadkeys ] || exit 0
17 [ -f /usr/bin/setfont ] || exit 0
19 # Source function library
20 . /etc/rc.d/init.d/functions
23 start|restart|reload|force-reload)
24 . /etc/sysconfig/console
26 # Checking if we have framebuffer enabled
27 if [ -f /proc/fb ]; then
28 # /proc shows as files with size=0, this is workaround
29 if cat /proc/fb | grep -q "."; then FB=yes; fi
32 if [ -n "$SVGATEXTMODE" ]; then
33 run_cmd "Setting Text Mode $SVGATEXTMODE" SVGATextMode $SVGATEXTMODE
35 if [ -n "$CONSOLEFONT" ]; then
36 CMD="/usr/bin/setfont -m ${CONSOLEMAP:-trivial} $CONSOLEFONT"
37 show "Loading console font and map"
40 # don't initialize on multiple terminals if we use fbset
41 # (assume that, in this case fb is loaded as a module)
42 if [ ! -z "$FB" ]; then
43 # Check for devfs (workaround: -a option don't work at all)
44 if [ -d /dev/vc ]; then
45 pattern="s/\/dev\/vc\///g"
47 pattern="s/\/dev\/tty//g"
51 tty=`/usr/bin/tty | sed $pattern`
53 # check if devfs (workaround: -a option don't work at all)
54 if [ -d /dev/vc ]; then
55 DEVICES="`ls /dev/vc/* | sed 's|/dev/vc/||g'`"
57 DEVICES="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d :`"
60 [ -z "$SET_FONT_TERMINALS" ] && SET_FONT_TERMINALS="$DEVICES"
62 for cons in $SET_FONT_TERMINALS; do
63 /usr/bin/open -c $cons -s -w -- $CMD
64 if [ "$NUM_LOCK" ]; then
65 if [ $NUM_LOCK = "on" ]; then
66 /usr/bin/open -c $cons -s -w -- /usr/bin/setleds -D +num
68 /usr/bin/open -c $cons -s -w -- /usr/bin/setleds -D -num
73 if [ $tty = "/dev/console" ]; then tty=1; fi
74 /usr/bin/switchto $tty
80 if [ -n "$KEYTABLE" ]; then
81 run_cmd "Loading keyboard table" loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
83 run_cmd "Enabling SAK sequence" /bin/sh -c "echo Control Alt keycode 101 = SAK | loadkeys"
86 if [ "$POWER_SAVE" ]; then
87 if [ "$BLANK_TIME" ]; then
88 power_option="-blank $BLANK_TIME";
90 if [ "$POWERDOWN_TIME" ]; then
91 power_option="-powerdown $POWERDOWN_TIME $power_option";
93 /usr/bin/setterm $power_option -powersave $POWER_SAVE
95 if [ "$FOREGROUND_COLOUR" ]; then
96 /usr/bin/setterm -foreground $FOREGROUND_COLOUR
98 if [ "$BACKGROUND_COLOUR" ]; then
99 /usr/bin/setterm -background $BACKGROUND_COLOUR
101 if [ "$BEEP_LENGTH" ]; then
102 /usr/bin/setterm -blength $BEEP_LENGTH
106 . /etc/sysconfig/console
107 run_cmd "Setting terminals to default values" /usr/bin/setterm -default
113 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"