]> git.pld-linux.org Git - packages/kbd.git/blame - kbd.init
- cleaning
[packages/kbd.git] / kbd.init
CommitLineData
8a6e015e 1#!/bin/sh
7c0a328f
TP
2
3# console Loads console font and keyboard table
8a6e015e 4#
6b4f8129 5# chkconfig: 345 70 30
8a6e015e
AM
6#
7# description: Loads the console font, the application-charset map \
8# and the keyboard table.
9
10# This must be executed *after* /usr is mounted.
7c0a328f
TP
11# This means, if /usr is NFS-mounted it needs to
12# be run after networking and NFS mounts are up.
8a6e015e
AM
13
14[ -f /etc/sysconfig/console ] || exit 0
15
16[ -f /bin/loadkeys ] || exit 0
17[ -f /usr/bin/setfont ] || exit 0
18
19# Source function library
20. /etc/rc.d/init.d/functions
21
22case "$1" in
25983a1f 23 start|restart|reload)
24 . /etc/sysconfig/console
8a6e015e 25
25983a1f 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
30 fi
31
32 if [ -n "$SVGATEXTMODE" ]; then
33 run_cmd "Setting Text Mode $SVGATEXTMODE" SVGATextMode $SVGATEXTMODE
34 fi
35 if [ -n "$CONSOLEFONT" ]; then
36 CMD="/usr/bin/setfont -m ${CONSOLEMAP:-trivial} $CONSOLEFONT"
37 show "Loading console font and map"
38 busy
39
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" ] && [ -f /var/lock/subsys/fbset ]; 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"
46 else
47 pattern="s/\/dev\/tty//g"
6b4f8129 48 fi
25983a1f 49
50 # save old tty number
51 tty=`/usr/bin/tty | sed $pattern`
52
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'`"
56 else
57 DEVICES="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d :`"
8a6e015e 58 fi
25983a1f 59
60 [ -z "$SET_FONT_TERMINALS" ] && SET_FONT_TERMINALS="$DEVICES"
61
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
55dbdd10 67 else
25983a1f 68 /usr/bin/open -c $cons -s -w -- /usr/bin/setleds -D -num
55dbdd10 69 fi
7c0a328f 70 fi
25983a1f 71 done
e277f7c8 72
25983a1f 73 if [ $tty = "/dev/console" ]; then tty=1; fi
74 /usr/bin/switchto $tty
75 else
76 $CMD
e277f7c8 77 fi
25983a1f 78 ok
79 fi
80 if [ -n "$KEYTABLE" ]; then
81 run_cmd "Loading keyboard table" loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
82 fi
83 nls "Enabling SAK sequence"
84 echo Control Alt keycode 101 = SAK | loadkeys
85
86 power_option=""
87 if [ "$POWER_SAVE" ]; then
88 if [ "$BLANK_TIME" ]; then
89 power_option="-blank $BLANK_TIME";
e277f7c8 90 fi
25983a1f 91 if [ "$POWERDOWN_TIME" ]; then
92 power_option="-powerdown $POWERDOWN_TIME $power_option";
6400d21c 93 fi
25983a1f 94 /usr/bin/setterm $power_option -powersave $POWER_SAVE
95 fi
96 if [ "$FOREGROUND_COLOUR" ]; then
97 /usr/bin/setterm -foreground $FOREGROUND_COLOUR
98 fi
99 if [ "$BACKGROUND_COLOUR" ]; then
100 /usr/bin/setterm -background $BACKGROUND_COLOUR
101 fi
102 if [ "$BEEPER_LENGHT" ]; then
103 /usr/bin/setterm -blenght $BEEPER_LENGHT
104 fi
105 ;;
106 stop)
107 . /etc/sysconfig/console
108 run_cmd "Setting terminals to default values" /usr/bin/setterm -default
109 ;;
110 status)
111 /usr/bin/setleds
112 ;;
113 *)
114 msg_usage "$0 {start|stop|restart|reload|status}"
115 exit 1
8a6e015e
AM
116esac
117
118exit 0
This page took 0.104163 seconds and 4 git commands to generate.