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 -o -f /usr/bin/loadkeys ] || exit 0
17 [ -f /bin/setfont -o -f /usr/bin/setfont ] || exit 0
19 [ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
21 # Source function library
22 . /etc/rc.d/init.d/functions
25 start|restart|reload|force-reload)
26 . /etc/sysconfig/console
28 # Checking if we have framebuffer enabled
29 if [ -f /proc/fb ]; then
30 # /proc shows as files with size=0, this is workaround
31 if cat /proc/fb | grep -q "."; then FB=yes; fi
34 if [ -n "$SVGATEXTMODE" ]; then
35 run_cmd "Setting Text Mode $SVGATEXTMODE" SVGATextMode $SVGATEXTMODE
38 # Check for devfs (workaround: -a option doesn't work at all)
39 if [ -d /dev/vc ]; then
40 pattern="s/\/dev\/vc\///g"
42 pattern="s/\/dev\/tty//g"
45 tty=`/usr/bin/tty | sed $pattern`
46 if [ "$tty" = "/dev/console" ]; then
50 if [ -n "$CONSOLEFONT" -a -x /sbin/setsysfont ]; then
51 CMD="/sbin/setsysfont"
52 show "Loading console font and map"
55 # don't initialize on multiple terminals if we use fbset
56 # (assume that, in this case fb is loaded as a module)
57 if [ ! -z "$FB" ]; then
59 # check if devfs (workaround: -a option doesn't work at all)
60 if [ -d /dev/vc ]; then
61 DEVICES="`ls /dev/vc/* | sed 's|/dev/vc/||g'`"
63 DEVICES="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d :`"
66 [ -z "$SET_FONT_TERMINALS" ] && SET_FONT_TERMINALS="$DEVICES"
68 for cons in $SET_FONT_TERMINALS; do
69 /usr/bin/open -c $cons -s -w -- $CMD
70 if [ "$NUM_LOCK" ]; then
71 if [ $NUM_LOCK = "on" ]; then
72 /usr/bin/open -c $cons -s -w -- /usr/bin/setleds -D +num
74 /usr/bin/open -c $cons -s -w -- /usr/bin/setleds -D -num
79 /usr/bin/switchto $tty
86 if [ -n "$KEYTABLE" ]; then
89 run_cmd "Loading keyboard table" loadkeys -u $KEYTABLE < /dev/tty0 > /dev/tty0
92 run_cmd "Loading keyboard table" loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
95 run_cmd "Enabling SAK sequence" /bin/sh -c "echo Control Alt keycode 101 = SAK | loadkeys"
98 if [ "$POWER_SAVE" ]; then
99 if [ "$BLANK_TIME" ]; then
100 power_option="-blank $BLANK_TIME";
102 if [ "$POWERDOWN_TIME" ]; then
103 power_option="-powerdown $POWERDOWN_TIME $power_option";
106 setterm_option="$power_option"
107 if [ "$FOREGROUND_COLOUR" ]; then
108 setterm_option="$setterm_option -foreground $FOREGROUND_COLOUR"
110 if [ "$BACKGROUND_COLOUR" ]; then
111 setterm_option="$setterm_option -background $BACKGROUND_COLOUR"
113 if [ "$BEEP_LENGTH" ]; then
114 setterm_option="$setterm_option -blength $BEEP_LENGTH"
116 setterm_option="$setterm_option -store"
118 for cons in $SET_FONT_TERMINALS; do
119 /usr/bin/open -c $cons -s -w -- /usr/bin/setterm $setterm_option
121 /usr/bin/switchto $tty
125 . /etc/sysconfig/console
126 run_cmd "Setting terminals to default values" /usr/bin/setterm -default
132 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"