]> git.pld-linux.org Git - packages/kbd.git/blob - kbd.init
- release 19 - new doc, added BR, STBR
[packages/kbd.git] / kbd.init
1 #!/bin/sh
2
3 # console       Loads console font and keyboard table
4 #
5 # chkconfig:    345 70 30
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.
11 # This means, if /usr is NFS-mounted it needs to
12 # be run after networking and NFS mounts are up.
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
22 case "$1" in
23         start|restart)
24                 . /etc/sysconfig/console
25
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" ]
33                 then
34                         run_cmd "Setting Text Mode $SVGATEXTMODE" SVGATextMode $SVGATEXTMODE
35                 fi
36                 if [ -n "$CONSOLEFONT" ]
37                 then
38                         CMD="/usr/bin/setfont -m ${CONSOLEMAP:-trivial} $CONSOLEFONT"
39                         show "Loading console font and map"; busy
40
41                         # don't initialize on multiple terminals if we use fbset
42                         # (assume that, in this case fb is loaded as a module)
43                         if [ ! -z $FB ] && [ -f /var/lock/subsys/fbset ]; then                  
44                                 # Check for devfs (workaround: -a option don't work at all)
45                                 if [ -d /dev/vc ]; then
46                                         pattern="s/\/dev\/vc\///g"
47                                 else
48                                         pattern="s/\/dev\/tty//g"
49                                 fi
50                                 
51                                 # save old tty number
52                                 tty=`/usr/bin/tty | sed $pattern`
53                                 
54                                 # check if devfs (workaround: -a option don't work at all)
55                                 if [ -d /dev/vc ]; then
56                                         DEVICES="`ls /dev/vc/* | sed 's|/dev/vc/||g'`"
57                                 else
58                                         DEVICES="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d :`"
59                                 fi
60
61                                 [ -z "$SET_FONT_TERMINALS" ] && SET_FONT_TERMINALS="$DEVICES"
62                                 
63                                 for cons in $SET_FONT_TERMINALS; do
64                                         /usr/bin/open -c $cons -s -w -- $CMD
65                                 done
66                                 
67                                 if [ $tty = "/dev/console" ]; then tty=1; fi
68                                 /usr/bin/switchto $tty
69                         else
70                                 $CMD
71                         fi
72                         ok
73                 fi
74                 if [ -n "$KEYTABLE" ]
75                 then
76                         run_cmd "Loading keyboard table" loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
77                 fi
78                 echo "Enabling SAK sequence"
79                 echo Control Alt keycode 101 = SAK | loadkeys
80
81                 power_option=""
82                 if [ $POWER_SAVE ]; then
83                         if [ $BLANK_TIME ]; then
84                                 power_option="-blank $BLANK_TIME";
85                         fi
86                         if [ $POWERDOWN_TIME ]; then
87                                 power_option="-powerdown $POWERDOWN_TIME $power_option";
88                         fi
89                         /usr/bin/setterm $power_option -powersave $POWER_SAVE
90                 fi
91                 if [ $FOREGROUND_COLOUR ]; then
92                         /usr/bin/setterm -foreground $FOREGROUND_COLOUR
93                 fi
94                 if [ $BACKGROUND_COLOUR ]; then
95                         /usr/bin/setterm -background $BACKGROUND_COLOUR
96                 fi
97                 ;;
98         stop)
99                 /usr/bin/setterm -defaults
100                 ;;
101         status)
102                 # Nothing to report
103                 ;;
104         *)
105                 msg_usage "$0 {start|stop|status|restart}"
106                 exit 1
107 esac
108
109 exit 0
This page took 0.188094 seconds and 4 git commands to generate.